How to setup: https://cloud.google.com/text-to-speech/docs/create-audio-text-command-line?hl=es-419
List of voices: https://cloud.google.com/text-to-speech/docs/voices?hl=es-419
{ | |
"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 |