Close

PocketSphinx setup on RasPi

A project log for Voice Recognition Touch-Tone Phone

An inexpensive, reasonable 'at home' solution for the visually compromised.

anthonyAnthony 06/13/2015 at 22:230 Comments

A good, general set of instructions on how to download/install PocketSphinx can be found on the Carnegie Mellon wiki for this project.

However some steps have already been covered here with regards to the setup of the Sabrent sound card and others, if not familiar with Linux are not completely explicit, so I will summarize here the process picking from the previous log post:

Install the CMUSphinx required 'Bison' and 'Libasound2-dev' libraries via the following:

   sudo apt-get install bison
   sudo apt-get install libasound2-dev

Download latest SphinxBase, links here.

As of the time of writing the most recent version can also be downloaded from the console via:

wget http://http://downloads.sourceforge.net/project/cmusphinx/sphinxbase/5prealpha/sphinxbase-5prealpha.tar.gz
Un-tar (i.e. extract the archive by):
tar -xzvf sphinxbase-5prealpha.tar.gz
Then:
cd sphinxbase-5prealpha
For my particular (clean) install of Raspbian I found the additional dev packages were required to properly make/compile. The important thing is after the make/compile process you don't see any error messages. If so, usually a short Google search will show what packages should be installed.
sudo apt-get install python-dev

Then, again, assuming no errors between steps, configure, make, install/compile:

   ./configure --enable-fixed
   make
   sudo make install

Now to install PocketSphinx:

cd
wget http://http://downloads.sourceforge.net/project/cmusphinx/pocketsphinx/5prealpha/pocketsphinx-5prealpha.tar.gz

Un-tar (i.e. extract the archive by):

tar -xzvf pocketsphinx-5prealpha.tar.gz

Then:

cd pocketsphinx-5prealpha

Again, for me at least on raw Raspbian I had to ensure to install the 'swig' library before proceeding:

sudo apt-get install swig
Then configure, make, build:
./configure
make
sudo make install
Note: The make step here might take awhile-- 10~15 minutes of building right on the Pi.

Alright, almost there, just one last thing in adding in our required paths:

 export LD_LIBRARY_PATH=/usr/local/lib 
 export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

Now test to ensure everything was installed okay by running:

pocketsphinx_continuous  -samprate 16000 -inmic yes
Once the 'Listening' prompt appears on screen you should see an output of recognized words spoken into the microphone.

Discussions