Skip to content

Instantly share code, notes, and snippets.

@chck
Created August 19, 2020 00:15
Show Gist options
  • Save chck/e58e920b8eeb5e7106479ab5998420f7 to your computer and use it in GitHub Desktop.
Save chck/e58e920b8eeb5e7106479ab5998420f7 to your computer and use it in GitHub Desktop.
mkdir -p voices
curl -X POST https://texttospeech.googleapis.com/v1/text:synthesize \
-H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \
-H "Content-Type: application/json; charset=utf-8" \
-d @- << EOF | jq ".audioContent" | sed -e 's/^"//' -e 's/"$//' > /tmp/synthesize-output-base64.txt
{
"input":{
"text":"以上になります、ご清聴ありがとうございました。何でもお気軽にご質問ください"
},
"voice":{
"languageCode":"ja-JP",
"name":"ja-JP-Standard-C",
"ssmlGender":"MALE"
},
"audioConfig":{
"audioEncoding":"MP3"
}
}
EOF
base64 /tmp/synthesize-output-base64.txt --decode > voices/synthesized-audio.mp3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment