Voice Clone
POST https://api.newportai.com/api/async/voice_clone
Voice Clone API could clone the voice of a target speaker and generate the target speaker's voice with the given text. It is being used with Do TTS Clone API.
- Use Voice Clone API to get taskId with POST method
- Use Polling API to get the result with POST method
Request Headers
- Content-TypestringRequiredEnumapplication/json
- AuthorizationstringRequiredBearer authentication format, for example: Bearer
Request Body
- voiceUrlstringRequiredThe URL of the voice file to be cloned.
Response
- codeinteger0 success, or error code.
- messagestring"success", or error msg.
- dataobjecttaskIdstringUse the taskId to request the Polling API to retrieve the generated outputs.
Example
First, create a task with voiceUrl and get a taskId.
Request:
zsh
curl -X POST 'https://api.newportai.com/api/async/voice_clone' \
-H "Authorization: Bearer {{key}}" \
-H 'Content-Type: application/json' \
-d '{
"voiceUrl":"https://newportai-api-market.s3.amazonaws.com/demo_voice/demo_vocie.wav"
}'
Response:
json
{
"code": 0,
"message": "success",
"data": {
"taskId": "644f-ae88-4cf2-af01-55349d31b6"
}
}
Next Step:
Use Polling API to get the result.
Request:
zsh
curl -X POST 'https://api.newportai.com/api/getAsyncResult' \
-H "Authorization: Bearer {{key}}" \
-H 'Content-Type: application/json' \
-d '{
"taskId":"644f-ae88-4cf2-af01-55349d31b6"
}'
Response:
json
{
"code": 0,
"message": "success",
"data": {
"task": {
"taskId": "644f-ae88-4cf2-af01-55349d31b6",
"status": 3,
"taskType": "voice_clone"
},
"cloneId": "40dc8e22ab179680ec5480f9fb32d1ec"
}
}