Hardware:Raspberry Pi 3 or 2
SD card and power source
Display, mouse and keyboard
USB soundcard
Headset
55

Installing Jasper on the Raspberry Pi 3 with Wit.ai for voice recognition

The Jasper Project is a voice recognition software bundle and works well with the Raspberry Pi. Voice control software always consists of packages for Speech-To-Text (STT) and Text-To-Speech (TTS) conversion. This tutorial uses Mary for TTS and Wit.ai for STT. Wit.ai has the advantage of giving good results, but needs an always-on internet connection and the data passes facebooks servers. An alternative would be OpenCyc.
Thanks to the Jasper team and especially Matt Curry for providing the new images!

Jasper disk image
For installing Jasper on Raspbian Jessie and a Raspberry Pi 3 or 2, download the new Jasper images from the Jasper support forums.This requires installing btsync.
After burning the image onto a SD card, attach the USB soundcard and the headset to the Raspberry Pi, then boot. Start raspi-config with sudo raspi-config, then extend the partition and change the keyboard layout if necessary.

Jasper installation
Enter in the terminal

and confirm the installation locations when asked.

Wit.ai for voice recognition
Register on Wit.ai, create a dummy app, select the dummy app, click Settings and find the Server Acess Token (in Settings you can also choose another language for Wit.ai).
With the language code, open profile.yml with

and enter your access token in

Also, you may enter your name, Gmail account and other, but that’s not necessary for running Jasper.

Test Jasper
Start Jasper by typing

in the terminal. Say a few words (in the language you chose on Wit.ai) and see if Jasper transcribes them. Test a module: say ‘jasper’, then ‘time’ after the beep and Jasper should output the current time.

Further readings

Links
Wit.ai Website: https://wit.ai/
OpenCyc website: http://sw.opencyc.org/
Jasper Project on Github: http://jasperproject.github.io
Matt Curry Website: http://www.mattcurry.com/projects-2/the-n-a-o-m-i-project/
Jasper Support Forums: https://groups.google.com/forum/#!forum/jasper-support-forum
ALSA manual: https://wiki.archlinux.org/index.php/Advanced_Linux_Sound_Architecture
Tutorial custom voice commands for Jasper: http://www.knight-of-pi.org/raspberry-pi-and-jasper-a-custom-voice-command-for-measuring-the-distance/
Jasper for the RPi2 and 3: https://groups.google.com/forum/#!msg/jasper-support-forum/Jhe5ZVH3iMA/ErtFvQQeAgAJ
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.

55 Comments

  1. Hello knight,
    I do same as you suggested for wit ai instalation for STT but Now it worse than pocketsphinx now it is not recognizing even jasper aslo.
    Is there any thing else i have to do on wit ai or Raspberry pi.

    Please help me

    • Hi Munib,
      sadly, Jasper isn’t maintained very much these days. I hope to find some time for it this month.

  2. hi mate…. after executing sudo nano ~/.jasper/profile.yml command i got output like the directory doesnt exist or file not exist…. profile.yml file showing blank…. actually in my jasper image there was something inside it… i have extracted it…. so what should i do now

    • Quite a few people had problems with the Jasper installation recently, i’ll retry in a few days and update then.

      Is there a directory ~/jasper or ~/jasper-client?
      If so, enter that directory and look for a file populate.py (might be in a ./jasper or ./client subdirectory). If it’s there, enter
      python populate.py
      and see if that created ~/.jasper/profile.yml

      • I’ve run the populate.py script several times and I have the same issue. Nano displays a blank file.

        • Hey Anthony,

          i’m sorry but Jasper seems to be work in progress right now. I’ll retry the manual installation when i find the time, but i can’t do it soon.

  3. Hello, good day, could you help me with a doubt?
    When I type the command: git pull
    This happens:

    remote: Counting objects: 46, done.
    remote: Total 46 (delta 9), reused 9 (delta 9), pack-reused 37
    Unpacking objects: 100% (46/46), done.
    From https://github.com/mattcurrycom/Jasper-RPI-Tools
    105b859..7e08d1b master -> origin/master
    Updating 105b859..7e08d1b
    error: Your local changes to the following files would be overwritten by merge:
    crons/start-jasper.sh
    Please, commit your changes or stash them before you can merge.
    Aborting

    So, was this supposed to happen?

  4. When executing the command git pull the device returns a fatal error.any advice?

    • Thanks for the notice!
      Maybe Matt Curry changed the installation procedure for newer images. Is there a README.txt in /home/pi
      or in ~/Jasper-RPI-Tools ?
      Also, you could try the installation without the git pull step, maybe it’s already preinstalled.

  5. Hi,
    I burned the image to the sd-card and did everything just like in the instruction . When I run jasper it first speaks through speaker but then it displays IOError:[Errno -9997] Invalid sample rate.
    What is the problem?Please help.

    • Not sure, but this could be about the microphone. Can you record and play with arecord and aplay?

      • Thanks knight of pi.It worked.But can i use any other SST in place of WIT.ai.Does google speech to text work with this.Can you help me with installing alternative SSTs.

        • I think Google works, but i didn’t try it. I’d recommend that you check out the Jasper support forums linked in the article. There’s also a Slack group for Jasper. Matt Curry pulled the new distros together and gives great support…

    • I use pocketsphinx as stt engine. It is inaccurate. Is there a method to adapt the english model so as to accurately recognise my voice.

      • PocketSphinx in the version i know just doesn’t give good results. Wit.ai and some other give good results, but need permanent internet connection and run over outside servers. I don’t think there’s a better solution right now.

  6. I have installed Raspbian and then wrote the Jasper image to the SD Card. Now my raspberry pi won’t boot. I even tried the same with NOOBS. Where did I go wrong?

    • Maybe you forgot to safely eject the SD card?
      You can do that either manually or by entering
      sync
      in the terminal, then pulling the card.

  7. When I start jasper with ./boot.sh I get this message:
    ALSA lib pcm_dmix.c:1022:(snd_pcm_dmix_open) unable to open slave

    I can not hear anything out of the speaker. I mic seems to be working fine as Jasper is translating what I say. It seems it can not recognize the sound card.

    • Have you tested if the soundcard is compatible with the Raspberry Pi in general?
      Do arecord and aplay work?

  8. I get the following error when testing. It is indeed translating my voice to words but then i get the following error:

    File “/usr/local/lib/python2.7/dist-packages/apscheduler/executors/base.py”, line 108, in run_job
    retval = job.func(*job.args, **job.kwargs)
    File “/home/pi/jasper-client/client/notifier.py”, line 39, in gather
    [client.run() for client in self.notifiers]
    File “/home/pi/jasper-client/client/notifier.py”, line 18, in run
    self.timestamp = self.gather(self.timestamp)
    File “/home/pi/jasper-client/client/notifier.py”, line 43, in handleEmailNotifications
    emails = Gmail.fetchUnreadEmails(self.profile, since=lastDate)
    File “/home/pi/jasper-client/client/modules/Gmail.py”, line 63, in fetchUnreadEmails
    conn.login(profile[‘gmail_address’], profile[‘gmail_password’])
    File “/usr/lib/python2.7/imaplib.py”, line 519, in login
    raise self.error(dat[-1])
    error: Lookup failed b193mb212551896itc

    • Hmmm did you activate an email module without supplying credentials in the config?
      I don’t know this specific error but it seems to miss some data.
      Also, there’s an upcoming new version of the image, v1.6, which might be more stable.

  9. Wit.AI let’s you make Stories, so if it detects a phrase, the wit.ai bot WI respond. How can I get those responses back to Jasper and spoken to user?

    • Hi Jason,

      you can ignore the Wit.ai stories- Jasper just uses the Wit.ai engine for transcribing spoken words.
      For making Jasper reply, you can design custom modules, see my link in the answer of the comment below.

  10. So on the official Jasper website, they have a page where there are instructions to download community made modules. http://jasperproject.github.io/documentation/modules/
    I know these were made to work with the original Jasper for the first model raspberry pi. Is there a way to get these working with a raspberry pi 3 with Jasper set up the way explained in your tutorial? A really good tutorial btw ;)

  11. Everything went smooth for me right until attempting to test. I typed cd ~./jasper-client/jasper into the terminal and it replied with a bash saying “No such file or directory.” I’d be grateful if someone has a fix for this, although I’m already pretty happy with the progress made.

    • So I fixed my own problem and may have found a solution to what was happening to Wesley earlier, because the same thing was happening to me. Instead of using “cd” to get into “jasper-client/jasper,” I instead used “cd” to first go into “jasper-client”, and then used “cd” to go into “boot.” Once in “boot,” I ran ./boot.sh. This started Jasper for me. And the question that I now have is that after 3 or 4 minutes, “input overflow error” shows up and I have to reboot the pi to get Jasper working again. Any idea as to why this is happening?

      • “input overflow” might point to an error with the microphone. With earlier versions, i had to play with the microphone chunk size in the configuration to make it run. Maybe test another microphone if the error remains?

        Also, it’s
        ./jasper-client/jasper
        without cd- it calls a starter script.

  12. I have a raspbian jessie with pixel preinstalled in my pi 3. I have downloaded jasper image and wrote it into my sd card.but on powering up raspberry i cannot get theusual pixel desktop but instead gets ssh command line. does the image only contains jasper or raspbian with jasper . If the second case How can i get a desktop for it? Please help. I had no pblm in installing jasper as per the tutorial.

    • Hi,
      it’s Jasper and Raspbian. It might be that the for Jasper optimized Raspbian does not even have a desktop, so you would need to install one (lightdm). Before doing that, enter
      sudo raspi-config
      see if you can change the login to autologin to desktop or similar, then reboot.

      • I did select autologin to desktop. But it shows an error message.

        • I did select autologin to desktop. But it shows an error message.
          Also i tried to install lightdm manually it completes but the desktop never boots.

          • Hey sorry for the late reply.
            Try
            sudo apt-get update
            sudo apt-get install -y lxde lightdm xinit
            Then, entering
            startx
            starts the desktop.

            However, i’m not sure it’s a good idea running Jasper and the Desktop environment, since Jasper is already kind of slow when run in the terminal.

  13. Hi dude,

    Glad to found your tutorial (and to see your still active)

    Small question : I’ve a project for which I intend to install a few different programs and scripts in addition to Jasper. Your guide advices to copy an image of Jasper. Shall I be able to add those files?
    Otherwise, do you plan to do a guide on how to install jasper manually on an already existing Raspbian ?

    Thanks whatever :)

    • Hey Michel,
      you’re welcome! Feel free the drop a little donation if you want to support this site.

      Best way probably is forking the Jasper project GitHub repository and adding your files.
      I haven’t tried that, but copying the image, executing the installer, then pulling the modified GitHub Repo should work without additional steps.

      If you want to go the manual way: Burn the jasper image, then enter
      $history
      in the terminal and open the installer scripts if necessary. This shows all steps required (if they didn’t clean the history which is likely).

      • Hey mate.

        Just so i’m sure I get it : your link for an image of Jasper only contains Jasper? Or does it contain like a whole raspbian with jasper pre-installed on top? Cause I don’t really want to have to re-re-reformat the sd card (I’m on a bad connection so I don’t really have time for this)

        • It’s the full image, but it’s zipped and should be around 1.5Gb. Since i haven’t received updates from the support forums recently, i assume the current version is stable.

          So long

  14. Hi, I’m getting an error when I entered cd ~/jasper-client/client
    it showed
    -bash: cd: /home/pi/jasper-client/client: No such file or directory
    How can I solve it? Thank you

    • Hi Wesley, you burned the Jasper image, right?
      Please post the output of
      ls ~
      ls ~/jasp*

      • Sorry for the late reply. It shows ” ls: cannot access /home/pi/jasp: No such file or directory”

        • So i guess
          ls ~
          did not show anything with jasper in the name?
          If so, just re-download the Jasper image from the Jasper support forums and burn it onto an SD card. Might be that you downloaded a corrupt version. Anyways, i’ll redo the installation in a few days; if something doesn’t work, i’ll let you know.

  15. I already have Raspbian on my pi and its running well (it requires me to keep the SD card in the pi) how do I install the jasper image on it?? please help

    • Hey Ray, the manual installation of Jasper onto Raspbian Jessie is very complicated, or at least it was last time i tried.
      It’s better if you download the Jasper Image supplied on the Jasper Project forums, burn it onto an SD card and continue from there.

      • I followed your instructions and burn the image file on my SD card and when I boot my pi i get a rainbow picture. Any idea what it means?

        • Hmmm, the rainbow picture is the first thing you see when the RPi boots normally.
          Did you safely eject the SD card before unplugging it? That’s a frequent cause of problems.

  16. I have sucessfully installed jasper with witai.
    Jasper responds back if I said: “Jasper” …. followed by the question like “weather”
    It basically returns the current weather.

    But how do I get witai story to reply back and transcribe the text to speech via Jasper?

    Do you have example of your witai story?

  17. Hi,

    Im getting error :

    ./jasper-client/jasper.py
    Traceback (most recent call last):
    File “./jasper-client/jasper.py”, line 12, in
    from client import tts, stt, jasperpath, diagnose
    File “/home/pi/jasper-client/client/tts.py”, line 41, in
    import diagnose
    File “/home/pi/jasper-client/client/diagnose.py”, line 10, in
    import jasperpath
    File “/home/pi/jasper-client/client/jasperpath.py”, line 12, in
    from client import tts, stt, jasperpath, diagnose
    ImportError: cannot import name tts

    Any idea?

    • Hi,
      you are using the newest image from the Jasper support forums, right?
      Did you setup Wit.ai as described or did you try to start Jasper directly after installing the image?

  18. im having a ver bad internet connection…..
    so wit.ai is working terribly bad.
    is there any offline stt
    i have heard about julius and sphinx
    many reviews said that pocketsphinx works bad in raspberry pi 3
    and I dont know how to insall julius in rpi3 jasper image ,,,,,,,,,,,,,

    please help…….

    • Hey Jithu, i didn’t try Julius, it looked difficult to install and needs training.
      However, i’ve heard that OpenCyc should give good results and does not need internet, but i don’t know when i’ll find the time to test ist.

  19. I am getting errors while doing this……..
    ./jasper-client/jasper”
    jasper is showing errors !

    ScannerError: while scanning for the next token
    found character ‘\t’ that cannot start any token
    in “/home/pi/.jasper/profile.yml”, line 10,column 1

    could you please help …
    Thank you

    • Jithu, this means that you have a tabulator key in the profile.yml.
      Try opening that file and replace every indention with spaces. Maybe before or after your access key? It’s spaces in the sample code in this tutorial…

Comment

Time limit is exhausted. Please reload CAPTCHA.