Training custom Speech to Text model using CMU Sphinx4 — Part 1 — Setting up CMU Sphinx &…

Original article was published by Praveen Kumar on Artificial Intelligence on Medium

To install CMU Sphinx, we need a few packages to be installed on our system. Execute the following command which will ease our efforts in doing so:

sudo apt-get install git gcc make automake autoconf libtool bison swig python-dev libpulse-dev subversion

The above command may install several additional packages (approx 200 MB disk space required). However, make sure you have installed all of these packages to proceed further. ⚠️

Now, let’s move to set up CMU Sphinx. Sphinx stands with CMU SphinxBase, CMU SphinxTrain, and CMU PocketSphinx. To be able to work with all these packages, we need to install SphinxBase first.

Let’s make a directory at our home directory and clone SphinxBase from Github.

mkdir sphinx_src
cd sphinx_src

The above commands gave us the following output.

Now, let’s clone the repo and install SphinxBase. Run the following commands one by one.

git clone sphinxbase./ --disable-dependency-trackingmakesudo make install

When you run the above commands, you will get lots of output on the terminal. We need to do just one more little step before we can verify if SphinxBase is installed correctly. Run the following commands one by one:

sudo nano /etc/

It will open a file. It will already have the first line shown in the below image. Just add the following line on the second line.


And then press CTRL+X, then Y, and ENTER. This will save your file. If you run the nano command once again, you should see the following contents.

Now, let’s verify if SphinxBase is installed correctly. Run the following commands.

sudo ldconfigsphinx_lm_convert

You should be able to see the following output:

If so, then great 😃. We did the first major step. Let’s quickly install PocketSphinx & SphinxTrain.