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 base64 string.

Neither Packt Publishing nor the author are endorsing the previous links. Please use them at your own risk.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.217.254.118