Skip to main content

How to Clone a Voice

Voice cloning is a powerful feature that allows you to create a digital replica of a voice using a sample audio file. This can be particularly useful for creating personalized text-to-speech applications, voice assistants, and more. In this guide, we will walk you through the process of cloning a voice using the Neuphonic API. You will learn how to prepare your audio sample, send it to the API for cloning, and use the cloned voice in your applications. Let's get started!

Clone a Voice

Prepare Your Voice

In order to clone a voice, you need an audio sample of the target voice you want to clone. The audio sample must adhere to the following requirements.

Make sure the audio sample is clear and free of background noise. The better the quality of your audio sample, the more accurately the cloning process will replicate the voice.

Clone Your Voice

To clone a voice, you need to send a POST request to the Neuphonic API with the necessary parameters. This includes the name you want to assign to the cloned voice, any descriptive tags, and the path to the audio file you wish to use for cloning.

curl -X POST "http://api.neuphonic.com/voices?voice_name=<VOICE_NAME>" \
-H "X-API-KEY: <API_KEY>" \
-F "voice_tags=<VOICE_TAGS>" \
-F "voice_file=@<FILE_PATH>.wav;type=audio/wav"

# Example:
# curl -X POST "http://api.neuphonic.com/voices?voice_name=Mike" \
# -H "X-API-KEY: <API_KEY>" \
# -F "voice_tags=Male, Thirties" \
# -F "voice_file=@./audio_sample.wav;type=audio/wav"

You can now view your cloned voice when you get a list of all voices available in your library using GET /voices:

curl -X GET "http://api.neuphonic.com/voices" \
-H "X-API-KEY: <API_KEY>"

You can now utilize this cloned voice with its voice_id by following the instructions in How to Use Text to Speech.

note

Currently Neuphonic only supports voice cloning in English.

Delete a Cloned Voice

To delete a voice, you need to send a DELETE /voices request with the voice_id of the voice you want to delete:

curl -X DELETE "http://api.neuphonic.com/voices/<VOICE_ID>" \
-H "X-API-KEY: <API_KEY>"
from pyneuphonic import Neuphonic
import os

# Ensure the API key is set in your environment
client = Neuphonic(api_key=os.environ.get('NEUPHONIC_API_KEY'))

# Delete using the voices `voice_id`
response = client.voices.delete(voice_id='<VOICE_ID>')

print(response.data) # display response