elevenlabs / elevenlabs-docs

Documentation for elevenlabs.io/docs
https://elevenlabs.io/docs
66 stars 287 forks source link

Issue on docs #40

Open mfourman4 opened 1 year ago

mfourman4 commented 1 year ago

Path: /api-reference/text-to-speech

I a trying to set the language in an API call to Portuguese (Portugal).

I have tried the code:

data = { "text": "Eles jogam futebol aos domingos.", "voice": "Bella", "lang": "pt-PT", "model_id": "eleven_multilingual_v2", "voice_settings": { "stability": 0.5, "similarity_boost": 0.5 } }

But the response I am getting is always in Brazilian Portuguese.

How can I force the language to Portuguese from Portugal?

mfourman4 commented 1 year ago

Here's my entire code:

`import requests from IPython.display import Audio

CHUNK_SIZE = 1024 url = "https://api.elevenlabs.io/v1/text-to-speech/EXAVITQu4vr4xnSDxMaL"

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

data = { "text": "", "voice": "Bella", "lang": "pt-PT", "model_id": "eleven_multilingual_v2", "voice_settings": { "stability": 0.5, "similarity_boost": 0.5 } }

response = requests.post(url, json=data, headers=headers)

Save response as WAV file

with open("output.mp3", "wb") as f: for chunk in response.iter_content(chunk_size=CHUNK_SIZE): if chunk: f.write(chunk)

Audio("output.mp3")`