element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Personal Blogs
  • Community Hub
  • More
Personal Blogs
Legacy Personal Blogs PocketSphinx on Pi3: The Detailed Steps
  • Blog
  • Documents
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: alanmcdonley
  • Date Created: 19 Jun 2016 4:48 AM Date Created
  • Views 1434 views
  • Likes 1 like
  • Comments 0 comments
Related
Recommended

PocketSphinx on Pi3: The Detailed Steps

alanmcdonley
alanmcdonley
19 Jun 2016

These are the detail steps I went through to install PocketSphinx on my element14 Road Test Raspberry Pi 3B  (Thank you guys again - I love it!)

(It got late and I stopped writing down things at the end - sorry.)

 

Refer to:

makezine.com  Roomba, I Command Thee: Use Raspberry Pi for Voice Control

http://makezine.com/projects/use-raspberry-pi-for-voice-control/

 

First, go get the packages required for SphinxBase by executing:

 

sudo apt-get update

sudo apt-get install libasound2-dev autoconf libtool bison \

swig python-dev python-pyaudio

 

You’ll also need to install some Python libraries for use with our demo application. To do this, you’ll install and use the Python pip command with the following commands:

 

curl -O https://bootstrap.pypa.io/get-pip.py

 

sudo python get-pip.py

 

sudo pip install gevent grequests

 

OBTAINING THE SPHINX TOOLS

Now you can go about getting the SphinxBase package, which is used by PocketSphinx as well as other software in the CMU Sphinx family.

 

To obtain SphinxBase execute the following commands:

 

git clone git://github.com/cmusphinx/sphinxbase.git

cd sphinxbase

git checkout 3b34d87

 

./autogen.sh

 

make

 

(At this stage you may want to go make coffee …)

 

sudo make install

 

cd ..

 

You’re ready to move on to PocketSphinx.

 

To obtain PocketSphinx, execute the following commands:

 

git clone git://github.com/cmusphinx/pocketsphinx.git

 

cd pocketsphinx

 

git checkout 4e4e607

 

./autogen.sh

 

make

 

(Time for a second cup of coffee …)

 

sudo make install

 

cd ..

 

To update the system with your new libraries, run sudo ldconfig.

 

 

TESTING THE SPEECH RECOGNITION

Now that you have the building blocks of your speech recognition in place, you’ll want to test that it actually works before continuing.

 

 

Now you can run a test of PocketSphinx using

 

pocketsphinx_continuous -inmic yes.

 

You should see something like the following, which indicates the system is ready for you to start speaking:

...

...

Listening...

Input overrun, read calls are too rare (non-fatal)

 

You can safely ignore the warning. Go ahead and speak!

 

 

When you’re finished, you should see some technical information along with PocketSphinx’s best guess as to what you said, and then another READY prompt letting you know it’s ready for more input.

 

 

INFO: ngram_search.c(874): bestpath 0.10 CPU 0.071 xRT

INFO: ngram_search.c(877): bestpath 0.11 wall 0.078 xRT

what

READY....

 

 

RECO FROM FILE with large LM:

  arecord -f s16_LE -r 16000 test16k.wav

  pocketsphinx_continuous -infile test16k.wav 2>&1 | tee ./psphinx.log

 

 

  xRT= sum of fwdflat, CPU xRT  (from Nikolay )

 

My files are located at:   https://github.com/slowrunner/Pi3RoadTest

 

Pi3RoadTest/   top directory

recoMic/ contains recognition test using pocketsphinx with the microphone

recoFile/ contains recognition test and results for pocketsphinx with file input

 

copy the folder cmusphinx-5prealpha-en-us-ptm-2.0 into recoMic/ and into recoFile/

 

download the prebuilt acoustic model from the Sphinx SourceForge: http://sourceforge.net/projects/cmusphinx/files/Acoustic%20and%20Language%20Models/US%20English%20Generic%20Acoustic%20M…

 

copy into recoMic/ and into recoFile/

 

extract it with:

 

tar -xvf cmusphinx-en-us-ptm-5.2.tar.gz.

 

See the notes file in each dir for exact commands to run the test and how to process the log file to get results statistics.

 

================

 

 

In lm mode log shows performance information (latest psphinx supposedly will show for grammar mode also).

 

 

For individual or TOTAL:

Add up fwdtree + fwdflat + bestpath CPU time = CPU time spent recognizing

Add up fwdtree + fwdflat + bestpath xRT (<1 e.g. 0.52 means 1s of audio takes 0.52 seconds of CPU time, or 0.52% of one core to perform the reco.

(To calculate length of audio processed divide total CPU time by percent of CPU)

 

 

on Pi 3:  (126 phrase corpus using 136 words, 278 bi-grams, 295 tri-grams)

1.2GHz single core processing

 

 

64 phrases: 

   Total CPU: 75.7s  0.52 xRT  146s audio

   Total Wall: 190s  1.3  xRT  (146s audio) -

         Wall time includes startup, tear down, output and logging.

         Reco from mic cannot be faster than realtime.

   0.52 xRT CPU means 52% of one core used by ASR.

  • Sign in to reply
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube