In the last couple of days I was playing with voice recognition on Raspberry Pi. I have tried a library called Pocketsphinx written in C: http://www.cmusphinx.sourceforge.net
With a medium knowledge of C language it can be easily adopted to custom application. In my case I created an application which controls a lamp. Some time ago I built a light dimmer based on Atmel’s AVR Atmega32U2 microcontroller working also as a USB CDC, so it can be connected to Pi as a serial device. As you can see on a scheme below, it is a simple dimmer which allows to control 3 bulps separately.
As a microphone I used webcam (Logitech 9000 Pro).
Here is a nice tutorial I followed: http://www.rmnd.net/speech-recognition-on-raspberry-pi-with-sphinx-racket-and-arduino
This also might be helpful: http://cmusphinx.sourceforge.net/wiki/tutorialpocketsphinx
As it is written in the tutorial after installation you can run sample recognition with: ‘./pocketsphinx_continuous’.
Without any params it will be run with 16000Hz samplerate, if you want higher rate you have to increase ‘nfft’ param properly. To disable logs you can redirect output to /dev/null with ‘logfn’ param. So 48kHz without logs will be:
./pocketsphinx_continuous -nfft 2048 -samprate 48000 -logfn /dev/null
If you want to create your own C/C++ application using Pocketsphinx a good way to start is to use code from continous.c file that can be found under:
To compile it with gcc or g++ you have to put necessary libraries and includes as it is showed below:
gcc continuous.c -I/usr/local/include -I/usr/local/include/sphinxbase -I/usr/local/include/pocketsphinx -L/usr/local/lib -lpocketsphinx -lsphinxbase -lsphinxad