Skip to content
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

VoiceChanger example would be welcome - SpeechToSpeechClient.convert_as_stream() - should require "audio" parameter? #397

Open
gwpl opened this issue Oct 29, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@gwpl
Copy link

gwpl commented Oct 29, 2024

Description

VoiceChanger in playground:
https://elevenlabs.io/app/speech-synthesis/speech-to-speech
does not require any "audio" file. Just voice and parameters.
(btw. it would be very helpful is playground would generate working code snippets with parameters one set in playground...)

However in "speech-to-speech" API reference I see
https://elevenlabs.io/docs/api-reference/speech-to-speech
that "audio" is marked as "required" for normal endpoint,
but is not in "streaming" endpoint.

However when I try to run as stream I get error to provide audio parameter:

elevenlabs_streaming_voice_to_voice.py Traceback (most recent call last):
  File "/.../elevenlabs_streaming_voice_to_voice.sh", line 15, in <module>
    client.speech_to_speech.convert_as_stream(
TypeError: SpeechToSpeechClient.convert_as_stream() missing 1 required keyword-only argument: 'audio'

Also there is parameter annotated as "voice_settings" , as "json parameters", to be frank it's pretty hard how to go from parameters in playground ( https://elevenlabs.io/app/speech-synthesis/speech-to-speech ) to json, there should be button "copy as json" that would copy to clipboard, or sth like that. (or whole code snippet generation)

Code example

#!/usr/bin/env python3

from elevenlabs import ElevenLabs

client = ElevenLabs(
#    api_key="YOUR_API_KEY", #commented to use environment variable
)
## Brian
voice_id='nPczCjzI2devNBz1zQrb'

# as making minimal working example, commenting parameters that are optional to see if it works
client.speech_to_speech.convert_as_stream(
    voice_id=voice_id,
    enable_logging="0",
    #output_format="mp3_22050_32", #default: mp3_44100_128 #should work with default value
    #remove_background_noise=true, #default: false #should work with default value
)

Additional context

No response

@gwpl gwpl added the bug Something isn't working label Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant