Synthesize コンソールを使用する
クローニングされた音声モデルをアプリケーションに統合して、TTS 音声合成を行うことができます。Speech Studio で適切な VoiceCloningKey を指定して、クローニングされたカスタム音声を使用してテキストを生成します。
コマンドラインと Rest API を使用する
HTTP メソッドと URL:
POST https://texttospeech.googleapis.com/v1beta1/text:synthesize
リクエストの本文(JSON):
voice_cloning_key
は、クローニングされたモデルの作成時に生成された VoiceCloningKey に置き換えます。
{
"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
}
}
リクエスト本文を request.json
という名前のファイルに保存して、次のコマンドを実行します。PROJECT_ID
は実際のプロジェクト 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