Welcome! Log In Create A New Profile

Advanced

Control your Kirkwood device with your voice

Posted by ax206geek 
Control your Kirkwood device with your voice
July 01, 2012 09:04AM
A cheap USB audio adapter from dealextreme/ebay:
# 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

The speech to text script
#!/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 }'

Finally to execute the command
eval `speech2text.sh`

Test with simple commands like hostname, date
Author:

Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: