Skip to content

Instantly share code, notes, and snippets.

@iAnatoly
Created May 13, 2022 16:19
Show Gist options
  • Save iAnatoly/6dca09d8f6d846d109ec3c60a04a8aaa to your computer and use it in GitHub Desktop.
Save iAnatoly/6dca09d8f6d846d109ec3c60a04a8aaa to your computer and use it in GitHub Desktop.
  1. 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).

  1. Grab an API token at https://console.cloud.google.com/apis/credentials

  2. 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment