Setting Up and Using PocketSphinx on Mac OS X

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

Open a terminal, and cd to wherever you want to put the installation files for Pocketsphinx, e.g. /Users/yourusername/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/

There is a bug in the PocketSphinx installation where it does not copy one of the files it's supposed to, so you will also need to do the following:

cd to your pocketsphinx-0.6 directory
sudo cp sphinxbase/include/sphinx_config.h /usr/local/include/sphinxbase/

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 DYLD_LIBRARY_PATH=/usr/local/lib/:$LD_LIBRARY_PATH
export PS_BASE=/usr/local

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

PocketSphinx by default installs the Python module to a location that is non-standard for Mac. The simplest way to be able to use it is to move it to the standard location:

sudo mv /usr/local/lib/python2.6/site-packages/* /usr/lib/python2.6/

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=\"/usr/local/share/pocketsphinx/model\" -I/usr/local/include/sphinxbase -I/usr/local/include/pocketsphinx -L/usr/local/lib -lpocketsphinx -lsphinxbase -lsphinxad

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

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.