Sunday, 5 February 2017

Speech Recognition on Linux

Posted by Unknown On 09:49 | No comments
Speech recognition is an awesome thing to do, be it on Linux or any other platform. Sadly, of late, google has restricted its speech recognition APIs because of which speech recognition has become a tedious task for the developers to implement. I started exploring the alternatives for the same and found CMU pocketsphinx as a good alternative. The best part is, it can work offline !. Unfortunately, setting up the software wasn't a cake walk. I worked 10+ hours straight on this and when I was about to give up it finally started working.

So here I surmise the result of the amount of caffeine I had!!

1. So first things first, Download pocketsphinx package and its dependent libraries.

Download SphinxBase zip file from here
Download PocketSphinx zip file from here

SphinxBase - It comprise of all the libraries that are needed by PocketSphinx
PocketSphinx- He is the guy whom we are after!

2. Place them in a folder and extract them

unzip sphinxbase_master.zip
unzip pocketsphinx_master.zip

3. Install SphinxBase

  1. cd sphinxbase_master and run the following commands
  2. ./autogen.sh
  3. In the logs, check if checking alsa/asoundlib.h usability... yes,  if its not yes, then run sudo apt-get install libasound2-dev and run ./autogen.sh again.
  4. ./configure
  5. make
  6. sudo make install

4. Install pocketsphinx 


  1. cd pocketsphinx_master and run the following commands
  2. ./autogen.sh
  3. ./configure
  4. make clean all
  5. make check
  6. sudo make install

Everything went well till now?! Your system is awesome !!
Now for the big part, to check whether it is gonna work.

before that, open  ~/.bashrc, append the line export LD_LIBRARY_PATH=/usr/local/lib/ to the bottom of the file, save, and close it!

5. Now, the finale!

Open a new terminal and run the below command!
/usr/local/bin/pocketsphinx_continuous -adcdev plughw:0,0 -agc none -inmic yes

No crash? working? Your system deserves a medal!

Okay now as you can see, you can say something and the program detects your words. Tinker around and have fun

Sample Output:



Error in compiling? Program crashes? please write your queries in the comment

Note: Sometimes it's inaccurate in detecting the actual words spoken, there are a lot of parameters involved as to why this happens,. But Hi, I have it all worked out to make it amazingly accurate. Curious? What's life without a suspense :-)! wait for my next post!

Meanwhile, I'm working on something really cool with this, keep checking the blog for more info. So until next time, adios!

Blogroll

Copyright © 2013 RAJ PRAJAPATI (raj@electronicsrj.com)

Comments

About Projects

We also Provide support in making Electronics Projects at different level at Cheapest price. Contact Us for the further help.