Voice Recognition from Steven Hickson

This is an article that covers some corrections or adjustment fromĀ Raspberry Pi Voice Control by Steven Hickson.

At first, I would like to highlight and mentioned Well done to Steven. H. this is really fun! šŸ™‚

As I have looking attempting to use/test and of play with this on a Raspberry Pi 2; Due to the several corrections made I wanted to compile the list of correction to make it work.

sudo apt-get install git-core
git cloneĀ https://github.com/StevenHickson/PiAUISuite.git
cdĀ PiAUISuite/Install/ ./InstallAUISuite.sh
Follow the steps to install it @ first.
1/
Then, as if needed you might require to review/change your Hardware Card ID from the scripts.
As expected you might use an USB Microphone or maybe even a Microphone from a spare Webcam.
Once plugged in, check if this one is well recognized:
lsusb
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. 
Bus 001 Device 004: ID 046d:0a18 Logitech, Inc.
Bus 001 Device 005: ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter
In my case, this is a logitec one. as in bold above.
So, my USB Logitec is indeed well present and seen by my Raspberry pi.
One script which is the speech-recog.sh; This one would required the Microphone HW ID.
This one use the arecord command; Part of it you also assign/set the HW ID.
To figure which id is needed; Run this command:
arecord -l
The following would appear:
**** List of CAPTURE Hardware Devices **** card 1: Headset [Logitech H360 Headset], device 0: USB Audio [USB Audio] Subdevices: 1/1 Subdevice #0: subdevice #0
Now, we would change if not recorrectly set the Plughw value:
vi /usr/bin/speech-recog.sh
#!/bin/bash
hardware="plughw:1,0"
1=Card 1
0=Device 0
Additionally, and the same way to do for the .command.conf for the voicecommand.
Edit the .command.conf and verify the HW ID, using this time this command:
aplay -l
Example:
**** List of PLAYBACK Hardware Devices **** card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA] Subdevices: 8/8 Subdevice #0: subdevice #0 Subdevice #1: subdevice #1 Subdevice #2: subdevice #2 Subdevice #3: subdevice #3 Subdevice #4: subdevice #4 Subdevice #5: subdevice #5 Subdevice #6: subdevice #6 Subdevice #7: subdevice #7 card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 ALSA [bcm2835 IEC958/HDMI] Subdevices: 1/1 Subdevice #0: subdevice #0 card 1: Headset [Logitech H360 Headset], device 0: USB Audio [USB Audio] Subdevices: 1/1 Subdevice #0: subdevice #0
Ā Edit the configuration file. (ie: located to /root/.command.conf)
Same type of line as for the speech-recog.sh
!hardware==plughw:1,0
I will change it to 0,0 instead of 1,0
For the speech also, an additional change is needed; Especially as if you do not hear anything coming out from your speakers.
the file is called tts located to /usr/bin/tts
vi /usr/bin/tts
...
#get the first 100 characters wget -q -U Mozilla -O "/dev/shm/tmp.mp3" "https://translate.google.com/translate_tts?tl=${lang}&q=$tmp&ie=UTF-8&total=1&idx=0&client=t"
...
Change the end of two linesĀ from &client-t with &client-tw-b :
Two lines would appears like this:
#get the first 100 characters wget -q -U Mozilla -O "/dev/shm/tmp.mp3" "https://translate.google.com/translate_tts?tl=${lang}&q=$tmp&ie=UTF-8&total=1&idx=0&client=tw-b"
#this will get the last remnants wget -q -U Mozilla -O "/dev/shm/tmp.mp3" "https://translate.google.com/translate_tts?tl=${lang}&q=$string&ie=UTF-8&total=1&idx=0&client=tw-ob"
With it, you should be well done and ready to go.
Enjoy; Please feel free to let comments or/and workaround as if you come accross issues with it; I would update it as needed.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

*

Menu