Skip to content

Instantly share code, notes, and snippets.

@d2rk
Created February 23, 2014 12:16
Show Gist options
  • Save d2rk/9170643 to your computer and use it in GitHub Desktop.
Save d2rk/9170643 to your computer and use it in GitHub Desktop.
Speech recognition with Raspberry Pi and Google Speech API
#!/bin/bash
echo "Recording, press ctrl+c to stop..."
arecord -D "plughw:1,0" -q -f cd -t wav | ffmpeg -loglevel panic -y -i - -ar 16000 -acodec flac speech.flac > /dev/null 2>&1
echo "Processing..."
wget -q -U "Mozilla/5.0" --post-file speech.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 > speech.txt
echo -n "You said: "
cat speech.txt
rm speech.flac
@jfabdo
Copy link

jfabdo commented Apr 27, 2017

This is returning a 404 error for http://www.google.com/speech-api/. Has that URL been deprecated?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment