Best Voice Recognition Software for Raspberry Pi

 

Best Voice Recognition Software for Raspberry Pi DIY Hacking

Best Voice Recognition Software for Raspberry Pi

This tutorial is about the best voice recognition software for Raspberry Pi and how to use it. I was able to install and test three different voice recognition systems for Raspberry Pi. Two of these softwares were dependent on the internet and were online , however the third one was offline.The three softwares which were tested were :

  1. Jasper – Voice Recognition Software.
  2. Raspberry Pi Voice Recognition by Oscar Liang.
  3. Raspberry Pi Voice Control by Steven Hickson.

Out of these three, I rate the Voice Control software created by Steven Hickson to be the most precise and potent. The Jasper system, even though it works offline , it compromises on accuracy and speed. This would be useful for systems that have no access to the internet, but a small caveat, the system takes up almost a whole 4GB memory card, so use at least an 8GB card with it.Some of its services are cumbersome and takes a lot of effort from the user to pronounce repeatedly until the system picks it up.

The softwares presented by Oscar and Steven use google voice APIs, they are very accurate and precise. Both of them also use google speech , so that the system can be manipulated to talk back and respond to your commands and queries.But, I prefer the third software because it has a simple and straight forward interface. Here, you will be able to define each of your voice commands and link them to particular tasks in the form of bash commands.These are defined inside a configuration file. A detailed tutorial explaining the installation and use of this voice recognition software for raspberry pi is given below by DIY Hacking and the video at the bottom lets you get a feeling of the voice control software before you install it.

What are the stuff required to do this project?

Hardware:

  1. Raspberry Pi model B with memory card preloaded with an OS.
  2. WiFi dongle (Optional) : Edimax EW 7811UN / LAN network cable.
  3. A USB webcam with microphone / USB microphone.

You cannot use normal microphones with audio jacks because the raspberry pi does not have a sound card. Hence, only use USB webcams with inbuilt mic or USB microphones. I am using a cheap USB webcam with an inbuilt mic.

Best Voice Recognition Software for Raspberry Pi DIY Hacking

USB Webcam with inbuilt mic

How does it work?

The software being described here uses Google Voice and speech APIs. The voice command from the user is captured by the microphone.This is then converted to text by using Google voice API. The text is then compared with the other previously defined commands inside the commands configuration file. If it matches with any of them, then the bash command associated with it will be executed. You can also use this system as an interactive voice response system by making the raspberry pi respond to your commands via speech. This is be achieved by using the Google speech API, which converts the text into speech. Here’s a block diagram showing you the basic working of the voice recognition software for raspberry pi:

Best Voice Recognition Software for Raspberry Pi DIY Hacking

Voice Recognition Software for Raspberry Pi – Working

Step 1: Checking your microphone

You need to first check whether your microphone records properly and if the mic volumes, etc are high. First check if your webcam or microphone is listed using the command “lsusb“. Check if your mic/webcam comes up in the list.

Next we need to set the mic recording volume high. To do this, enter the command “alsamixer” in the terminal. A neat graphical interface shows up, press the up/down arrow keys to set the volume. Press F6 (all), then select the webcam or mic from the list. Then again use the up arrow key to set the recording volume to high.

Best Voice Recognition Software for Raspberry Pi DIY Hacking

Alsamixer for raspberry pi

Now, you need to check if the recording takes place properly. Use the command “arecord -l” to check if your mic/webcam is listed. Then, use the command “arecord -D plughw:1,0 test.wav” to record sound. The sound will be recorded in the file “test.wav”. To listen to it, plug in your headphones to the pi and enter the command “aplay test.wav” in the terminal. If your able to hear the sound, your microphones works perfectly, else try adjusting the volumes and repeat the previous steps.

Step 2:Installing the voice recognition software for raspberry pi

This software was created by Steven Hickson and utilises Google voice API. To install this software , execute the following commands one after the other:

  • wget –no-check-certificate “http://goo.gl/KrwrBa” -O PiAUISuite.tar.gz
  • tar -xvzf PiAUISuite.tar.gz
  • cd PiAUISuite/Install/
  • sudo ./InstallAUISuite.sh

Please not that the wget command in the first line uses two dashes (- -) before “no-check”. During the installation, several questions shall pop up. You need to read these carefully and press y/n accordingly. I would recommend you to press y for all of them.Some of the questions include: Do you want to set a keyword? (Keyword is a voice command like a name, the system gets activated only when first use this command), Do you want to set filler flag to zero? (Press y, else you will always hear “Filler Fill” before every speech response from the pi) , Do you want to install youtube-dl? (A terminal service for playing youtube videos), etc. Options for changing the listening duration and system response is also presented during the installation. Read carefully each of these questions and respond accordingly.

Best Voice Recognition Software for Raspberry Pi DIY Hacking

Questions you might see while installing the voice control software for raspberry pi

Step 3:Using the voice control software and setting up your own commands

You can verify the voice to text conversion by running “./speech-recog.sh” in the directory: /home/pi/PiAUISuite/VoiceCommand. The software is activated to run continuously when you execute the command “sudo voicecommand -c” in the terminal. By default, the keyword used to activate it is “Pi” , only when you say this when its listening can you execute the other commands.Check the video below to get a feel of the software.

I would recommend changing the keyword from “Pi” to something else, as the system usually interpreted it for me as “Hi”.You can change the keyword and other voice commands and actions by opening the commands configuration file. This can be done by entering the command “voicecommand -e“.Inside this, you can see various options for setting the keyword, the speech response ,etc. Please remove the “#” before the lines in the file while changing them.

Best Voice Recognition Software for Raspberry Pi DIY Hacking

Voice commands configuration file

Here, each command is linked to a particular action. Eg: “Youtube==youtube-search …” , here when you say for example “Youtube android” , it runs the command “youtube-search android” in the bash. The “…” stands for anything you say after the command “Youtube”. In case of the voice command definition : “play  $1 season $2 episode $3 =playvideo -s $2 -e $3 $1” , here when you say for example “play Big bang Theory season 1 episode 4”, it executes the command “playvideo -s 1 -e 4 Big Bang Theory“, i.e., it plays the 4th episode of the 1st season of Big Bang Theory.

So, if you want to add a new voice command to this, for example: a voice command “Check internet” that uses “ping” to check your internet connection. Then in the configuration file, enter a line like this “Check internet==ping google.com”. It executes “ping google.com” when you say “Check internet”.

Best Voice Recognition Software for Raspberry Pi DIY Hacking

The voice control software in action

Use this system for home automation, robotics and other cool stuff. This software is quite accurate and swift for your applications.Now, the video of the voice control software in action :

 

