Skip to content

Instantly share code, notes, and snippets.

@Sloy
Last active January 13, 2025 13:06
Show Gist options
  • Save Sloy/66c9e709aa360a656e134d43ad801809 to your computer and use it in GitHub Desktop.
Save Sloy/66c9e709aa360a656e134d43ad801809 to your computer and use it in GitHub Desktop.
Google Text-to-Speach testing on command line.
{
"input": {
"text": "Buenos días. He apagado las luces del dormitorio. Voy a ponerte algo de música para comenzar el día."
},
"voice": {
"languageCode": "es-es",
"name": "es-ES-Journey-O",
"ssmlGender": "FEMALE"
},
"audioConfig": {
"audioEncoding": "MP3"
}
}
curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "x-goog-user-project: PROJECT" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://texttospeech.googleapis.com/v1/text:synthesize" > response.json && jq ".audioContent" -r response.json | base64 -d > $(jq '.voice.name' -r request.json).mp3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment