Monday, January 23, 2017

Arduino + Speech Recognition (Annyang / Jasper/pocketsphinx)



Introduction





Requirements:




Procedures:

sudo apt-get install git
sudo apt-get install automake
sudo apt-get install libtool
sudo apt-get install bison
sudo apt-get install python-dev
sudo apt-get install swig
sudo apt-get install make
sudo apt-get install pkg-config
git clone https://github.com/cmusphinx/sphinxbase.git
cd sphinxbase
./autogen.sh
make
sudo make install
cd ..
git clone git://github.com/cmusphinx/pocketsphinx.git
cd pocketsphinx
./autogen.sh
make
sudo make install
cd ..

sudo apt-get install ffmpeg

Using PocketSphinx
Now just upload a wav file to your working directory. Note: Wave file needs to be mono channel, normalized, and 16000 sample rate.

Use this to convert quickly online: http://audio.online-convert.com/convert-to-wav


ffmpeg -i input.mp3 -acodec pcm_s16le -ac 1 -ar 16000 output.wav

To convert all mp3 files in a directory in Linux:
for f in *.mp3; do ffmpeg -i "$f" -acodec pcm_s16le -ac 1 -ar 16000 "${f%.mp3}.wav"; \


Without Timing

pocketsphinx_continuous -infile sample.wav > decode-result.txt
With Timing

pocketsphinx_continuous -time yes -infile sample.wav > decode-result.txt

Methodology








Remarks




Conclusions: