Raspberry Pi + Pocketsphinx + Dimmer = Voice Dimmer

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.

dimmer

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:
[installation-folder]/pocketsphinx-0.8/src/programs
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

Advertisement
This entry was posted in Electronics, Raspberry Pi and tagged , , , . Bookmark the permalink.

5 Responses to Raspberry Pi + Pocketsphinx + Dimmer = Voice Dimmer

  1. cfaniak says:

    Nice! :D

  2. Shivaraj says:

    When I’m running this I’m getting undefined reference to ps_args.c etc. and the program si exiting. Can you please help.

  3. adrdubiel says:

    I didn’t have this problem.. Have you read carefully this article – http://cmusphinx.sourceforge.net/wiki/tutorialpocketsphinx ? Compilation works if you got all the necessery paths for libraries loaded

  4. Ravi says:

    Hi,

    Could you please provide the circuit diagram for light dimmer?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s