Use the Synthesize console
You can integrate a cloned voice model into your application for TTS audio synthesis. Provide the appropriate VoiceCloningKey in Speech Studio to generate text using your custom cloned voice.
Using the command line and Rest API
HTTP method and URL:
POST https://texttospeech.googleapis.com/v1beta1/text:synthesize
Request JSON body:
Replace voice_cloning_key
with the VoiceCloningKey generated when creating a cloned model.
{
"input":{
"text":"Android is a mobile operating system developed by Google, based on the Linux kernel and designed primarily for touchscreen mobile devices such as smartphones and tablets."
},
"voice":{
"language_code":"en-US",
"voice_clone":{
"voice_cloning_key":"{voice_cloning_key}",
}
},
"audioConfig":{
"audioEncoding":"LINEAR16",
"sample_rate_hertz":24000
}
}
Save the request body in a file called request.json
and execute the following
command, replacing PROJECT_ID
with your project ID:
curl -X POST \ -H "Authorization: Bearer "$(gcloud auth print-access-token) \ -H "x-goog-user-project: PROJECT_ID" \ -H "Content-Type: application/json; charset=utf-8" \ -d @request.json \ https://texttospeech.googleapis.com/v1beta1/text:synthesize