Control your Kirkwood device with your voice July 01, 2012 09:04AM |
Registered: 12 years ago Posts: 61 |
# cat /proc/asound/cards 0 [AUDIO ]: USB-Audio - USB AUDIO USB AUDIO at usb-orion-ehci.0-1.3.2, full speed # cat /proc/asound/devices 1: : sequencer 2: [ 0- 0]: digital audio playback 3: [ 0- 0]: digital audio capture 4: [ 0] : control 33: : timer
#!/bin/bash arecord -D plughw:0,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; exit }' | awk -F: 'NR==3 { print $3; exit }'
eval `speech2text.sh`