Setting Up and Using PocketSphinx on Ubuntu

First, you should make sure that you have Python, Subversion, GCC, make, libtool, pkg-config, and bison installed.

cd to wherever you want to put the installation files for Pocketsphinx, e.g. /home/ecooper/Installs/. Then run the following:

svn checkout
cd pocketsphinx-0.6/sphinxbase
make check
sudo make install
cd ../pocketsphinx
make check
sudo make install

You will also need the default WSJ acoustic and language models - we have those on the lab machines, and you can copy those directly (nothing needs to be compiled):

sudo scp -r /usr/local/share/pocketsphinx/model/hmm/
sudo scp -r /usr/local/share/pocketsphinx/model/lm/

To use PocketSphinx and run the Project Part 2 files, you will need to add some things to your path. Add the following to your .bashrc:

export LD_LIBRARY_PATH=/usr/local/lib/:$LD_LIBRARY_PATH
export PS_BASE=/usr/local

and run source ~/.bashrc to apply the changes.

We have set up some PocketSphinx examples on the lab machines; you can make sure that your install is working by copying them to your own computer; the examples can be found in /proj/speech/tools/pocketsphinx/example/ on any lab machine.

To run the Python example and check that your installation works, run

You should see a bunch of output from PocketSphinx, followed by
ASR Result: ('GO FORWARD EIGHT METERS', '000000000', -40584706)

To run the C example, first you need to compile it:
gcc -o example example.c -DMODELDIR=\"`pkg-config --variable=modeldir pocketsphinx`\" `pkg-config --cflags --libs pocketsphinx sphinxbase`

And then you can run it:

As with the Python example, you should see a bunch of output from PocketSphinx, followed by:
Recognized: do four eight eight meters

Note: If you get an error that sphinx_config.h is missing, this is a bug in PocketSphinx. You can copy the file from your install directory, e.g.
sudo cp /home/ecooper/Installs/pocketsphinx-0.6/sphinxbase/include/sphinx_config.h /usr/local/include/sphinxbase/

Project Part 2:

If you want to use your own install of PocketSphinx to do Project Part 2, you will need to copy the additional acoustic models from lab to your own computer:

sudo scp -r $PS_BASE/share/pocketsphinx/model/hmm/
sudo scp -r $PS_BASE/share/pocketsphinx/model/hmm/

You will also need to copy the recognition script from lab to whichever directory on your own computer you are using for the assignment. The recognition script lives in

Please note that while these instructions are provided for your convenience for working on the project at home, you are still responsible for making sure that your scripts run on the Speech Lab machines by the submission deadline.