Skip to content

Instantly share code, notes, and snippets.

@scottcagno
Created June 17, 2013 22:49
Show Gist options
  • Save scottcagno/5801211 to your computer and use it in GitHub Desktop.
Save scottcagno/5801211 to your computer and use it in GitHub Desktop.
Simple Google Speech Recognition API Hook. ----- requires ------- sudo apt-get install sox, curl
#!/bin/bash
sox -q -r 16000 -b 16 -c 1 -d a.flac silence 1 0.3 1% 1 0.5 1% 2>/dev/null
curl -s --data-binary @a.flac --header 'Content-Type: audio/x-flac; rate=16000' 'https://www.google.com/speech-api/v1/recognize?client=chromium&lang="en-us"' | cut -d"," -f3 | sed 's/^.*utterance\":\"\(.*\)\"$/\1/g'
rm a.flac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment