Kaldi Speech Recognition Install on Ubuntu

I’m working on a little Raspberry Pi project and I hope to add some simple verbal commands to it.  I’m currently playing around with some Open Source Speech/Voice Recognition tools (Also known as Speech To Text or SST).  My goal is to adapt the VoxForge to the voices of my family.

  • First I tried Pocketsphinx from the CMU Sphinx toolkit. I didn’t like it because it doesn’t seems to be a little bloated, and my Raspberry Pi is not quite fast enough.
  • The second tool I’m messing with is the Julius along with instrunctions on Voxforge.  It seems promising.  I was able to get it working and the recognition works well for my voice, but I can’t seem to get it to recognize my son’s voice.  He’s 9…  I record his training data and adapted the voxforge Model with it, but so far it I can’t it it to pick up is voice with much accuracy.
  • The third tool I’m just now playing with is Kaldi.  The latest trunk has voxforge recipes included so I’m eager to try it out.  After much much trail and error, I was finally able to get it it complied and working on Ubuntu.  I have not attempted to get it going on the Raspberry Pi yet, but  I thought I’d share my notes.

KALDI on Ubuntu 16.10

  1. Install some Required stuff (I’m not sure if you need all of this, but it seems to work)
    1. sudo apt-get install autoconf automake git libtool subversion wget zlib1g-dev libatlas-base-dev gawk perl grep perl
  2. Download Kaldi using git
    1. cd ~/
    2. git clone https://github.com/kaldi-asr/kaldi.git kaldi-trunk –origin golden
  3. Read the instructions
    1. cat ~/kaldi-trunk/INSTALL
    2. cat ~/kaldi-trunk/tools/INSTALL
  4. Check for dependencies using the handy included script.
    1. cd ~/kaldi-trunk
    2. extras/check_dependencies.sh
  5. I had an error about bash.  In Ubuntu 6.10, the default system shell, /bin/sh, was changed to dash
    1. I did some searching around and decided to revert back to bash instead of dash.  I used the following command to do this.
    2. sudo dpkg-reconfigure dash
  6. Check if everything is fixed
    1. sudo ./check_dependencies.sh
    2. Output should be:  ./check_dependencies.sh: all OK.
  7. Okay, now according to the documentation I should have been able to compile the tools under ~/kaldi-trunk/tools but they would not compile so I was stuck for awhile
    1. Fix a problem File ~/kaldi-trunk/tools/openfst-1.6.1/src/include/fst/shortest-path.h
      1. I could not get the tools to compile so I had to do some digging.  I tracked down the errors and figured out the problem was with OpenSFT-1.6.1.  To fix it I had to edit one of the files in the OpenFST Source
      2. Replace the word “auto” with “int” on LINE 77 in file   ~/kaldi-trunk/tools/openfst-1.6.1/src/include/fst/shortest-path.h
        1. nano ~/kaldi-trunk/tools/openfst-1.6.1/src/include/fst/shortest-path.h
    2. After that obscure problem fixed I was able to compile the tools without problems.
      1. cd ~/kaldi-trunk/tools
      2. make
  8. Finally compile Kaldi
    1. cd ~/kaldi-trunk/src
    2. ./configure –shared
    3. make clean
    4. make depend
    5. make
  9. Now I can start to play with Kaldi and compare it to Julius.

I hope this helps someone else out that is trying to get Kaldi going.

 

One thought on “Kaldi Speech Recognition Install on Ubuntu

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.