Request structure

We are going to make a request as follows:

Field Value
HTTP method POST
URL https://speech.googleapis.com/v1/speech:recognize?key=API_KEY
Request body
// SNIPP SNIPP{ "config": { "encoding": "LINEAR16", "sampleRateHertz": 44100, "languageCode": "en-us" }, "audio": { "content": "-- BASE64 AUDIO CONTTENT --" }}// SNIPP SNIPP

Note that the content property under the audio property is the base64 encoded version of the audio. In the same Audio folder, you should find a file named arvind_sample_recording_base64.txt. This is the base64 version of the same audio. You can use an online service such as https://www.browserling.com/tools/image-to-base64 or https://www.base64-image.de/ for converting your own audio to a ...

Get Google Cloud AI Services Quick Start Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.