Voice Remixing quickstart
This guide shows you how to remix an existing voice to create a new one.
This guide will show you how to create an entirely new voice by remixing an existing one.
Using the Voice Design API
Section titled “Using the Voice Design API”Make the API request
Remixing a voice is a two step process:
- Generate a preview of the new voice by providing a voice ID and a prompt.
- Create the new voice from the preview.
We’ll start by generating a preview of the new voice.
Create a new file named
example.pyorexample.mts, depending on your language of choice and add the following code:Python # example.py from dotenv import load_dotenv from elevenlabs.client import ElevenLabs from elevenlabs.play import play import base64 load_dotenv() elevenlabs = ElevenLabs( api_key=os.getenv("ELEVENLABS_API_KEY"), ) voices = elevenlabs.text_to_voice.remix( voice_id="JBFqnCBsd6RMkjVDRZzb" voice_description="Use a higher pitch and change to a Boston accent.", text="Of course I'm a Bostonian, I've lived here all my life!", ) for preview in voices.previews: # Convert base64 to audio buffer audio_buffer = base64.b64decode(preview.audio_base_64) print(f"Playing preview: {preview.generated_voice_id}") play(audio_buffer)Execute the code
Python python example.pyYou should hear the generated voice previews playing through your speakers, one at a time.
Add generated voice to your library
Once you’ve generated the previews and picked your favorite, you can add it to your voice library via the generated voice ID so it can be used with other APIs.
Python voice = elevenlabs.text_to_voice.create( voice_name="Bostonian", voice_description="A high pitched Bostonian accent.", # The generated voice ID of the preview you want to use, # using the first in the list for this example generated_voice_id=voices.previews[0].generated_voice_id ) print(voice.voice_id)