Base URL: https://www.google.com/speech-api/v1/recognize
It accepts POST
requests with voice file encoded in FLAC format, and query parameters for control.
client
The client's name you're connecting from. For spoofing purposes, let's use chromium
lang
Speech language, for example, ar-QA
for Qatari Arabic, or en-US
for U.S. English
maxresults
Maximum results to return for utterance
body
Should contain FLAC formatted voice binary
Content-Type
Should be audio/x-flac; rate=16000;
, where MIME and sample rate of the FLAC file is included
User-Agent
Can be the client's user agent string, for spoofing purposes, we'll use Chrome's
These examples assume you have a voice file encoded in FLAC called alsalam-alikum.flac
.
This will save JSON response in a file called recognized.json
wget --post-file='alsalam-alikum.flac' \
--user-agent='Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.77 Safari/535.7' \
--header='Content-Type: audio/x-flac; rate=16000;' \
-O 'recognized.json' \
'https://www.google.com/speech-api/v1/recognize?client=chromium&lang=ar-QA&maxresults=10'
curl -X POST \
--data-binary @alsalam-alikum.flac \
--user-agent 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.77 Safari/535.7' \
--header 'Content-Type: audio/x-flac; rate=16000;' \
'https://www.google.com/speech-api/v1/recognize?client=chromium&lang=ar-QA&maxresults=10'
@LRNAB
The key for google api you can get in the google APIs console for free.
But the question is how to increase the max limit of 50 requests 'a day?
I found no way to get more, and the link to order quote is dead.
The Google corp. forces me and other developers to find any other way to solve this problem.
I see the solution in java script for Chrome browser. But if anybody need this API i.e. for C# then he must to switch the source of sound from microphone to the file stream in flac format.
My question is now - how to change the source of sound from microphone into binary file on disk?