Nov 15
Sphinx speech recognition on Ubuntu Linux
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:
cd sphinxbase-0.8/
./configure
make clean
make
make install
sudo make install
next up is pocketsphinx:
cd ..
cd pocketsphinx-0.8/
./configure
make clean
make
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:
$ pocketsphinx_continuous
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:
LD_LIBRARY_PATH=/usr/local/lib /usr/local/bin/pocketsphinx_continuous
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.
October 13th, 2014 at 2:21 pm
I am getting this error(so.0 cant be opened):
src/programs/.libs/lt-pocketsphinx_continuous: error while loading shared libraries: libsphinxad.so.0: cannot open shared object file: No such file or directory
November 3rd, 2014 at 3:43 pm
I can't offer you any support, but I think, this means what the error says, an issue with (shared) libraries not being there. Try building yourself, or with static linking, or get hold of a binary built on your architecture/ distribution.
October 13th, 2014 at 2:21 pm
I am getting this error(so.0 cant be opened):
src/programs/.libs/lt-pocketsphinx_continuous: error while loading shared libraries: libsphinxad.so.0: cannot open shared object file: No such file or directory
November 3rd, 2014 at 3:43 pm
I can't offer you any support, but I think, this means what the error says, an issue with (shared) libraries not being there. Try building yourself, or with static linking, or get hold of a binary built on your architecture/ distribution.
April 30th, 2015 at 3:10 pm
I had no shared library problems on ubuntu14.04.2 but i got this one:
ERROR: "acmod.c", line 87: Folder 'Sphinx/model_parameters/voxforge_de_sphinx.cd_cont_3000/' does not contain acoustic model definition 'mdef'
j
June 28th, 2015 at 1:35 pm
Sorry, but this post is from ages ago and I can't remember if I encountered a similar problem.
April 30th, 2015 at 3:10 pm
I had no shared library problems on ubuntu14.04.2 but i got this one:
ERROR: "acmod.c", line 87: Folder 'Sphinx/model_parameters/voxforge_de_sphinx.cd_cont_3000/' does not contain acoustic model definition 'mdef'
j
June 28th, 2015 at 1:35 pm
Sorry, but this post is from ages ago and I can't remember if I encountered a similar problem.