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
45

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.

45 Comments

  1. Sir does Jasper works offline? I need it for my project but in offline mode.

  2. Hello sir. I’m installing jasper on raspbian jessie lite. my problem is that i can’t seem to make the microphone work. I’m still a noob with this and only following some guides, unfortunately i can’t find a solution to my problem.

    • The current builds of Jasper do not support Jessie lite as far as i know. You could download the newest image and try to replicate the steps on a Jessie lite system, but i can’t say if that works.

  3. google code packages seem to have moved, any easy way to find them? i can probably google it…

    • Hey Rick, installing Jasper on Wheezy is not recommended anymore. For now, use the Disk Image Matt Curry supplies on the Jasper forums. I want to make a “manual installation on Jessie”-tutorial, but i can’t say when i’ll find the time for that.
      If you go for Wheezy and fix the missing dependencies, it’d be very nice if you post what you did here or write me an email.

  4. I am still somewhat of a noob when it comes to python and pi, so please forgive me if this sounds dumb. I have been trying to follow the jasper install guides and I cannot get jasper to work. Right now, I am getting the error: OSError: Can’t find command ‘phonetisaurus-g2p’! Please check if Phonetisaurus is installed and in your $PATH.

    I’ve tried reinstalling it and recompiling and I can’t seem to resolve the issue. Is there anyway you could give me a few suggestions as to where to go from here?

    Also, I looked in the phonetisaurus folder and phonetisaurus-g2p.cpp is there. Is that the same file the error is referring to? Thanks

    • Hi DLDR,
      What’s the output of
      cd ~/g014b2b/
      ./compile-fst.sh

      Anyways, are you sure you want install Jasper on Wheezy? The image supplied by Matt Curry is certainly the fastest path to a well-running Jasper…

  5. getting the following message and didnĀ“t find anything on the web :/ help :D
    *******************************************************
    * JASPER – THE TALKING COMPUTER *
    * (c) 2015 Shubhro Saha, Charlie Marsh & Jan Holthuis *
    *******************************************************
    WARNING:root:tts_engine not specified in profile, defaulting to ‘espeak-tts’
    ALSA lib pcm_dmix.c:1022:(snd_pcm_dmix_open) unable to open slave
    ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
    ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
    ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
    ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
    ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
    ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
    ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
    ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
    ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
    ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection refused

    ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection refused

    ALSA lib pcm_dmix.c:1022:(snd_pcm_dmix_open) unable to open slave
    Cannot connect to server socket err = No such file or directory
    Cannot connect to server request channel
    jack server is not running or cannot be started
    WARNING:client.notifier:gmail_address or gmail_password not set in profile, Gmail notifier will not be used
    Expression ‘paInvalidSampleRate’ failed in ‘src/hostapi/alsa/pa_linux_alsa.c’, line: 2048
    Expression ‘PaAlsaStreamComponent_InitialConfigure( &self->capture, inParams, self->primeBuffers, hwParamsCapture, &realSr )’ failed in ‘src/hostapi/alsa/pa_linux_alsa.c’, line: 2719
    Expression ‘PaAlsaStream_Configure( stream, inputParameters, outputParameters, sampleRate, framesPerBuffer, &inputLatency, &outputLatency, &hostBufferSizeMode )’ failed in ‘src/hostapi/alsa/pa_linux_alsa.c’, line: 2843
    Traceback (most recent call last):
    File “jasper/jasper.py”, line 141, in
    app.run()
    File “jasper/jasper.py”, line 111, in run
    conversation.handleForever()
    File “/home/pi/jasper/client/conversation.py”, line 31, in handleForever
    threshold, transcribed = self.mic.passiveListen(self.persona)
    File “/home/pi/jasper/client/mic.py”, line 110, in passiveListen
    frames_per_buffer=CHUNK)
    File “/usr/lib/python2.7/dist-packages/pyaudio.py”, line 747, in open
    stream = Stream(self, *args, **kwargs)
    File “/usr/lib/python2.7/dist-packages/pyaudio.py”, line 442, in __init__
    self._stream = pa.open(**arguments)
    IOError: [Errno Invalid sample rate] -9997

    • Are you using a USB microphone or how do you input audio?
      Did arecord and aplay work?

  6. 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.

  7. Pingback: First install of jasper | Marghost's blog
  8. ./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

  9. 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?

  10. Pingback: Homemade Car Computer Featuring the Raspberry Pi and Ubuntu | Broken Hive Mind
    • Hi zara-
      it seems as if your Raspberry Pi does not have an internet connection.

    • 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.

  11. 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…

  12. 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…

  13. 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…

    • hello, i got jasper to work but his voice to text translation is complete crap, can someone suggest a better stt engine?

  14. Pingback: Arc Raspberry MKIII – Bonelord Technologies
  15. Pingback: Setting up Jasper Voice Assistant (like Jarvis) on Raspberry Pi 2 B+ – Raspberry Pi 2 Blog
  16. 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…

  17. 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.