Skip to content

Instantly share code, notes, and snippets.

Created June 30, 2012 13:16
Show Gist options
  • Save anonymous/3023698 to your computer and use it in GitHub Desktop.
Save anonymous/3023698 to your computer and use it in GitHub Desktop.
Google Speech to Text script
arecord -D plughw:1,0 -f cd -t wav -d 3 -r 16000 | flac - -f --best --sample-rate 16000 -o out.flac; wget -O - -o /dev/null --post-file out.flac --header="Content-Type: audio/x-flac; rate=16000" http://www.google.com/speech-api/v1/recognize?lang=en | sed -e 's/[{}]/''/g'| awk -v k="text" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]; exit }' | awk -F: 'NR==3 { print $3; exit }'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment