Tested on:Raspberry Pi 2; Python 2.7; Raspbian pre Jessie; Raspbian Jessie
Prerequisites:Raspberry Pi with Raspbian Jessie and internet connection (see steps 1-7 in the Introduction)
Hardware:Raspberry Pi compatible Microphone, e.g. Kinobo Akiro
active speakers
33

Jasper: manual installation on Raspbian Wheezy

This summary is based on the Jasper installation tutorial from the Jasper Project, just with everything required for getting up Jasper manually with Pocketsphinx as Speech-To-Text Engine(STT) and Phonetisaurus for Text-To-Speech(TTS) conversion on a Raspberry Pi with Raspbian Wheezy.

Jasper on the Raspberry Pi 3 or 2
Matt Curry made a new Image which simplifies installing Jasper on a Raspberry Pi 3 massively. This is explained in the new tutorial Jasper on the Raspberry Pi 3; please use that for the Raspberry Pi 3 (or 2) and this tutorial only for installing Jasper manually on the (outdated) Raspbian Wheezy.

Install Raspbian Wheezy
Download the Raspbian Wheezy disk image from Raspberrypi.org and burn it onto a SD card. Plug the SD card into the Raspberry Pi and boot it.

Install dependencies
Install the Jasper dependencies with

Test recording
See if sound output and recording are running with

Play and check the record with

Add environment paths
The environment paths have to be added to the .bashrc. Open it with

and add at the end of the file:

Sound configuration
The following configuration is required:
Open alsa-base.conf with

then find

and replace it with

Then, execute

Checkout the ALSA manual for additional information.

Download all Packages
The Pocketsphinx STT engine requires the MIT Language Modeling Toolkit, m2m-aligner, Phonetisaurus and OpenFST. All of these packages have to be downloaded and unzipped:

Speech-To-Text Engine Pocketsphinx and CMUCLMTK Installation

OpenFST Installation
To install OpenFST, enter the following:

This will take an hour or two.

M2M, MITLMT, Phonetisaurus and Phonetisaurus FST Installation

Jasper Installation
Finally, install the Jasper software itself with

Running Jasper
You can give Jasper some informations (all optional) with

Then run Jasper with

For adding own voice commands, check out the tutorial for custom voice commands with Jasper. Visit the Jasper support forum for updates, support and help.

Links
Jasper Project on Github: http://jasperproject.github.io/documentation/installation/
Matt Curry Website: http://www.mattcurry.com/projects-2/the-n-a-o-m-i-project/
Tutorial Jasper on the Raspberry Pi 3: http://www.knight-of-pi.org/raspberry-pi-3-installing-jasper-with-wit-ai-for-voice-recognition/
Raspbian Wheezy download: https://downloads.raspberrypi.org/raspbian/images/
ALSA manual: https://wiki.archlinux.org/index.php/Advanced_Linux_Sound_Architecture
Tutorial custom voice commands with Jasper: http://www.knight-of-pi.org/raspberry-pi-and-jasper-a-custom-voice-command-for-measuring-the-distance/
Jasper Support Forums: https://groups.google.com/forum/#!forum/jasper-support-forum
Tutorial: Burn a disk image to a SD card: http://www.knight-of-pi.org/installation/

Knight of Pi

Johannes Bergs aka Knight of Pi. Diploma in Bioinformatics, some Webdesign and Python coding then. Living in the beautiful city of Vienna.

33 Comments

  1. Hi, I’m trying to follow your instructions but having some large (>12 hours) waits for the packages to compile, which they don’t actually complete. This is an issue for is2013, g014b2b and openFST-1.3.4. Do you know why this is? I’m using a Raspberry Pi A+ with latest Jessie (the CLI version). Jasper dependencies are already downloaded.

  2. ./jasper.py
    Traceback (most recent call last):
    File “./jasper.py”, line 12, in
    from client import tts
    File “/home/pi/jasper/client/tts.py”, line 41, in
    import diagnose
    File “/home/pi/jasper/client/diagnose.py”, line 9, in
    import pip.req
    File “/usr/lib/python2.7/dist-packages/pip/__init__.py”, line 74, in
    from pip.vcs import git, mercurial, subversion, bazaar # noqa
    File “/usr/lib/python2.7/dist-packages/pip/vcs/mercurial.py”, line 9, in
    from pip.download import path_to_url
    File “/usr/lib/python2.7/dist-packages/pip/download.py”, line 25, in
    from requests.compat import IncompleteRead
    ImportError: cannot import name IncompleteRead

  3. WARNING:client.stt:Empty response: Nothing has been transcribed.
    No disturbance detected
    WARNING:apscheduler.scheduler:Execution of job “Notifier.gather (trigger: interval[0:00:30], next run at: 2016-07-21 04:24:19 UTC)” skipped: maximum number of running instances reached (1)
    No disturbance detected
    No disturbance detected
    No disturbance detected
    WARNING:apscheduler.scheduler:Execution of job “Notifier.gather (trigger: interval[0:00:30], next run at: 2016-07-21 04:24:49 UTC)” skipped: maximum number of running instances reached (1)
    No disturbance detected
    WARNING:client.stt:Empty response: Nothing has been transcribed.

    i’m having this error. what can be the problem here?

    • As much as for the RPi2 with Jessie (Wheezy won’t run on the Rpi3):
      The program compiles but Pocketsphinx only hears gibberish, which might be solved by installing wit.ai as STT engine.

  4. After trying to debug alsa issues for this project and getting BOTH usb mic and bcm2835 speakers working I think there is a basic problem that ALL of the ALSA advice I received does not deal with.

    The /usr/share/alsa/cards directory does not have a bcm2835.conf file. The /usr/share/alsa directory file alsa.conf leaves a LOT of stubs that need to be specified. Unless a card for bcm2835 is supplied, firing up Jasper.py displays a lot of supposedly non-fatal error messages. By working up a bcm2835.conf file, you can get rid of the irritating messages.

    It seems to me that this is a Jessie bug; there really should be a file that resolves these error messages. I seems just lazy for the jessie programmer that deals with ALSA to not have created one that is tested.

    I have not worked down thru all of the error messages, but I suspect that other messages are caused by this as well.

    Another case of not having a mature release is the failure to check for old firmware during boot. Old firmware on my jessie resulted in a desktop that would not respond to keyboard or mouse which is a showstopper for using jessie with old firmware, unless you know ssh. Not a naive user situation.

    • rchoppin, thanks for the information! Sadly i’m way to busy for Jasper experimentation right now, but have you submitted your bug to the Jasper developers?
      Jessie developed pretty rapidly and had quite some internal changes which brought some issues, not only for Jasper. It might need some time till Jasper is up to date, you might need to stay with Wheezy for now…

  5. Congratulations for the article. After trying several times with other methods, I have followed your instructions and I could install jasper on my RP2.
    Now I have a problem with jasper that he is “listening” random words when active. He constantly listen “IT”, “BUT”, “IT IT IT”, “WHAT IT IT” and some other words without I’m saying anything. Sometimes he listen some words I say, trying several times, but never the entire frase, even the word “JASPER” is hard to make him understand.
    Anyone have a idea of what can be made to fix it?
    Thank you

    • When i last tried, Jasper was not fully ported for the Raspberry Pi 2. I think this specific problem may be circumvented by using an other Speech-To-Text engine like Julius, but the installation is quite complex. I’d love to find some time soon for making more experiments…

  6. I had the same error and I believe it was due to extracting the archive as root. I deleted the directory and redid “tar xf g014B2B” command and ran the compile command (not as root) and it worked fine.

    • Phonetisaurus, the Text-To-Speech (TTS) engine of Jasper, is a modular Python framework, so there probably are alternative voices somewhere on the web.
      But TTS still is a hard task: i would be very impressed if a natural sounding voice could be generated from the Phonetisaurus framework.

      • Thank you, and thank you for the reply, I am still working on installing it to see how it all runs. But what about putting an image for the Pi2 and Pi3, for those new comming to the site?

        • Hi Vlad,

          since i haven’t got Jasper running stabily on Jessie, i hesitate to make an image right now. I really do want to try a better voice recognition engine (Julius), but that is complicated matter and i’m low on time right now. So, sadly, maybe in the future.

      • Now I have changed the SST to Wit.ai, and it worked. I just left the sphinx to passive mode.
        now I will try write some custom modules to my system.

        thanks again for the post.

        • Congrats! If you return, please let me know how happy you are with Wit.ai. I want to make some more experiments with voice recognition soon…

  7. Hi there!
    Thanks for the page! DOES this work for Pi zero? somebody tried this out so far? Thanks

    • Hi Ruslan, i do not know if it would work on the Zero, but since voice recognition requires quite some processing power i would recommend the strongest RPi out there.
      But you can shrink an RPi 3 by relocating the USB and Ethernet ports…

  8. I have a problem on step : OpenFST Installation
    When i do “sudo ./configure –enable-compact-fsts –enable-const-fsts –enable-far –enable-lookahead-fsts –enable-pdt” it give me this error :

    checking whether the C++ compiler works… no
    configure: error: in /home/pi/openfst-1.3.4':
    configure: error: C++ compiler cannot create executables
    See
    config.log’ for more details

    Here is an screenshot
    http://i66.tinypic.com/2q319b6.jpg

    Can you help me to resolve this problem ?I have Raspberry pi 3 model B and latest Raspbian Jessie on it

    • Hmm, looks like you’re missing the compiler. Did you do
      sudo apt-get install espeak subversion autoconf libtool automake gfortran g++ –yes
      and what version of Raspbian are you using?

Comment

Time limit is exhausted. Please reload CAPTCHA.