- Create a file with json request, for example:
$ cat > TTS.json <<END
{
"audioConfig": {
"audioEncoding": "LINEAR16",
"pitch": 0,
"speakingRate": 1
},
"input": {
"text": "Google!"
},
"voice": {
"languageCode": "de-DE"
}
}
END
for more ideas on request parameters, see demo at https://cloud.google.com/text-to-speech (you can view the json params).
-
Grab an API token at https://console.cloud.google.com/apis/credentials
-
Run a curl request:
curl https://texttospeech.googleapis.com/v1/text:synthesize?key=..your..token.. -H 'Content-Type: application/json' -X POST --data @TTS.json