Update: Now Google ASR needs a key!
Steps for generating Google Speech API key (Thanks to my colleague Chirag Patel)
Assumed that you have a Google account (if you have a Gmail account – you can safely assume that you have a Google account! else create one.)
Make sure you are a member of chromium-dev-discussion list by joining the Google group https://groups.google.com/a/chromium.org/forum/?fromgroups#!forum/chromium-dev using your Google credentials. (This is required to generate the Speech API key!)
Go to Google developer console https://console.developers.google.com/ (logged in with your credentials)
- Create a Project (say “myfirstspeechasr“) and click on the project
- Click on the “Manage and Enable API” button
- Search for word “speech” (in the search box!)
- Click on “Speech API” and then click “Enable API“
- Then click on “Credentials” to generate the API Key.
- You will see a message “Here is your API key: AIXXXyXXXvdk3TbXXXX7MsXXXUBv-LYjXXXXrOk”
- The string AIXXXyXXXvdk3TbXXXX7MsXXXUBv-LYjXXXXrOk is the key (Note: this is a fictitious key but the format should be more or less like this)
Now, replace the wget (line 6 in the old post as)
wget -q -U “Mozilla/5.0″ –no-proxy –post-file $1.flac –header=”Content-Type: audio/x-flac; rate=16000” -O – “http://www.google.com/speech-api/v1/recognize?lang=${LANGUAGE}&key=”AIXXXyXXXvdk3TbXXXX7MsXXXUBv-LYjXXXXrOk”&client=chromium” > $1.ret
Namely,
1 #!/bin/sh
2 LANGUAGE=”en-in”
3 echo “1 SoX Sound Exchange – Convert $1.wav to $1.flacC with 16000”
4 sox $1.wav $1.flac rate 16k
5 echo “2 Submit to Google Voice Recognition $1.flac”
6 wget -q -U “Mozilla/5.0″ –no-proxy –post-file $1.flac –header=”Content-Type: audio/x-flac; rate=16000” -O – “http://www.google.com/speech-api/v1/recognize?lang=${LANGUAGE}&key=”AIXXXyXXXvdk3TbXXXX7MsXXXUBv-LYjXXXXrOk&client=chromium” > $1.ret
7 echo “3 SED Extract recognized text”
8 cat $1.ret | sed ‘s/.*utterance”:”//’ | sed ‘s/”,”confidence.*//’ > $1.txt
9 echo “4 Remove Temporary Files”
10 rm $1.flac
11 rm $1.ret
12 echo “5 Show Text ”
13 cat $1.txt
Hope this helps.
I realized (after updating this post!) that there is a nice(r) post at https://aminesehili.wordpress.com/2015/02/08/on-the-use-of-googles-speech-recognition-api-version-2/ may be you should look this up 🙂
==Does not Work: No Key Based use of Google Speech API===
This is the shell script that uses Google ASR to recognize a speech utterance in Indian English (see YourTube Demo).
1 #!/bin/sh
2 LANGUAGE=”en-in”
3 echo “1 SoX Sound Exchange – Convert $1.wav to $1.flacC with 16000”
4 sox $1.wav $1.flac rate 16k
5 echo “2 Submit to Google Voice Recognition $1.flac”
6 wget -q -U “Mozilla/5.0″ –no-proxy –post-file $1.flac –header=”Content-Type: audio/x-flac; rate=16000” -O – “http://www.google.com/speech-api/v1/recognize?lang=${LANGUAGE}&client=chromium” > $1.ret
7 echo “3 SED Extract recognized text”
8 cat $1.ret | sed ‘s/.*utterance”:”//’ | sed ‘s/”,”confidence.*//’ > $1.txt
9 #echo “4 Remove Temporary Files”
10 #rm $1.flac
11 #rm $1.ret
12 echo “5 Show Text ”
13 cat $1.txt
wowzers
Hi, is this still current? Also, is -O correct or should it be -D ?