#Would really appreciate some suggestions. I have built a simple app on bubble.io that generates sho

1 messages · Page 1 of 1 (latest)

gentle radishBOT
#
AI-generated Answer for sunset_samurai.

Sure, I'd be happy to help! To convert your generated text into audio files using the ElevenLabs API, you'll need to make a POST request to the Text-to-Speech endpoint. Here's a basic Python example of how you can do this:

import requests

CHUNK_SIZE = 1024
url = "https://api.elevenlabs.io/v1/text-to-speech/<voice-id>"

headers = {
  "Accept": "audio/mpeg",
  "Content-Type": "application/json",
  "xi-api-key": "<xi-api-key>"
}

data = {
  "text": "<your-dynamic-text>",
  "model_id": "eleven_monolingual_v1",
  "voice_settings": {
    "stability": 0.5,
    "similarity_boost": 0.5
  }
}

response = requests.post(url, json=data, headers=headers)
with open('output.mp3', 'wb') as f:
    for chunk in response.iter_content(chunk_size=CHUNK_SIZE):
        if chunk:
            f.write(chunk)

In this example, you'll need to replace <voice-id> with the ID of the voice model you want to use, <xi-api-key> with your API key for authentication, and <your-dynamic-text> with the text you want to convert to speech. The output audio file will be saved as 'output.mp3'.

Please note that the voice_id can be fetched using the GET /v1/voices endpoint. You can find more information about this in the Get Voices endpoint documentation.

Remember to handle the dynamic text properly. If the text is coming from an external source or user input, make sure it's properly formatted and escaped to prevent any issues with the API request.

slender python
#

If i am using bubble.io how would i accomplish this?