You can find my simple voice recognition application here:
You will need Python 3.3+ installed, with following packages:
speech_recognition
pyglet
gtts (if you would like to use Google Text-to-speech)
pyvona (if you would like use Ivona Text-to-speech)
apiai (if you would like to use api.ai general knowledge and other domains queries)
VoiceHAB.ini is pretty self-explanatory, but I will make some kind of user manual as soon as I find some free time. To use VoiceHAB, just start __main__.py
After initialization, you can say wake-up phrase to have it listen for your commands. If you say a sentence that starts with ātell meā (this could be changed in VoiceHAB.ini - GeneralKnowledgeTriggerPhrase) it will redirect query to api.ai, otherwise, it will send recognized text to OpenHAB item listed in VoiceHAB.ini. You will need to register and obtain keys for api.ai and Ivona if you intend to use them (they are free for a limited personal usage). I intend to add some other Speech-to-text engines (wit.ai, bing, api.ai), and I will try to add voice verification too, but it will take some time. I know this isnāt explained very well, so, if you have any questions, feel free to post it here - Iāll try to answer them as soon as I can.
A suggestion would be to put what you wrote in your post here into a readme,md file in the repo as people might stumble across it without visiting this forum
Honestly, I havenāt been updating it since July, because my OH server crashed and I was concentrated on restoring everything. Regardless, Iām planning to get back to it, because Iāll need it soon too. If I recall correctly, itās in the working state, just missing some advanced functions I had planned (i.e. voice authorization). If you have any questions, or you encountered a problem, feel free to ask.
Thatās good news!
Iām planning on making an Amazon Echo style listening device using a Raspberry Pi3 and VoiceHAB.
Already cloned the repository and going through the code
Iām willing to help with that even if Iām not skilled at all with Python.
In the current state itās not working out-of-the-box on my Pi, but Iāll dig more.
Iāll post my findings/issues on github.
I havenāt used it for a while, so, maybe I started something and havenāt finished. If you find some specific errors, you can post it, either here, or on github. Iām glad thereās someone to test it, besides me.
Hi Davor,
I tried to run your application on a Raspberry Piā¦
After struggling with PyAudio and portaudio I finally got it up and running.
Sadly Iām now stuck at the point that AVbin is required to decompress audioā¦
Since there does not seem to be AVbin for ARM architecture I wonāt make any progress with my Raspberry.
Would you mind changing the way to decompress the audio?
Another user reported the same problem, so Iāve implemented an option to choose between pygame and pyglet as sound processing package. Patch was implemented last night, so, youāll probably need to clone git repo again.
Thanks for that I missed missed out on that discussion on github.
Now Iām getting some ALSA lib error messages concering conf.c (evaluate error: no such file or directory), confmisc.c (unable to find definittion ācards.bcm28ā¦ā) and pcm.c (unknown pcm cards) .
Any help is again highly appreciated.
Thanks in advance,
loc
I managed to plug in a speaker and am getting the following messages:
ājust a moment pleaseā
"Iām listening"
whenever I use the keyword I get:
āgoogle speech recognition denied request for resultā
python3 __main__.py
gives me
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.front.0:CARD=0' ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM front ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.surround51.0:CARD=0' ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM surround21 ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.surround51.0:CARD=0' ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM surround21 ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.surround40.0:CARD=0' ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM surround40 ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.surround51.0:CARD=0' ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM surround41 ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.surround51.0:CARD=0' ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM surround50 ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.surround51.0:CARD=0' ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM surround51 ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.surround71.0:CARD=0' ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM surround71 ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2' ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM iec958 ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2' ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM spdif ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2' ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM spdif ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline ALSA lib pcm_dmix.c:1022:(snd_pcm_dmix_open) unable to open slave
@loc
Iām using @davorf 's VoiceHAB with a RPi3 and a USB soundcard.
How is your setup? The microphone is surely connected to such a USB soundcard, right? But what about the speakers? They are connected to the same USB soundcard or directly to the audio output of the pi?
I have both of them connected to the USB soundcard and the sound card set as default.
Are you able to record something though the microphone? Try to record using arecord (search Google for syntax).
I also have some warnings from Alsa regarding missing PCMs, but you can ignore them.
Whenever I record for testing arecord -D plughw:1,0 -r 4800 test.wav I can hear my voice very quite and I have some crackling in the recorded file.
I already changed the USB speed to 1 dwc_otg.speed=1 within the /boot/cmdline.txt
I configured the āUSB PnP Sound Deviceā in alsamixer and changed the capture level to 94 - but the crackled records remain.
Since I donāt have an RPi, or any Linux maching at home at the moment (my setup uses Windows 7), there is not much I can do regarding your problem. I would check if your default sound output device is properly installed and configured in ALSA. It doesnāt look like input (microphone), but rather output (speakers) problem.