Skip to content

Instantly share code, notes, and snippets.

@mikerr
Created August 5, 2013 14:53
Show Gist options
  • Save mikerr/6156516 to your computer and use it in GitHub Desktop.
Save mikerr/6156516 to your computer and use it in GitHub Desktop.
Record 3 seconds of audio from mic, and transcribe it using googles api
#!/bin/bash
arecord -D "plughw:1,0" -q -d 3 -f cd -t wav | ffmpeg -loglevel panic -y -i - -ar 16000 -acodec flac file.flac > /dev/null 2>&1
wget -q -U "Mozilla/6.0" --post-file file.flac --header "Content-Type: audio/x-flac; rate=16000" -O - "http://www.google.com/speech-api/v1/recognize?lang=en-us&client=chromium" | cut -d\" -f12
rm file.flac > /dev/null 2>&1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment