Sphinx, just like Julius, is an open source speech recognition tool, relying mainly on Hidden Markov Models (HMM). It's not about voice recognition, which is sometimes used interchangeably but means speaker recognition, while speech recognition is about transscribing ("understanding") a spoken text.
Get CMU Sphinx from its website: You'll need sphinxbase, and we'll run pocketsphinx on top of it:
Further, you'll need an Acoustic and a Language Model. We'll use a German Voxforge bundle of those here:Voxforge Repository download:
Download all of this into one directory, then untar the stuff:
tar xvf sphinxbase-0.8.tar.gz
tar xvf pocketsphinx-0.8.tar.gz
tar xvf Lexicon.tgz
tar xvf Sphinx_AcousticModel.tgz
Next we'll compile sphinx from source. For that to work, we'll need to install some -dev packages.
sudo apt-get install libpulse-dev
This is important! The sphinxbase configure script will detect your audio environment and compile this into sphinxbase. On Ubuntu Pulseaudio is the default, and believe me, the fallback, sphinx ALSA support, is hard to get working. The FAQ strongly encourages us to stick with Pulseaudio. If you compile audio in the wrong way, you'll get all sorts of errors, for example "Failed to open audio device(/dev/dsp): No such file or directory".
And try to use Sphinx on a machine with just one microphone, like a laptop. Telling Sphinx to use another mic than the "default" one is a nightmare as well, like, searching for a webcam mic in arecord -L, passing that in as -adcdev etc.
Then, change into sphinxbase's directory:
sudo make install
next up is pocketsphinx:
sudo make install
Doing a type pocketsphinx_continuous will tell you that the binaries were installed into /usr/local, just as a note. Make sure you have no remains of another sphinx on your system from a synaptic/apt-get install or so.
Then try running pocketsphinx:
If you get this error:
pocketsphinx_continuous: error while loading shared libraries: libpocketsphinx.so.1: cannot open shared object file: No such file or directory
the solution is to run sphinx with an additional lib path prefixed:
That should work. If you watch the debug output closely now, you'll notice that sphinx uses some default English models. To use our set of German Acoustic Model, Language Model and Lexicon files, we'll define the -hmm and -dict switches like so:
LD_LIBRARY_PATH=/usr/local/lib /usr/local/bin/pocketsphinx_continuous -hmm Sphinx/model_parameters/voxforge_de_sphinx.cd_cont_3000/ -dict Lexicon
Your paths might vary. Anyway, Sphinx should start-up and idle or toggle between READY. and Listening... .
Sphinx is listening!
I ran into problems with mic levels (fiddling around but still not getting it right) and noise from the machine itself, preventing it to work. Tell me how your story continued from there.