elevenlabs-python icon indicating copy to clipboard operation
elevenlabs-python copied to clipboard

Unable to use voice_id

Open veeragoni opened this issue 9 months ago • 8 comments

I am using a voice_id from the library in python SDK, but I get an error saying

status_code: 400, body: {'detail': {'status': 'voice_does_not_exist', 'message': 'A voice with voice_id TqZ039H4XqpiGTowubpy does not exist.'}}

Here is the code. I can pass a voice name (not the name it has though. a different one, ex: Chris). Are VoiceLab voices are not available via Python SDK? I am assuming they will be available via REST API.

    voice_client = ElevenLabs()
    audio_stream = voice_client.generate(
        text=msg.content,
        voice="TqZ039H4XqpiGTowubpy",
        model="eleven_multilingual_v2",
        stream=True)

veeragoni avatar May 13 '24 03:05 veeragoni

I even tried following. same issue

    """
    Converts text to speech and returns the audio data as a byte stream.

    This function invokes a text-to-speech conversion API with specified parameters, including
    voice ID and various voice settings, to generate speech from the provided text. Instead of
    saving the output to a file, it streams the audio data into a BytesIO object.

    Args:
        text (str): The text content to be converted into speech.

    Returns:
        IO[bytes]: A BytesIO stream containing the audio data.
    """
    # Perform the text-to-speech conversion
    response = client.text_to_speech.convert(
        voice_id=voice_id,  # Adam pre-made voice
        optimize_streaming_latency="0",
        output_format="mp3_22050_32",
        text=text,
        model_id="eleven_multilingual_v2",
        voice_settings=VoiceSettings(
            stability=0.0,
            similarity_boost=1.0,
            style=0.0,
            use_speaker_boost=True,
        ),
    )

    print("Streaming audio data...")

    # Create a BytesIO object to hold audio data
    audio_stream = BytesIO()

    # Write each chunk of audio data to the stream
    for chunk in response:
        if chunk:
            audio_stream.write(chunk)

    # Reset stream position to the beginning
    audio_stream.seek(0)

    # Return the stream for further use
    return audio_stream```

veeragoni avatar May 13 '24 04:05 veeragoni

Hey @veeragoni -- do you mind trying the same code snippets but with passing in an api key?

dsinghvi avatar May 13 '24 06:05 dsinghvi

I actually have the api key coming from environment variables.

this call works fine. its jus that voice_id doesn't work.

    audio_stream = voice_client.generate(
        text=msg.content,
        # voice="TqZ039H4XqpiGTowubpy",
        voice = "Chris",
        model="eleven_multilingual_v2",
        stream=True)

veeragoni avatar May 13 '24 22:05 veeragoni

@veeragoni that's interesting, we haven't been able to create a successful reproduction. Would you be up to grab 15 minutes with me to help get to the bottom of this?

dsinghvi avatar May 13 '24 22:05 dsinghvi

Sure. Meantime can you try on a free account vs. paid. That could be it too? I will grab time anyways.

veeragoni avatar May 13 '24 23:05 veeragoni

was this ever resolved? I'm been having the same issue. it looks like you can't use custom voice lab voices. doesn't recognize the voice id

mhussar avatar May 22 '24 03:05 mhussar

@mhussar do you have a reproduction of the issue? we weren't able to reproduce it with @veeragoni

dsinghvi avatar Jun 12 '24 13:06 dsinghvi

@dsinghvi we are having the same issue and we are able to reproduce

rawadtraboulsi avatar Jun 13 '24 15:06 rawadtraboulsi