Last active
February 17, 2016 02:35
-
-
Save mpenkov/6589233 to your computer and use it in GitHub Desktop.
Automatic Speech Recognition with Google ASR
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Adapted from: http://sunilkumarkopparapu.wordpress.com/2012/09/11/using-google-asr/ | |
# | |
LANGUAGE="en-US" | |
echo "1 SoX Sound Exchange -- Convert $1.wav to $1.flacC with 16000" | |
sox $1.wav $1.flac rate 16k | |
echo "2 Submit to Google Voice Recognition $1.flac" | |
wget -q -U "Mozilla/5.0" --no-proxy --post-file $1.flac --header="Content-Type: audio/x-flac; rate=16000" -O $1.ret "http://www.google.com/speech-api/v1/recognize?lang=${LANGUAGE}&client=chromium" | |
echo "3 SED Extract recognized text" | |
cat $1.ret | sed 's/.*utterance":"//' | sed 's/","confidence.*//' > $1.txt | |
echo "4 Remove Temporary Files" | |
#rm $1.flac | |
#rm $1.ret | |
echo "5 Show Text " | |
cat $1.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
I try your above sheet by typing "./google_asr.sh speech" in the terminal. However, I don't know why it is stuck at Step 2 for a long time when submitting the flac file to google Voice Recognition. After a while, the sheet passes through Step 5, but no word shows and the generated txt is blank. I have checked that the generated speech.flac file is fine.
Is there any extra configuration on the network? Thanks!
$ ./google_asr.sh speech
1 SoX Sound Exchange -- Convert speech.wav to speech.flacC with 16000
2 Submit to Google Voice Recognition speech.flac
3 SED Extract recognized text
4 Remove Temporary Files
5 Show Text