elevenlabs / elevenlabs-python

The official Python API for ElevenLabs Text to Speech.
https://elevenlabs.io/docs/api-reference/getting-started
MIT License
2.22k stars 258 forks source link

Save voice generated with voice.generation.generate() in Library #367

Open victorrosi opened 1 month ago

victorrosi commented 1 month ago

Hello,

I would like to use the Voice Design tool in python in order to create new voices, save them in my library and reuse them later.

To do this is used this:

audio = client.voice_generation.generate(
            gender="male", 
            accent="british", 
            age="middle_aged", 
            accent_strength=1.5,
            text="I will always love Maggie Smith. Please Maggie Smith, come back! My life will never be the same without Maggie Smith. ",
        )

save(audio,"test.wav")

It created an audiofile however I still haven't find a way to access the "generated_voice_id" in order to save the voice with voice_generation.generate_parameters() and use the voice to generate more content.

I tried to use the x-trace-id from the headers of the response using get on the provided URL thinking that it would keep the ID in some kind of cache related to my API-key. But was unsuccessful (finally understood that it was generating new ones everytime I would call it).

Can you help me please and explain what I don't understand and doing wrong?

Thank you in advance!