Recommended Posts
Showing 263 comments
  • Evan Cohen
    Reply

    Hey Arvind! I’ve been working on a new speech library for embedded devices (like the Raspberry Pi). It’s hot customization offline hotword detection and live streaming speech recognition. Take a look and let me know what you think: https://github.com/evancohen/sonus

  • DILSHAD AHMAD
    Reply

    hello sir plz help me when i entered the voicecommand -e the all command list appeares but when i edit them and try to save , then that says this file is not writable….when i entered via nano the that all commands not appeared plz help to edit the vocecommand .config file….as soon as possible sir

  • Jimmy
    Reply

    I’m interested in using this platform to just make a simple speech to text in Indonesian language. Could anybody give me a clue? I just need as simple as voice recognition from speech to text that I will use in Pyhton Raspberry Pi.

  • Raj
    Reply

    getting this “ERROR while loading shared libraries: libboost_regex.so.1.49.0: cannot open shared object file: No such file or directory”

  • Tnn
    Reply

    Hi, can it be configurated instead of voice, to recognize (match) predifined sounds. I.E if on radio plat mu favorite soung, PI will run some command, if my phone ring in the room , PI execute other command ??

  • Nilesh
    Reply

    In voicecommand -s, in the “Do you want to set up and check the text to speech options? section, it says:

    Something went wrong and you should run the install script and install the dependecies as well

    I have already installed the script and dependencies as detailed in the tutorial on Steven Hickson’s site. Should I reinstall everything from scratch?

    When I say no to the tts options check, voicecommand works fine, but voicecommand -c gets stuck doing nothing.

    Please help solve this issue

  • Kaihai73
    Reply

    Hello i have a problem in Step 2, if i run the first command it says ” bash: wget–no-check-certificate: command not found ” please help!

    • zoldaten
      Reply

      1. git clone https://github.com/StevenHickson/PiAUISuite.git
      2. cd PiAUISuite/Install/
      3. sudo ./InstallAUISuite.sh

      • eti
        Reply

        It stated there that:

        Please not that the wget command in the first line uses two dashes (- -) before “no-check”.

  • Nilesh
    Reply

    Running it on Raspberry Pi 3. When I run voicecommand (not continuous) it works fine, but when I run voicecommand -c it just shows the following screen and doesn’t do anything:

    Opening config file…
    Not querying for answers
    running in continuous mode
    keyword duration is 5 and duration is 5

    Please help solve this issue

  • Jawanth
    Reply

    Hello Arvind
    During the installation, I did not hear anything. (my pi is connected to Hdmi and to a TV display ) I could not hear through that. any way to fix this ?
    Thanks !

  • Jawanth
    Reply

    I did sudo apt-get update before I started the PA install. And I gave y for everything. The update of packages
    during installation went ok with no complaints. I gave y along the way for the other installation steps until I hit this:
    =============please see below extract where error occurs=====================:
    ……
    It looks like you installed youtube-dl with a package manager, pip, setup.py or a tarball. Please use that to update.
    Install voicecommand? y/n
    This is probably the coolest script here and ties many of these together. It is an easily customizable voice control system. It uses speech recognition and text to speech to listen to you, respond to you, and run commands based on what you say.
    y
    No commands found, using default
    Would you like voicecommand to try to set itself up? y/n
    y
    voicecommand: error while loading shared libraries: libboost_regex.so.1.49.0: cannot open shared object file: No such file or directory
    ===============================================================
    any remedy ?
    I am using Raspberry pi 3 with Jessie
    Thanks sir !

    • Jawanth
      Reply

      solved by installing the library separately.

      • Azhar
        Reply

        How you install the library separately?

        • Jawanth
          Reply

          sudo apt-get install libboost_regex.so.1.49.0

          • Azhar
            Reply

            When I try sudo apt-get install libboost_regex.so.1.49.0

            Reading package lists… Done
            Building dependency tree
            Reading state information… Done
            E: Unable to locate package libboost_regex.so.1.49.0
            E: Couldn’t find any package by regex ‘libboost_regex.so.1.49.0’

            I am also using RPI 3 with raspbian jessie

            • J
              Reply

              The following worked for me:

              sudo ln -s /usr/lib/arm-linux-gnueabihf/libboost_regex.so.1.55.0 /usr/lib/arm-linux-gnueabihf/libboost_regex.so.1.49.0

              • Kai Schwabe
                Reply

                Still doesnt fix it for me, any other advice? THX in advance

                • lutz
                  Reply

                  Same problem here. I can’t install the library with
                  sudo apt-get install libboost_regex.so.1.49.0
                  and also not with
                  sudo ln -s /usr/lib/arm-linux-gnueabihf/libboost_regex.so.1.55.0 /usr/lib/arm-linux-gnueabihf/libboost_regex.so.1.49.0

                  Any advices ?
                  Thank you guys in advance

                  • Saleh
                    Reply

                    This should help:

                    sudo apt-get install libboost-regex1.49.0

                    make sure you writ – not _

  • Roushan
    Reply

    Hi Arvind,

    I am trying this voice command on Raspberry pi 3, I am not getting any voice response, all I see on screen is as below:

    Opening config file…
    running in continuous mode
    keyword duration is 2 and duration is 3

    I tested the usb mic and speakers connected to 3.5 mm jack is ok, even heard the recorded voice.
    Please help me solve the issue

    • Heron
      Reply

      Did you figure out?
      I as planning to buy Pi 3 too.

  • saad
    Reply

    my voicecommand -c is working great so far but according to anders solution now it operates on any word I say instead of particular keyword any one have solution for this

  • HankP
    Reply

    I finally got Voicecommand working and have started working on commands. I’m having trouble with getting Pianobar to work properly. I can run Pianobar outside of Voicecommand fine. It finds my configuration file, logs me in and starts playing. In Voicecommansd it wants my email & password and then dies. I’m guessing it cannot find my Pianobar configuration file. Being fairly new at Linux any suggestion of where I need to put a copy of the configuration file so Voicecommand can find it?

  • HankP
    Reply

    I just started on this and am running into many problems:

    When I run VoiceCommand -c and try to change keyword from PI all I get returned is 3 graphic symbols, anybody else have this problem? And solution.

    Also after running VoiceCommand -c and it completes when I look in the commands.conf file in my home directory it does not have any of changes I made.

    Help!

  • Frank
    Reply

    When I run the sudo voicecommand -c from the PiAUISuite/VoiceCommand directory I get “sudo: voicecommand: command not found Yet when I run ls from this same directory I can see voicecommand in the directory? Any assistance would be appreciated.

    Thanks

    • Chris Locke
      Reply

      Did you run the install script?

      • Frank
        Reply

        yes I did

        • Chris Locke
          Reply

          The directory is where it is installed from so just try running the install again and making sure it prompts you for voice command stuff at the end and finishes.

  • ASP
    Reply

    Warning: Couldn’t read data from file “/dev/shm/out.flac”, this makes an empty
    Warning: POST.
    % Total % Received % Xferd Average Speed Time Time Time Current
    Dload Upload Total Spent Left Speed
    100 14 0 14 0 0 62 0 –:–:– –:–:– –:–:– 79
    rm: cannot remove `/dev/shm/out.flac’: No such file or directory

    How to get rid off this error ?

  • Dominic
    Reply

    I’m using a raspberry pi 3 with jessy and installed everything as suggested.
    When running voicecommand -c my voice gets recognised and i get “found audio”. But in the end I get back “no translation”.
    When running ./speech-recog.sh and i say something the script ends without any response.
    Any ideas whats wrong?

    • Mohit Khatri
      Reply

      Hello I am also getting the same problem. Did u find any solution ?

    • Chris Locke
      Reply

      Did you guys test your mics with arecord?

      • tuan
        Reply

        i got the same problem. i check the mic with arecord -l and this is resutl:
        pi@raspberrypi:~ $ arecord -l
        **** List of CAPTURE Hardware Devices ****
        card 1: C170 [Webcam C170], device 0: USB Audio [USB Audio]
        Subdevices: 1/1
        Subdevice #0: subdevice #0

  • steve
    Reply

    How does ./speech-recog.sh show you if it’s working or not? I don’t get that part.

    • ishant
      Reply

      Edit home/pi/.commands.conf !keyword==hi
      But when i say “hi” this msg come in terminal
      Attempting “hi”
      COULD NOT FIND ANSWER:TRY AGAIN

      • Chris Locke
        Reply

        Are you in continuous mode? The keyword is only used in continuous I believe and it is definitely only read in continuous mode with verify.

  • Aaron
    Reply

    Thank for your help. It’s worked for me with microphone connect throgh USB sound card,But I wanna do it with wireless microphone or use android as a microohone. Does everyone have experiences in this project?please help me!.

  • Johann
    Reply

    So I have voicecommand installed, I went through the set up process where it asked me to both type and say the name I wanted to use to get its attention, and it matches me saying the voice with the text, so I know that my microphone is working and the Google API is working as well. However, when I run “voicecommand -c”, I see it hearing audio bits, but it won’t respond to any of the commands, it doesn’t even show errors, it just continues to show how many seconds each audio bit is. Any advice?

    • Chris Locke
      Reply

      This sounds like you still need to address the stereo recording issue that someone pointed out in the other comments. (Anders I think)

  • rss
    Reply

    thanks….Anders………its worked..for me

  • NMG
    Reply

    I tried to install voice recognition software PiAUISuite in my rapbian Jessie OS. It is also not working. It doesn’t detect any voice, always returns “NO Translation”. Someone told google stopped supporting automated STT requests. I am doing this as an academic project. I need help urgently.

    Thanks in advance.

  • Ondra
    Reply

    All working now… Folow Barry’s and Anders’s advice.. Only keyword recogntion not working, but i can live without it

  • DEE
    Reply

    Hello Everyone
    I been working on this for about a week now I installed Voice command v3.0 on my Raspberry Pi2. I had a lot of problems but this site helped me the most. most every thing is working except i have to leave Verify off. I was hoping someone may have had this problem and got it fixed. I have made the changes in the config and tts files all that helped a lot, all my commands work, i just cant run it in contentious because, if verify is on i get no response.

    Thanks DEE

    • Anders
      Reply

      Hi,
      I Think i have an idea what the problem is with keyword recognition but hasent been able to fix it because I´m not able to recompile voicecommand sucessfully. But if someone has better luck..

      Check the voicecommand.cpp you will find that -c 1 needs to be addded there as well. I Think that ones verify is set it will run text to speech and send recording to google for text translaten, once it receive text back it will verify your keyword. All of this is done inside voicecommand i guess. Adding -c 1 on the arecord line in voicecommand.cpp and sucessfully recompiling voicecommand should fix the problem.

      But thats my best guess so far. Let me know if someone manges to recompile sucessfully and if it solves the problem.

      /Anders

      • Chris Locke
        Reply

        You can do this and it works great!! I had the same thought, I had to change the makefile where it had g++4.8 to just g++ and then make worked fine. I’ve actually made quite a few updates to improve the voice input for the keyword(s)

        • Jonatas
          Reply

          Hey Chris! Did you make it works with keyword recognition? Can you explain what exactly you did? I’d make it works, but always without keyword recognition.

        • saad
          Reply

          chris can you tell me how verification will work ?

  • Naweli Bharati
    Reply

    Hello,

    I found this post interesting but I have requirement that I need to use android Mobile for speech recognition. How does Raspberry understand the voice spoken over phone?

    • eti
      Reply

      Hello. Have you try it yet? I need to use a tablet for the speech recognition. If you done with it, can you share it with me? Thanks in advance. =)

  • sam
    Reply

    I am able to complete the instructions in the first install video on Steve’s website but cannot complete the settings for voicecommand -s
    At the step where it plays a sample audio and asks if I hear anything – I DO NOT hear anything..
    I am able to play other wav/mp3 files using “aplay” command
    Not sure whats going on here. I even re-imaged my raspberry pi2. but fails at the same step..
    Every thing else works just fine.
    ANy help would be appreciated.

    • Henry
      Reply

      Still stuck with the same problem
      help please

    • Anders
      Reply

      Stuck here to has any one got this working lately?
      I do not think this is related to pi 2 been testing with both B+ and pi2 same problem.
      I ran in to the same two problems that seems to be recurring below,

      1. When setting up and validating the keyword it resolve the spoken keyword to jibber jabber signs. This i actually solved by upgrading to a better microphone in my case used plantronics headset.

      2. The second problem being that there is no response i just can’t get it to talk back to me, i did see one thing that i believe is wrong and has to to with google api changing, actually i believe it might be that thy have changed the voice and is no longer available. any way i had a look in the file /usr/bin/tts
      the two wget strings it uses to translate text in to mp3 file does not work if i run them in the console (I changed vars $lang to en and var $temp to Anders testing. running that will not work, but if you have a look at the end of the api call stain there is a variable &client=t (this is atlas what is causing one problem) When i change this to &client=tw-ob and run /usr/bin/tts it works (with a femail voice)

      This is how far i have gotten tales i know that there isn´t any problems with my recording or sound output. but I’m still stuck, has any one gotten this to work recently?

      • Anders
        Reply

        i now have the /usr/bin/speech-recog.sh working it outputs what i say working great, however voicecommand still not working…
        What i did to solve above:
        1. added the -c 1 as mentioned below for /usr/bin/speech-recog.sh
        2. found wrong sound device for me in /usr/bin/speech-recog.sh (mine was set to plughw:1,0 i use plight:0,0
        3. corrected the wget api call to google in /usr/bin/tts find the tow lines doing wget look at the en of each request you will find variable &client=t change that to &client=tw-ob on both lines where the wget is.

        Hopes this helps the people that ones had it working, if anyone has any ide why my voicecommand is still not working let me know :-)

        • Anders
          Reply

          NOW IT WORKS!
          Adding to previous posts, the one thing i now added is strange but.. i might have misunderstood the purpose of !verify in config file, I believed it meant !verify==1 that it should verify, not working so… !verify==0 now everything works for me! hopes it solves it for the rest of you!

          • MAP
            Reply

            hey anders ,
            I can’t find the &client line in my tts file.
            Can you please send me your tts file

          • Kaihai73
            Reply

            When I want to change the verify value it says I do not have the permission to do that. please help!!
            thx in advance

        • Ondra
          Reply

          i can’t write to tts or speech-recog.sh, when i try to save it it says “Can’t open file to write… help please

        • Mohit
          Reply

          After making changes in the two files in the bin folder i.e tts and speech-recog.sh, make it executable. Every time you make changes in any shell script, you need to make it executable. DONT FORGET THAT. To make it executable:
          1. Open terminal
          2. cd /usr/bin
          3. sudo chmod +x tts
          4.sudo chmod +x speech-recog.sh

          This worked for me!! Hope it helps others.

    • Ondra
      Reply

      Maybe its because it is for raspberry pi 1 not pi2, but i don’t know..

    • Mohit Khatri
      Reply

      Tried on Raspberry pi 2. The audio output option can be solved using barry’s solution i.e by adding – c 1 before -t wav -d (in the arecord statement) in the speech-recog.sh file and changing &client=t to &client=tw-ob (for both the wget statements)in the tts.sh file. I still cannot get voicecommand working. speech-recog.sh file works but keyword does not get recognized in voicecommand.

      Please help someone !!

      • Ondra
        Reply

        how to write to the scripts.. when i try it it always says can’t open file to write…

  • Kashidyogesh
    Reply

    Hi, I am using Raspberry Pi B+ model with Logitech WebCam C525. I manage to install the application as mentioned above & able to manually recored and hear the recording by using arecord and aplay. When i use ./Speach.sh it record my voice and I manage to see the text returned by google API however when I run voicecommand -c

    It captures the voice send that to google however it does not show “Found Audio” section. What could be the issue?

  • MikeMustang
    Reply

    I can not seem to get the voice command to respond on a PI2 also…I updated it and tried

    command “arecord -l” to check if your mic/webcam is listed. Then, use the command “arecord -D plughw:1,0 test.wav” to record sound. The sound will be recorded in the file “test.wav”. To listen to it, plug in your headphones to the pi and enter the command “aplay test.wav

    And I hear my voice in my headphones…but i tried
    in a root terminal…

    root@raspberrypi:/home/pi# tts “sorry Dave I am afraid I can not do that”

    and it seems to run but no audio out???

    can anyone please help?

    Thank you

    Mike

  • Jamie
    Reply

    Has anyone got this working for the pi 2? Audio response does not work, but both mic and 3.5mm output jack function fine.

  • Atiroir
    Reply

    Thanks BARRY ! It works !

  • Ken
    Reply

    I’m getting a “scheme missing” error when trying to run wget –no-check-certificate “http://goo.gl/KrwrBa” -O PiAUISuite.tar.gz. Not quite sure why, doesn’t seem like anyone else is having this issue. I’ve tried a few things such as -A with no luck. Any thoughts?

    • swapnil
      Reply

      Go to official blog site of steven hickson’s or his github page.. n install from those methods..

  • Gregory
    Reply

    When I try to run:
    sudo voicecommand -c
    I get a message saying that the config file can’t be found and that voicecommand will create another. I think the problem is that it’s trying to create this file in /root/. The workaround I discovered was the following:
    sudo voicecommand -f /home/Pi/.commands.conf
    This changes the directory that voicecommand searches for the config file. I was wondering if anyone could tell me how to modify voicecommand so that it stops looking in root.

    Also, I’m not getting a response to the command word. I tried Barry’s fix (changing arecord to include “-c 1”), but still no luck. Anyone have any ideas?

    • swapnil
      Reply

      try “voicecommand -c” only without sudo
      fr config file
      “voicecommand -e”
      that would slve your root prb…bt im still having prb to tke the input from mic of webcam

  • Francesco
    Reply

    Audio response does not work on RaspPi2, any suggestion?
    Tnx

    • swapnil
      Reply

      Having the same problem… I have RPi 2 … installed PiAUISuite but..it doesnt seem to take input from my webcam c270 ..but i have checked the mic and it is working perfectly but not taking input for the Suite..

      • strohlama
        Reply

        Same problem here. I don´t get any audio response and tried 3 different microphones which work with arecord. But voicecommand doesn´t recognize any of my commands. When I want to change the keyword, it just recognizes some strange symbols.
        Is this really a RP2 problem?

        • Alun
          Reply

          Same here, mic working properly though. The system takes my commands and executes them, but I’m not getting any sound back. My speaker works fine too for it plays music with “aplay [sound.wav]” so I think it has to be a problem with RPI2 and the app, or perhaps google API sends the result in stereo and the lib just recognizes mono, no idea. However, I found that I can just record whatever answer I want to get, store it into a flash memory or something and run scripts instead just commands, like:

          what’s the time==sudo /home/pi/scripts/time.sh

          time.sh:
          #!/bin/bash
          hour=$(date +”%H”)
          minute=$(date +”%M”)
          second=$(date +”%S”)
          aplay /media/flash/time/$hour.wav
          aplay /media/flash/time/$minute.wav

          Maybe it isn’t the most elegant solution, but for now it works to me. Now I’ll rewrite all my bash into python. I hope it’ll be useful for somebody.

          • swapnil
            Reply

            so your Rpi2 does take voicecommands??
            Im having prb on taking voice commands..How did u do that??Even if my RPi2 takes voice command it wud be better… i wanted to run my python files through it

  • random
    Reply

    Download went great, but when i tried to edit the commands.conf i got a permission denied message. when i try to do it as root then i get into a different file. I don’t know how i got two files, but i don’t know what to do please help.

    • WillemG
      Reply

      try: sudo nano /home/pi/.commands.conf

      • CodingNoob
        Reply

        WillemG Thank you friend! I continued to run into the same issue as random did. This did the trick. Thanks again!

  • barry
    Reply

    Was getting No Translation. After mucking for a day I found out that google speech no longer takes stereo voice files. To fix it you need to update /usr/bin/speech-recog.sh to add -c 1 to the arecord command.
    sudo nano /usr/bin/speech-recog.sh
    change
    arecord -D $hardware -f cd -t wav -d $duration -r 16000 …
    to
    arecord -D $hardware -f cd -c 1 -t wav -d $duration -r 16000 …
    use Ctrl + X to save.
    Hope this helps others as well.

    • Mitch
      Reply

      Thx man!

      • swapnil
        Reply

        Did that worked for you?? mitch?

  • Mitch
    Reply

    Hi

    For a schoolproject we where using this tutorial.
    Everything was working perfect untill a week ago.
    We get “no translation” when we try to use the voice recognition, while it was working perfect with the same hardware.
    We deleted and reinstalled everything already, without any succes.

    Is there a change there was an update we didnt notice or that the google API is down?

    kind regards
    students who need help cause the deadline is coming

    • Hugh
      Reply

      Hi Mitch,

      we have run into the exact same situation. No solution as yet, but like you, I suspect the Google API as nothing else has changed, one day it worked, and then it didn’t. Running voice-recog.sh from the command line produces no translation also.

      If you found a resolution please let me know.

      Thank you,
      Hugh.

      • Mitch
        Reply

        I solved it with Barry his solution!

        Was getting No Translation. After mucking for a day I found out that google speech no longer takes stereo voice files. To fix it you need to update /usr/bin/speech-recog.sh to add -c 1 to the arecord command.
        sudo nano /usr/bin/speech-recog.sh
        change
        arecord -D $hardware -f cd -t wav -d $duration -r 16000 …
        to
        arecord -D $hardware -f cd -c 1 -t wav -d $duration -r 16000 …
        use Ctrl + X to save.
        Hope this helps others as well.

    • Francesco
      Reply

      @Mitch me too!!

      • Mitch
        Reply

        I solved it with Barry his solution!
        Was getting No Translation. After mucking for a day I found out that google speech no longer takes stereo voice files. To fix it you need to update /usr/bin/speech-recog.sh to add -c 1 to the arecord command.
        sudo nano /usr/bin/speech-recog.sh
        change
        arecord -D $hardware -f cd -t wav -d $duration -r 16000 …
        to
        arecord -D $hardware -f cd -c 1 -t wav -d $duration -r 16000 …
        use Ctrl + X to save.
        Hope this helps others as well.

    • swapnil
      Reply

      I probably have the same problem is there any solution found yet?? Im also doing it for a final year project… help pls … deadline coming close

      • Mitch
        Reply

        I solved it with Barry his solution!
        Was getting No Translation. After mucking for a day I found out that google speech no longer takes stereo voice files. To fix it you need to update /usr/bin/speech-recog.sh to add -c 1 to the arecord command.
        sudo nano /usr/bin/speech-recog.sh
        change
        arecord -D $hardware -f cd -t wav -d $duration -r 16000 …
        to
        arecord -D $hardware -f cd -c 1 -t wav -d $duration -r 16000 …
        use Ctrl + X to save.
        Hope this helps others as well.

  • Charles
    Reply

    Having some issues with your voice command program on the raspberry pi, I can hear sounds through the audio jack normally however I cannot hear the sound check when going through the settings in the voice command section. I’ve been looking all over the web and can’t find an answer, any suggestions?

    • WillemG
      Reply

      Hey Charles,

      try this:

      sudo raspi-config
      9 Advanced options -> A9 Audio -> 1 Force 3.5 mm..

      I hope for you this works!

  • Ahmed
    Reply

    Hello, great tutorial !! But i’m kind of stuck. I don’t get a response when i voice out the keyword. There is nothing wrong with the hardware i’ve checked everything. Could you please help me !

  • Amber
    Reply

    Hi there. Thanks for this article, very interesting. Quick question: Is there voice recognition software that will actually differentiate voices? For instance, if I commanded my computer or iphone to open a file it would work, but if my mom or someone else tried to command my iphone or my computer it wouldn’t work. Thanks!

  • sara
    Reply

    Hi, Is there another software that works offline and written in C?

  • ............
    Reply

    I need to make a hmd but i installed a lcd driver image on my rpi,now i need to install jasper on it is it possible these two drive work on it

  • LK
    Reply

    I Love this program and Love the way you step by step elaborate it.
    I am doing this project as a TERM Project for my Grad degree.
    I am facing problem with COMMAND FILE … i am not able to edit through (voicecommand -e) by pressing (CTRL+O) it says [ERROR……………..Permission Denied]
    HELP MEE

  • LK
    Reply

    Not Love this program and Love the way you step step elaborate it.
    I am doing this project as a TERM Project for my Grad degree.
    I am facing problem with COMMAND FILE … i am not able to edit through (voicecommand -e) by pressing (CTRL+O) it says [ERROR……………..Permission Denied]
    HELP MEE

    • WillemG
      Reply

      sudo nano /home/pi/.commands.conf

  • Timmy
    Reply

    The best fitting mic i found is http://www.yoga.com.tw/en/2_2000_39711/product/Computer_microphone_EM_7U_id320243.html and it works like a charm.

    Now my only problem is that i use a tellstick duo to turn my lights on, this is on another raspberry pi so what i want to do is make like 4 raspberry pi with speakers and mic be able to control the 1 pi that controls the lights.

    then i can have 1 pi in each room with the steven hickson voicecommand to listen to musik in just that room or everywhere and i can turn on and off lights in all my house from all the rooms just by talking to the pi.

    Is there a good guide for the system with many Pi using 1 pi as a control unit for the lights?

  • trio apriandi
    Reply

    i have been install my sd card with voicecommand.image by steven, is it can works directly ? and will all usb microphone working in raspi or there is some microphone not working well in rasapi ?

  • Mon
    Reply

    Hi, great post. I will be trying your setup. If you have any new additions please add it in your posts. Also, for the public can you share how you’ve been using voice home automation?

  • Tom
    Reply

    Hi, thank you for the tutorial.
    I recently backed the udoo neo on kickstarter (http://udoo.org/udoo-neo/).
    Would this tutorial work on the neo running linux?
    Thanks in advance

    • Arvind Sanjeev
      Reply

      I believe so.

  • Aleman
    Reply

    Hello, first of all congrats. excellent work. I have a question, doest it works with raspberry pi 2 model?

    • Arvind Sanjeev
      Reply

      It should work, havent tried though. Please let me know if you are able to test it out.

  • Manjunath
    Reply

    Hello Sir ,
    This is a Great Work.
    I’m having difficulties modifying the command configuration file. When i tried to edit something on it, it says Permission denied.

    • Arvind Sanjeev
      Reply

      Try using sudo or editing the file: voicecommands.conf

      • Manjunath
        Reply

        Thanks,
        Using sudo, I was able to edit the config file. When i play videos using voice commands , i’m not able to hear any audio, while i’m able to hear audio using omxplayer commands manually.
        How can i add a voice command to open a .jpg image?

      • Manjunath
        Reply

        Hello,
        I installed sylpheed and trying it to open using voice commands but it isn’t opening. It says command not found.
        I command which i added in config file was Mail==Sylpheed.
        Please reply asap.
        Thank u :)

        • Arvind Sanjeev
          Reply

          Can you open sylpheed using the terminal by entering the same command: sylpheed ?

          • Manjunath
            Reply

            Hello again, Thank u for replying :)
            The voice command which i added is Mail==Sylpheed.
            The error i got was
            command:Sylpheed
            sh: 1:Sylpheed:not found
            I’m not able open sylpheed using the same command in terminal.
            Please reply asap.
            Thank you :D

            • Arvind Sanjeev
              Reply

              Try using lower case letters: “sylpheed” and not “Sylpheed”. And make sure you installed sylpheed correctly, try re installing too.

              • Manjunath
                Reply

                Hello,
                I am now able to open mail,images,videos using voice commands.
                Can u tell me some games which i can open using voice.
                One More thing Sir,
                When i play videos using voice commands , i’m not able to hear any audio, while i’m able to hear audio using omxplayer commands manually. Please reply asap.
                Thanks a lot :D

  • Manjeep
    Reply

    Hello Sir, It is a great work u’re doing. Really Inspirational.
    In the voice configuration file we are not able to add our own commands. Also do I add a command to play Video from SD card and how to access Google using voice. Thank u :)

    • Arvind Sanjeev
      Reply

      Thanks you Manjeep, you can try editing the file called voicecommands.conf to include your own commands. And to play videos use omxplayer command from the terminal.

  • fehmi
    Reply

    hello i am intereset in voice ahthentifaction and not recognition
    i wana make a door open by a secret phrase genre abracabra but only me with the correct sentence i allowed to open the door and not any one who knows the sentence

    • Arvind Sanjeev
      Reply

      Search for the vrbot voice module. It should satisfy your needs.

  • Justin Foss
    Reply

    Thanks a ton for the awesome tutorial. Since you seem to be the current guru on this and it seems like Steve Hickson is pretty busy, I was curious if you know of an easy way to change the response from a text-to-speech response into a sound. For example, when I say the keyword, I want it to play a chime sound rather than use text to speech. Currently I can’t figure out a way to do this other than editing some of the scripts that the project was built on, but before I potentially break anything I wanted to see if there is an easier way. Thanks!

    • Arvind Sanjeev
      Reply

      Hi Justin,
      I think you can edit the voicecommand -e file to add a command which plays a sound file, maybe using omxplayer when it gets triggered. This is only if you dont want to mess with the original project files.

  • Ganesh
    Reply

    Is there a way where voicecommand can recognize voice without internet connection atleast some saved voice formats?

    • Arvind Sanjeev
      Reply

      Check out the jasper voice recognition system given in the beginning of this tutorial.

  • Apreza
    Reply

    Hi, this article is interesting. Can I combine this software recognition for OSMC? If that possible, which software that i must choose? Thanks :)

  • Kumar
    Reply

    Hi,

    I’m new to raspberry pi programming. I’m intrested in home automation based on voice. I need to know that if i set a keyword “turn on light” as “11”. I need to send that word(11) to a remote server using TCP/UDP protocol.

    Can you help me out how can i do that

  • Anand Krishnan
    Reply

    But i tried the command
    export DISPLAY=:0.0
    then it opened midrori directly from ssh.

  • Anand Krishnan
    Reply

    I got an error when executed this command.
    command: google android
    Midori – Cannot open display:

    Is it because of new LCD display ? How to activate display ?I connected display through GPIO and accesed pi using ssh through a Laptop in ubuntu.But i got this error.

    • Arvind Sanjeev
      Reply

      You cannot open midori from SSH as its a GUI interface, you have to do it directly on the pi.

  • Robert
    Reply

    For those who want to use GPIO pins from motion here is a hint ;)

    sudo visudo
    add the following line.
    motion ALL=(ALL) NOPASSWD: ALL

    and yeah it will be able to use root acces. Another hint don’t use on_motion_detected. But use on_movie_start sudo python /home/pi/pirmail.py
    this is just an example. also make sure you build in a delay in the python file. or you will get many emails ;)

    Rgds,
    Robert.

  • Robert
    Reply

    Just delete the last blank lines from your config file. all will work fine

  • Dattaraj Sansgiri
    Reply

    I am using Logitech C310 webcam, the arecord and aplay results in the expected results, but when i use voicecommand, i get the following results,
    Opening config file…
    You have a formatting error on line 35 of your config file. I’m ignoring that line
    Not querying for answers
    running in continuous mode
    verifying command as well
    keyword duration is 2 and duration is 3

    • Arvind Sanjeev
      Reply

      That’s okay, what happens during the rest of the process?

      • Dattaraj Sansgiri
        Reply

        Thankyou for the reply

        I got the “voicecommand -c” to work, though i am unable to edit command list as i get “Permission Denied” when i type “voicecommand -e” and edit a command.

  • Scott Pickering
    Reply

    Whenever I run the speech recognition script, i get a warning saying could not read data from file “/dev/shm/out.flac” this makes an empty. How do I resolve this? Also, the keyword is not recognised when running continuously :/

  • Scott Pickering
    Reply

    I’m using the B+ but everything seems to have worked perfectly fine except for one thing. After installing the voicecommand script, the terminal said “No commands found, using default”, It then failed to set itself up, saying that there was no such file or directory as “libboost_regex.so.1.49.0”. Would this be anything to do with the fact that I haven’t yet plugged in a microphone?

    • Arvind Sanjeev
      Reply

      You can use a webcam with a built in mic as the microphone or a USB mic. You have to have the mic while setting it up initially, also you can try installing libboost: sudo apt-get install libboost-regex1.49.0

      • Scott Pickering
        Reply

        Brilliant, thanks for your help :)

  • Robert vd Berg
    Reply

    Thanks. Youtube issue fixed.

    Rgds,
    Robert.

  • Robert vd Berg
    Reply

    Hi, thanks for your tutorial.

    I was wondering is voicecommand writing the recorded audio to the sd card ? If so that would create SD corruption.

    Secondly can’t get youtube to work. Perhaps a script error ?

    Rgds,
    Robert.

    • Arvind Sanjeev
      Reply

      It records and deletes the audio. Also, you need to install some other tools to get youtube working. Try searching for: watch youtube on raspberry pi.

  • Ramu
    Reply

    Thanks for the reply. i made it to work with usb micnow
    but now i am facing another issue.
    is it possible to play the output via 3.5 jack speaker :(

    • Derek
      Reply

      Should automatically play audio out over the 3.5 mm Jack unless you have an hdmi plugged in.
      The 3.5 is audio out only ( the reason there is no mic capability in this port and must be done over usb)

    • Arvind Sanjeev
      Reply

      Definitely, why cant you?

  • Steven
    Reply

    Hi, I try to install the software, however, something is missing after finish your commends. Do you have a cure? Thanks

  • Ramu
    Reply

    Hello Arvind

    Nice tutorial, small help from you
    Is it possible to use normal headphone mic instead of webcam mic
    if S please tell me what is the script changes i have to do :)

    BR
    Ramukumar M

    • Arvind Sanjeev
      Reply

      Hello Ramu, unfortunately you have to use a USB mic, normal headphones wont work as the Pi needs to take the input via a sound card.

  • Derek
    Reply

    UPDATE!
    FIXED:
    “arecord: main:682: audio open error: No such file or directory”

    I started over on one of my other pi’s at work using a web cam/mic and everything seams to work perfect.

    I noticed that the recording quality was significantly better using this mic than my headset so this may have been the issue or it may still have been the mics wireless dongle interface. In any case I would deduce that it was an issue with the playback/capture device and not any of the software, for anyone else with this issue.

    Also the pi I am using still “boots” from USB so that has no play in the functionality (just fyi b/c of my last post)

    Thank you Arvind!

  • Derek
    Reply

    Did sudo apt-get update and reinstall, still same problem.
    So I created the out.flac file and this removed the “could not remove out.flac” error, but only for a single run (since it did indeed remove the out.flac file… so that works lol)

    so the only error that remained was:
    arecord: main:682: audio open error: No such file or directory

    It may be worth noting that I “boot” my pi from USB flash drive so maybe that has something to do with this, I am going to try using a different mic also since mine is an advanced wireless gaming headset even though it works fine with arecord, who knows

    thanks for your help I love what your doing!

    • Arvind Sanjeev
      Reply

      Thanks a lot Derek, also for the audio open error, try to kill the process: arecord using sudo kill :)

  • Jonatan Persson
    Reply

    Hi Arvind, great job with the tutorial. I have some problem thoug. When I run the install.sh I get this error with my microphone trying saying the keyword Sam: Now say that keyword
    ALSA lib pcm_hw.c:1401:(_snd_pcm_hw_open) Invalid value for card
    arecord: main:682: audio open error: No such device
    Warning: Couldn’t read data from file “/dev/shm/out.flac”, this makes an empty
    Warning: POST.
    % Total % Received % Xferd Average Speed Time Time Time Current
    Dload Upload Total Spent Left Speed
    100 14 0 14 0 0 22 0 –:–:– –:–:– –:–:– 43
    rm: cannot remove `/dev/shm/out.flac’: No such file or directory
    I got ��߶, which was different than what you typed: Sam

    The mic works when I make a test.wav and aplay. I have also increased the volume on the mic.

    Do you have any suggestions how to fix this? Thanks in advance.

    //Jonatan

    • Arvind Sanjeev
      Reply

      Did you try running the speech-recog.sh program? Does it return the correct speech to text values? Also, try running a sudo apt-get update, just in case and run the install again. Then try creating a empty text file called “out.flac” in the directory: /dev/shm if it still doesn’t work.

  • suryakant
    Reply

    Thanks for the tutorial.

  • Derek
    Reply

    I still get the same issue
    http://i60.tinypic.com/2wm0v86.png

    here is a screen shot
    I started from the beginning of the tutorial like you suggested

    • Arvind Sanjeev
      Reply

      Did you ever do the: sudo apt-get update , lately on the pi? Try doing this and then installing the software again, i.e., from step 2: cd /PiAUISuite/Install and sudo ./InstallAUISuite.sh
      If that fails too, try creating an empty text file named out.flac in the directory: /dev/shm

  • Bram
    Reply

    Hi Arvind,

    Thanks for the quick reply!

    I’m using a Logitech C170 webcam with integrated mic. When making a test recording using arecordand playing it with aplay the volume seems to be fine. Opening ALSA gives me no further options displaying that “This sound device does not have any controls”. I’ll try another mic though.

    Do I have to create a file in/usr/bin ? What should the extension of this file be?

    Another question, when running voicecommand in continuous mode it seems that the mic goes to sleep after some time. Is there any setting for that that you know of?

  • Derek
    Reply

    I’ve been having the same problem as these guys when running ./speech-recog.sh
    I get
    Warning: Couldn’t read data from file “/dev/shm/out.flac”, this makes an empty
    Warning: POST

    rm: cannot remove ‘/dev/shm/out.flac’: No such file or directory

    has there been any enlightenment on this subject?

  • Bram
    Reply

    Hi Arvind,

    First of all, thank you for sharing this project, realy cool! I’ve set up voicecommand on a raspi B using a USB webcam with built in mic.

    The system only sometimes responses to my keyword ‘James’, but that’s only in like 10% of my tries. During the configuration set-up it suggested to change the treshtime to 8.4 seconds, which seems a long time for me. Do you think it might have something to do with this setting?

    Another question, I’ve added a line in de config file saying: kitchen on==/root/RaspberryPi/voicecontrol2/barlights_on.sh
    since I would like to use voicecommands for the control of my home automation system. When the system does respond to the keyword and I say “Kitchen on” it’s replies it received an inproper command, only displaying the word kitchen on the screen. Do you have a clue on how to fix this? Looking forward to your answer.

    • Arvind Sanjeev
      Reply

      Hi Bram,
      The accuracy might be low maybe because of your mic. Did you check the voice levels using ALSA like in the tutorial? Also try using a different webcam.
      And for adding a new command, you have to create a bash command for it. Go to /usr/bin and add a bash command there: barlights_on. After that, put that command like this: kitchen on == barlights_on

  • dennis
    Reply

    Thanks for the tutorial. I went through all the steps but when I go to test it using ./speech-recog.sh I get: Warning: couldnt read data from “/dev/shm/out.flac” this makes an empty POST. Then it prints some statistics, then: rm: cannot remove `/dev/shm/out.flac’: no such file or directory. cd’ing to this directory shows there is no out.flac. I tested my input and outputs successfully in the beginning. Any help is appreciated. Thanks

  • Abhishek
    Reply

    Doesn’t help in this case!

    • Arvind Sanjeev
      Reply

      After rebooting, run the: ps -a command and check the running processes and share them with me here. Then try the voicecommand using sudo too, if its giving the same error, I will check the data and let you know.

  • Abhishek
    Reply

    Hi,

    I am getting same error as Michel, his change does not help me.
    Speech command worked first time but now it’s not working.

    Output:
    pi@raspberrypi ~/PiAUISuite/VoiceCommand $ ./speech-recog.sh
    arecord: main:682: audio open error: Device or resource busy
    Warning: Couldn’t read data from file “/dev/shm/out.flac”, this makes an empty
    Warning: POST.
    % Total % Received % Xferd Average Speed Time Time Time Current
    Dload Upload Total Spent Left Speed
    100 14 0 14 0 0 62 0 –:–:– –:–:– –:–:– 79
    rm: cannot remove `/dev/shm/out.flac’: No such file or directory

  • Moonhyunkoo
    Reply

    Thank you for your help.
    Is it possible to send the voice to the internet in real time?

    • Arvind Sanjeev
      Reply

      Sure, I guess you can probably use a Skype API for this? What are you trying to build using that?

  • ahmed
    Reply

    i have a problem when i call youtube or google ,, i get an error, but everything else works fine

  • Abhishek
    Reply

    I want to understand, why it doesn’t work with audio jack with inbuilt microphone? Why only usb microphone is required.

    Pi is a minicomputer with all the functionality of standard computer, only difference is configuration, then why audio jack inbuilt microphone doesn’t work?

    • Arvind Sanjeev
      Reply

      The pi does not have the necessary hardware drivers to support the mic from the headphone, only USB mics are supported. Perhaps adding the additional hardware would make it more bulky, hence they chose not to do it.

  • Evert-Job
    Reply

    Hi,

    How can we start the script on boot if we are using a raspberry pi with n00b?

    Thanks you!

  • Akash Athale
    Reply

    Hi, Just wanted to know, that will this program work on other boards like Auduino and STM32 if we write the commands in command prompt on Ubuntu 14.04

  • ahmed
    Reply

    i got a webcam but when i open alsamixer and i press F6 to select my webcam the graphical volume interface disappears and i get this intead: (This sound device does not have controls).
    and when i record my voice and i play it back i just hear noise and my voice is not clear.

    what could be the problem, thanks :)

    • Arvind Sanjeev
      Reply

      Which webcam are you using? Try using a different USB webcam.

  • Kinam
    Reply

    oh i am sorry this error is for voicecommand -c

    voicecommand -s is working fine!
    Plz reply ASAP

    • Arvind Sanjeev
      Reply

      Can you send me the screenshot of the entire response from the terminal? And also, please try re installing the software meanwhile.

  • Kinam
    Reply

    Hey Arvind, your help has been precious to me..

    this time really stucked.. Plz reply ASAP

    voicecommand -s

    Opening config file…
    You have a formatting error on line 35 of your config file. I’m ignoring that line
    Not querying for answers

    not responding to pi.. i have seen alsamixer volume and comments above of michael is not helpful
    plz help

  • Kinam
    Reply

    Hi Arvind,

    voicecommand:error while loading shared libraries libboost_regex.so.1.49.0:cannot open shared object file:No such file or directory”

    This is the exact error while running voicecommand.

    Arvind Plz plz help..

    • Arvind Sanjeev
      Reply

      Kinam, why don’t you try installing libboost: sudo apt-get install libboost-regex1.49.0

  • Kinam
    Reply

    Hey Arvind I have installed PIAUIsiute
    i am getting error after running command “voicecommand”
    error is permission denied
    I have tried using
    sudo voicecommand
    error:command not found

    i tried chmod 777 voicecommand
    the command runs
    and then when i run voicecommand
    same error permission denied!
    Plz help

    • Arvind Sanjeev
      Reply

      Hello Kinam,
      The correct usage is voicecommand -c , for starting the software and voicecommand -e for editing the commands. Try this and let me know what happens.

  • Akshay
    Reply

    google android still doesnt work for me inspite of changing it to google.co.in and that too for midori… The google homepage just opens up…

    • Arvind Sanjeev
      Reply

      Hello Akshay,
      There was a problem with the google file inside /PiAUISuite/VoiceCommand. Please replace the code inside “google” file there with this code and also do the same for the “google” file in /usr/bin:
      #!/bin/bash

      for var in “$@”
      do
      if [ -z $search_string ] ; then
      search_string=”http://www.google.com/search?q=$var”
      else
      search_string=”$search_string+$var”
      fi
      done

      midori -a “$search_string”

  • Jack
    Reply

    I am using a B+, which uses Epiphany web browser, I also have chromium installed. How do I change the command to use chromium instead of midori as it does not come with the B+….thanks…

  • Anand Krishnan
    Reply

    I got an error when i said ” youtube android ” :

    command: youtube-search android
    youtube-search: error while loading shared libraries: libboost_regex.so.1.46.1: cannot open shared object file: No such file or directory

  • Enric
    Reply

    I found it! I was waiting to much to say the keyword. All works fine!

  • Jurgen
    Reply

    What do you mean by “compiled cpp program”? Did you mean that it cannot be recompiled if I make changes to the voicecommand.cpp file?
    Also, how exactly did you recompiled? I am asking because I want to make slight changes to the voicecommand.cpp to fit my specific need.
    Thank you.

    • Arvind Sanjeev
      Reply

      I can comment on it if you could help me understand what kind of changes are you trying to make?

  • Enric
    Reply

    Hi All, VoiceCommand looks great but I’m finding some problems. Probably you can help setting it up.

    I’m using a Raspberry pi B+ and a Kinobo Mic. The mic record fine with record and I can play the record correctly with aplay.

    The problem appears when setting up Voicecommand via voicecommand-s so when trying to change the keyword the response is the following: I got ??ݶ, which was different than what you typed: Roll

    I wonder if someone solved this problem or knows how to solve it.

    Regards!

  • Anand Krishnan
    Reply

    In the file google search worked correctly when i changed “search_string=”https://www.google.com/….” to “search_string=”https://www.google.co.in/…”.But when i changed midori to firefox only google and google map is coming.Search is not working.What will be the reason ?

    • Arvind Sanjeev
      Reply

      I haven’t tried testing it on firefox, the command is meant for midori.

  • Anand Krishnan
    Reply

    Navigation command is executing successfully.
    #!/bin/bash

    for var in “$@”
    do
    if [ -z $search_string ] ; then
    search_string=”https://www.google.com/#hl=en&safe=off&output=search&q=$var”
    else
    search_string=”$search_string+$var”
    fi
    done

    midori -a “$search_string”

  • Anand Krishnan
    Reply

    Still only google is coming on midori browser.What is the problem ?

    • Arvind Sanjeev
      Reply

      What about the navigation command? Is it working? And please paste the code for the google file inside /PiAUISuite/VoiceCommand

    • Arvind Sanjeev
      Reply

      There was a problem with the google file inside /PiAUISuite/VoiceCommand. Please replace the code inside “google” file there with this code and also do the same for the “google” file in /usr/bin:
      #!/bin/bash

      for var in “$@”
      do
      if [ -z $search_string ] ; then
      search_string=”http://www.google.com/search?q=$var”
      else
      search_string=”$search_string+$var”
      fi
      done

      midori -a “$search_string”

  • Oscar Murray
    Reply

    Hi, thanks for this tutorial, i have downloaded and installed voicecommand and it does work for the bash commands already programmed but when I try to add new commands they don’t seem to work. I’m trying to get a word to control the Pi cam to capture a photo I’m adding the following line to my config file

    Cheese==raspistill -o filename.jpg

    any help please?

    • Arvind Sanjeev
      Reply

      Hi Oscar, where have you tried to add this command? Try adding it in the commands.conf file inside: PiAUISuite/VoiceCommand

  • Anand Krishnan
    Reply

    Now command is working.But only google is coming.Map is not opening.I have same problem in google command also.When i said “google android” only google is coming.Android is not searching like navigation problem.

    • Arvind Sanjeev
      Reply

      Try entering the command “google android” on your terminal, what is the result you get?

  • Anand Krishnan
    Reply

    No it’s not working :

    anand@anand-desktop:~$ navigation
    bash: /usr/bin/navigation: Permission denied

    • Arvind Sanjeev
      Reply

      Use “sudo” with the command. And change the permissions to the navigation file. Use chmod 777 navigation and chown to do this.

  • Jack
    Reply

    Hey,

    So my Microphone works fine, i recorded myself talking and played it back using the arecord.

    I then use the command voicecommand – c.

    I get the same results as you, except this error…

    curl: (6) Couldnt resolve host ‘www.google.com’

    I set the keyword to Sam but when i say it, or anything, i get no response. I have unchecked the # from the config file.

    Any help would me much appreciated,

    Jack

    • Arvind Sanjeev
      Reply

      Are you sure your pi is connected to the internet? Looks like it is not able to access Google.

  • Anand Krishnan
    Reply

    This is the link of screenshot.I wnat that particular link “https://www.google.co.in/maps?q=_?????_____”
    What is the code after = sign ?

    https://drive.google.com/file/d/0B3IAKQwKVS8AM1hydmg4ZXNRcGs/view?usp=sharing

    https://drive.google.com/file/d/0B3IAKQwKVS8ANlVxc0F4cDVOQzQ/view?usp=sharing

    • Arvind Sanjeev
      Reply

      You have to do the following steps in order to create a custom command:
      1.In the commands.conf file, write a new line: navigation== navigation …
      2.Create a new file called: navigation ,inside the VoiceCommand folder.
      3.Paste the following contents in this link into that text file: http://diyhacking.com/projects/navigation and save the file
      4.Copy the navigation file and paste it in : /usr/bin
      5.Test by entering the navigation command in terminal

  • Anand Krishnan
    Reply

    Will the project works without a mouse ?Because if we open an application or anything from the terminal by voice recogntion we need a device to close the window (Mouse or Keyboard) to come back to terminal window again.So how it is possible without a mouse or Keyboard ?

  • Anand Krishnan
    Reply

    I have a doubt about navigation link also.What’s the command you added on config file for navigation ?Navigation==xdg-open “https://maps.google.co.in/maps?q=$”
    Is it this ?
    But when i say navigation cochin it shows unexpected argument cochin.What’s the reason ?

  • Anand Krishnan
    Reply

    Ok it’s ready.But when i executing voicecommand -c it shows :
    “running in quiet mode
    Not querying for answers
    running in continuous mode
    verifying command as well
    keyword duration is 2 and duration is 3”
    When i say the keyword the response is not hearing.But command is working if i Sam it shows found audio but i can’t hear the response.Is it because of the quiet mode ?How to remove quiet mode ?

  • Chan Hou Jing
    Reply

    Found audio
    Recording WAVE ‘stdin’:Signed 16bit Little Endian, Rate 16000Hz, Stereo

    after i say pi and response to me by saying yes sir, then raspberry not able to capture my comment, it just stuck at there, what is the problem of it….?

    • Arvind Sanjeev
      Reply

      Try waiting for sometime after it responds, view the terminal to see when it starts listening again. You will notice that the pi takes some time to start listening again after it responds with “yes sir”.

  • Anand Krishnan
    Reply

    I am using b+ board.The software developed by Steven hickson is not available to download.So how i do voice recognition in b+ board ?Please help.

  • Suraj
    Reply

    I tried installing it on ubuntu and i’m gettin an error like this:

    ALSA lib pcm_hw.c:1667:(_snd_pcm_hw_open) Invalid value for card

    Any help?

    Thank u

    • Arvind Sanjeev
      Reply

      Hello Suraj, this code was meant for the Raspbian OS, I never tested it on Ubuntu.

  • Jack
    Reply

    Hi, Amazing work!
    I was just wondering, would it be possible to use the speech software to take a photo with the camera? or record and save speech from the microphone?

    • Arvind Sanjeev
      Reply

      Yes, you definitely can. Please check the arecord function in this tutorial for recording audio.

  • Michel
    Reply

    Yes, however there’s no voicecommand script. Voicecommand is a compiled cpp program. I changed the code to -f U8 and recompiled. No luck though. I’ll keep digging. Maybe I’ll just try to find another mic. Thanks anyway.

  • michel
    Reply

    Hi again. If I change one of the parms of arecord in speech-recog.sh, -f cd to -f U8, it seems to work. But would this also be the problem in the voicecommand as well?

    Thanks again.

    • Arvind Sanjeev
      Reply

      If adding that solved the problem and your acrecord and play is working fine too, you should add the same command to the voicecommand script as well. Let me know how it goes.

  • michel
    Reply

    Hi, I checked USB mic through arecord and aplay and it works fine. When I try the test I get:
    pi@raspberrypi ~/PiAUISuite/VoiceCommand $ ./speech-recog.sh
    Recording WAVE ‘stdin’ : Signed 16 bit Little Endian, Rate 16000 Hz, Stereo
    arecord: set_params:1145: Unable to install hw params:
    …….
    Warning: Couldn’t read data from file “/dev/shm/out.flac”, this makes an empty
    Warning: POST.

    Running the voicecommand -c, there’s no response to “pi”. The error line it detects is the end of file, a line that does not contain anything. See below. Any ideas? Thx in advance.

    Opening config file…
    You have a formatting error on line 35 of your config file. I’m ignoring that line
    Not querying for answers
    running in continuous mode
    verifying command as well
    keyword duration is 2 and duration is 3

  • Randa
    Reply

    please i need your help,so email me; i will be thankful :)

  • BBrasil
    Reply

    HI, IS THERE ANY PROJECT THAT RECOGNITION THAT MAKE OFFLINE

    • Arvind Sanjeev
      Reply

      The jasper project does offline voice recognition. Check out the link for jasper, in the article.

  • Anish barot
    Reply

    when i run voicecommand -c nothing is happen. the result is
    “Opening config file…
    running in continues mode
    keyword duration is 2 and duration is 3

    than when i say my keyword. nothing happen. i have to forcefully stop the execution. what i have to do ? :(

    • Arvind Sanjeev
      Reply

      Did you check your USB mic through arecord and aplay? You should also increase your mic volume through alsamixer.

      • Anish barot
        Reply

        Hello, Thnx a lot, actually the capture volume was 0. so i increased mic volume :)

  • Arghaya
    Reply

    Hi, great work there , I was trying out the voice recognition software on my ubuntu using a headphone with mic (the 3.5mm jack port ). I tested arecord with plughw:0,0 test.wav (0,0 ) configuration to detect the mic and it worked , but on changing voicecommand -e file hardware to plughw:0,0 it is unable to record voice command. Any help will be appreciated.

    • Arvind Sanjeev
      Reply

      Hello, I personally don’t think that hooking a mic through the audio jack will work. It is always recommended to use a USB microphone or a USB webcam with an inbuilt mic.

  • Anand Krishnan
    Reply

    Wonderful project cheta ee project nirmikkan sahayikumo ??? i am really interested to do it as project this year.Please.

  • Ricardo
    Reply

    Hey that’s a great job congratulations. Do you know how can i change the language to seid the commands in spanish?

    • Arvind Sanjeev
      Reply

      Thanks a lot, I don’t know if the Google voice API supports that, but you could try (y)

  • John
    Reply

    very nice your project and hard work. thanks and very useful for those information

  • Akhil
    Reply

    Awesome tut (y) .

pingbacks / trackbacks

Leave a Comment

5 + 3 =

Start typing and press Enter to search