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.

File Name

File name can only contain alphanumeric characters (a-z, A-Z, 0-9), underscores (_), and hyphens (-).

Audio Duration

Audio sample must be at least 1 second long.

File Format

Audio file must be either .mp3 or .wav file format.

File Size

Audio file can not exceed 10mb.

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://eu-west-1.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://eu-west-1.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://eu-west-1.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.

Currently Neuphonic only supports voice cloning in English.

Update a Cloned Voice

To modify an existing cloned voice, you need to send a PATCH /voices request with the required parameters. This includes the voice_id of the cloned voice you wish to modify, and any new details such as a new name new_voice_name, new descriptive tags new_voice_tags, or a new audio file to regenerate the cloned voice.

You do not need to provide all parameters; only the ones you provide will be updated. The response will include the updated voice attributes.

# Provide any, or all of new_voice_name, new_voice_tags, or voice_file
curl -X PATCH "http://eu-west-1.api.neuphonic.com/voices/<VOICE_ID>?new_voice_name=<NEW_VOICE_NAME>" \
     -H "X-API-KEY: <API_KEY>" \
     -F "new_voice_tags=<NEW_VOICE_TAGS>" \
     -F "new_voice_file=@<FILE_PATH>.wav;type=audio/wav"

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://eu-west-1.api.neuphonic.com/voices/<VOICE_ID>" \
     -H "X-API-KEY: <API_KEY>"