Setting Up and Using PocketSphinx on CygWin

First, make sure that you have Cygwin with the following packages installed: Open the Cygwin terminal, and then cd to the directory where you want to put the installation files, e.g. /home/ecooper/Installs/. Then run the following:

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

Note: If you get an error that looks like this after the 'make' command in the pocketsphinx directory:

error: command 'gcc' failed with exit status 1
Makefile:501: recipe for target `pymod-build-stamp' failed
make[1]: *** [pymod-build-stamp] Error 1
make[1]: Leaving directory `/home/username/Installs/pocketsphinx-0.6/pocketsphinx/python'
Makefile:360: recipe for target `all-recursive' failed
make: *** [all-recursive] Error 1

Make the following change: in python/, find the line that says:
libraries=['pocketsphinx', 'sphinxbase'],

and add iconv to it so that it says:
libraries=['pocketsphinx', 'sphinxbase', 'iconv'],

and run make again from the pocketsphinx directory.

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):

scp -r /usr/local/share/pocketsphinx/model/hmm/
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
cp sphinxbase/include/sphinx_config.h /usr/local/include/sphinxbase/

To use PocketSphinx, you will need to add it 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.

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

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

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 -liconv

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:

scp -r $PS_BASE/share/pocketsphinx/model/hmm/
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.