-
Notifications
You must be signed in to change notification settings - Fork 225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
audio key error in text to stream #136
Comments
change File "/Users/bbekdemir/Developer/bookie_pepper/venv/lib/python3.11/site-packages/elevenlabs/api/tts.py", line 99, in generate_stream_input to |
How does that help - audio key does not exist. |
Having the same problem |
from elevenlabs import generate, stream, play
audio = generate(
text="Hi! My name is Bella, nice to meet you!",
voice="Bella",
model='eleven_monolingual_v1',
stream=True
)
# Stream the audio directly
stream(audio)
# Saving the audio for later
with open('output.mp3', 'wb') as f:
for i,chunk in enumerate(audio):
if chunk: f.write(chunk)
Please try this |
I just tried in the tts.py file to print the data in order to see what it contained and I saw that I was getting a 401 error, because no api key was set. |
This worked (adding the set_api_key("") just before 'generate', but only the first time for some reason. I re-ran the exact same code and it gave me again the same error: KeyError: 'audio' Changing data["audio"] to data.get("audio") doesn't help (there's no 'audio') |
i'd suggest to add in tts.py before the |
@bbekdemir @nikolas-n @Mascobot : Did anyone fixed this bug? It seems, whenever user is sending request, elevenlab is not sending result through websocket. Seems more of server issue or webhook url seems incorrect. |
@nitishymtpl I just had a close look and found that it is coming from server, the output is
This is why a the audio is streamed for the first time but not on rerunning the code. |
@kgovind0001 thx. I am actually using a paid plan... |
@Mascobot : Are you having same issues or working perfect? |
@Mascobot It should work for you then. I just subscribed to a paid membership. Can you please give the below a try and let me know if you face any issue. #https://github.com/elevenlabs/elevenlabs-python/issues/136
from elevenlabs import generate, stream
def text_stream():
yield "Hi there"
yield "I am a text"
audio = generate(
text=text_stream(),
voice="Nicole",
model='eleven_monolingual_v1',
stream=True,
api_key = "put api key here"
)
# Stream the audio directly
stream(audio)
|
getting this problem too and I don't want to have to change the library code. |
@cdubiel Can you please provide the code and the error ? The below code snippet worked for me. Make sure you have paid subscription.
|
@kgovind0001: Even with the paid plan, this is the error:
|
This error occurs when the SSL certificate of the server cannot be verified. |
I do get this error quite often now ~50% of the time.
|
Running the test code fails for me as well.
(Output)
|
Same here, any updates? |
I edited the if data["audio"]: The elevenlabs package is assuming "audio" is present in every websocket message, which is not the case if you want to fix it in the meantime, just change that line to: if data.get("audio"): Since |
@RicardoEscobar your suggestion and changing to a paid plan worked for me! thx! |
I also ran into this issue while using the streaming text-to-speech API. The Proposed Solution: Workarounds:
|
make sure you subscribed |
Debugging the tts file as @rosscado suggested, I was able to see the root cause of the issue:
Changing to a paid subscription solved it. |
thank you
…On Thu, Mar 7, 2024 at 11:39 AM roperi ***@***.***> wrote:
Debugging the tts file as @rosscado <https://github.com/rosscado>
suggested, I was able to see the root cause of the issue:
{'message': 'Unusual activity detected. Free Tier usage disabled. If you are using a proxy/VPN you might need to purchase a Paid Plan to not trigger our abuse detectors. Free Tier only works if users do not abuse it, for example by creating multiple free accounts. If we notice that many people try to abuse it, we will need to reconsider Free Tier altogether. \nPlease play fair and purchase any Paid Subscription to continue.', 'error': 'detected_unusual_activity', 'code': 1008}
Changing to a paid subscription solved it.
—
Reply to this email directly, view it on GitHub
<#136 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACDLCWG7Z4P7OSCI2T5WARLYXCQ6JAVCNFSM6AAAAAA7E5EJMOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOBUGA4TCMZYHE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
This is fixed in the latest SDK (snippet). Please reopen if the issue still persists! |
The text was updated successfully, but these errors were encountered: