Saturday, June 29, 2013

Voice Command v3.0 for the Raspberry Pi

Voicecommand v3.0 Changes

I've made some big changes and their are even bigger things in the works. Here is a small list. I've had some help from a couple of committed users who have come up with some new good ideas which is awesome.

  • There is now a ~ option that finds the word anywhere in a command. For instance ~music==pianobar will work if you say: let's hear some music, play music, or music.
  • !filler is now a string so you can set it manually. If you put it to 0, it will be empty and if you put it to 1, it will be FILLER FILL for compatibility issues.
  • Example scripts have been added in the Misc folder for you to play with. These can send and receive emails and text messages as well as posting to facebook; all using only your voice.
  • Flags can now overwrite the config options and can be reversed by following them with a 0 or enforced if followed with a 1. Ex. if !continuous==1 in your config file, you can force it to run only once with voicecommand -c0
  • The commands and keywords are now case insensitive. So no tricky case matching.
  • Multiple language support has been added. This is based on your country code which I think you can find here (plus en_uk and en_us). Look up your country code and use that. Ex. For US: !language==en_us, for Spain !language==es, for Germany !language==de.
  • You can set a Wolfram Alpha API and maxResponse (the number of branches) like !api==XXXXXX-XXXXXXXXXX and !maxResponse==3. This will give you better answers. You can sign up for a Wolfram Alpha API on their website for free.
  • Logging has been enabled into /dev/shm/voice.log. It throws stuff to this instead of /dev/null
  • The need for tts-nofill has been removed!! Now tts doesn't use any filler unless you send it yourself.

New Install and Update videos have been added. They can be found here:

Consider donating to further my tinkering since I do all this and help people out for free.
Places you can find me
As always, the updated man page can be found below:


Section: voicecommand man page (8)
Updated: 13 May 2013


voicecommand - Listen to user defined strings and run the corresponding command   


voicecommand [OPTIONS]...  


voicecommand was developed for the Raspberry Pi but will work on any linux system with a microphone attached. It is a crude program, which uses basic comparisons to determine if your voicecommand fits a format specified in a config file; it it does, it runs the corresponding linux command. It supports auto-completion and variables as well as command verification, a continuous mode, and other options. For help/comments/questions, feel free to e-mail me at I answer sporadically but do eventually respond.

Note: All of the flags that turn something on are off can be reversed and overwritten by following it with a 1 or 0. So for instance if you have !continuous==1 in your config file, you can run voicecommand -c0 to turn continuous off.


Same as -h
Turns off the FILL audio. The purpose of this was because the Raspbery Pi (or mine at least) cuts off the first few seconds of audio. This flag turns that feature off. You should only be concerned with this if you hear FILL before everything it says.
Makes voicecommand run in continuous mode, where it will keep listening over and over again.
Sets the duration for listening to the audio for voice commands
Sets the audio hardware. The default is plughw:1,0 -
Edits the voicecommand config file.
The format is voice==command
You can use any character except for newlines or ==
If the voice starts with ~, the program looks for the keyword anywhere. Ex: ~weather would pick up on weather or what's the weather
You can use ... at the end of the command to specify that everything after the given keyword should be options to the command.
Ex: play==playvideo ...
This means that if you say "play Futurama", it will run the command playvideo Futurama
You can use $# (where # is any number 1 to 9) to represent a variable. These should go in order from 1 to 9
Ex: $1 season $2 episode $3==playvideo -s $2 -e $3 $1
This means if you say game of thrones season 1 episode 2, it will run playvideo with the -s flag as 1, the -e flag as 2, and the main argument as game of thrones, i.e. playvideo -s 1 -e 2 game of thrones
Because of these options, it is important that the arguments range from most strict to least strict.
This means that ~ arguments should probably be at the end.
You can also put comments if the line starts with # and special options if the line starts with a !
Default options are shown as follows:
api==BLANK,!filler==FILLER FILL,!response==Yes Sir?,!duration==3,!com_dur==2,!hardware==plughw:1,0,!language==en_us
Keyword, filler, and response accept strings. verify, continuous, quiet, and ignore except 1 or 0 (true or false respectively). thresh excepts a floating point number. These allow you to set some of the flags as permanent options (If these are set, you can overwrite them with the flag options).
You can set a WolframAlpha API and maxResponse (the number of branches) like !api==XXXXXX-XXXXXXXXXX amd !maxResponse==3
You can now customize the language support for speech recognition and some text to speech with the language flag. Look up your country code and use that. Ex. For US: !language==en_us, for Spain !language==es, for Germany !language==de.
-f /my-location/config-file
This allows you to load a different config file located in a different spot. The default one is in your home directory and is ~/.commands.conf
The config file must be formatted the same way.
Shows this man page.
Sets the ignore mode. When this flag is activated, if a command is not in the config file, nothing happens. The default behavior is to try to find an answer or response to that question and then speak it. This turns off that behavior.
-I string
Sets the forced input mode. This allows you to test it without the microphone or get it to parse typed information. It will not run in continuous mode with this.
-k word
Sets the keyword. The default is pi. If this flag is set, the verify and continuous flags are also set since this is only checked during those two modes.
      Ex. voicecommand -c -v -k Jarvis

Sets the duration for listening to the audio for the command keyword. This is different than the -d flag that listens for the voice commands.
Runs a setup operation that attempts to set all of the config options in the config file so that voicecommand works properly
-r word
Sets the response. The default is "Yes Sir?" (For version 1.0, it was Ready?. If this response is more than one word, it should be put in quotes, otherwise it doesn't need to be
      Ex. voicecommand -r Ready?

-t #
Sets the threshold for volume to determine if the keyword was spoken. This should be a floating point number. The default value is 0.7 which works well with the Logitech C310 camera/mic from about 6 feet away.
Ex. voicecommand -t 1.2
Sets passthrough mode on so that instead of running the commands, it just prints them. This is going to be used for the XBMC plugin and Android app.
Sets quiet mode on so that voicecommand never speaks through the audio output. It still prints everything but doesn't ever respond. This includes the keyword response.
Makes voicecommand verify the keyword. This only happens in continuous mode so if this flag is set, the continuous flag will be set as well. The default mode is to not verify. When voicecommand hears any sound above the threshold, it says the response then listens for a command. The default keyword is pi. When the verify flag is set, after the threshold is met, voicecommand verifies that the keyword was spoken.


Steven Hickson (  


No known bugs. To report bugs, send a clear description to Since this program is fairly crude, user typos could cause crashes/failed responses. Please read the man page thoroughly before submitting a bug.  


Copyright © 2013 Steven Hickson. License GPLv3+: GNU GPL version 3 or later <>. This is free software: you are free to change and redistribute it as long as you give credit to the author and include this license. There is NO WARRANTY, to the extent permitted by law.  


This is the second major version of this program  


Friday, June 28, 2013

Installing and Updating PiAUISuite and voicecommand

Here are some in depth demo videos on how to install and update PiAUISuite and voicecommand.

If something goes wrong, get the newest code and reinstall. Make sure you read the README file and regularly update to fix errors and get new features.

Install instructions:

sudo apt-get install git-core
git clone git://
cd PiAUISuite/Install/

Voicecommand setup instructions:

voicecommand -s

Update instructions:

cd PiAUISuite
git pull
cd Install
sudo ./

If you've watched the videos and read the posts and read the README and something still doesn't work, feel free to contact me and ask questions.


Consider donating to further my tinkering since I do all this and help people out for free.

Places you can find me

Thursday, June 27, 2013

PiAUISuite Update

Quick update on everything that is going on!

I've been sick (still am but going to the doctors on Friday hopefully) so updates have been slow.

I just pushed out a bunch of stuff and finally voicecommand v3.0 is coming out officialy tomorrow night.

  • Add logging to /dev/shm/voice.log
  • Allow filler to be a set string that can be changed
  • Add push through mode with text so that voice isn't required for testing, -I flag (that is a capital i)
  • Remove quotes in Misc scripts
  • Switch flags to make more sense (now you follow them by a 0 or 1 to override config file options, ex: voicecommand -c0 overrides continuous to turn it off)
  • Add language support with !language==NN (NN is country code such as en_us or es or de, etc.)
  • Added Wolfram alpha API support. If you have an API you can set !api==YOUR-API
  • Better Youtube streaming (still working on making this even better but youtube is messing with me)
  • Added Hulu/Vimeo support and streaming
  • Removed need for tts-nofill
  • More advanced install scripts
  • Case insensitive commands and keywords
  • Passthrough support to output command instead of running it
  • Am going to finish the install instruction THIS WEEKEND!
  • Am going to make a GPIO example with a video hopefully this weekend
Features for 4.0 that are looking hopeful
  • Getting rid of duration and having voicecommand detect when you stop talking using sox (I've almost got this working as well as the current implementation)
  • A nodejs server that is a variant of RPiTV to control voicecommand, youtube, and my other scripts with a pretty HTML front end.
  • Smart phone control
  • Android advanced app to allow you to record voice on phone and send data
  • XBMC plugin (maybe, this is still a stretch goal).
  • emulationstation and video game support (need to figure out how to get this running from within X11)

Tuesday, June 18, 2013

Getting Hulu/Vimeo to work on the Raspberry Pi

This one isn't quite for the faint of heart as you have to install a lot of scripts but here is what I did to get hulu and vimeo working on the Raspberry Pi.

sudo apt-get install libwww-mechanize-perl libxml-simple-perl libcrypt-ssleay-perl libio-all-lwp-perl liblwp-protocol-http-socketunix-perl liblwp-protocol-socks-perl libdigest-hmac-perl libcrypt-blowfish-perl

sudo cpan "Module::Find"
sudo cpan "Crypt::Blowfish_PP"
sudo cpan "Crypt::Rijndael"

cd ~
git clone
cd get-flash-videos
perl Makefile.PL
sudo make install

get_flash_videos --add-plugin

It doesn't look to bad written out but it will take you a bit to install everything.
Once you do that, you can download any video from hulu (not the members only ones), vimeo, and many other sites without commercials like so:

get_flash_videos ""

Now you can get my updated youtube-safe script from here and use it to play videos for you as well.
I'll work on making a browser plugin for this as well. Then you can stream videos from those sites by typing:

youtube-safe ""

Consider donating to further my tinkering

Wednesday, June 12, 2013

Streaming Other HD Video Sites on the Raspberry PI

For those that are interested, this will allow you to stream internet shows like The Daily Show on your Raspberry Pi in HD with no lag.

A week or so ago I posted a hack which allowed people to stream youtube videos in the browser here. Unfortunately, this same method didn't work out of the box for some other video sites. They would stream a couple seconds then just end (I found this to happen with the daily show).

I now have a fix for that and have a script called youtube-safe, which can stream (high-quality with no lag on a decent internet connection) any video site that works with youtube-dl.

If you already have the Youtube scripts in my PiAUISuite installed, you can just update, otherwise you have to go through the install script and select which parts you want (this one being under youtube).

Install Instructions

sudo apt-get install git-core
git clone git://
cd PiAUISuite/Install/

**NOTE, this will ask you if you want to install a lot of different scripts because it is a SUITE. You only have to pick the ones you want to use. If you only want to use the youtube scripts, press n on any other question except for the dependencies and youtube.

Update Instructions 

cd PiAUISuite
git pull
cd Install
sudo ./

Once that is done, you can watch the daily show in 1080p like so:
youtube-safe ""

Even better, if you have voicecommand installed on your system, add the following line to the bottom of your config file for it to play the newest daily show with your voice:
~Daily Show==youtube-safe ""

I'll work on making a browser plugin for this as well.

Consider donating to further my tinkering

Places you can find me

Friday, June 7, 2013

Playing YouTube videos in the browser on the Raspberry Pi

This will allow you to stream up to 1080p youtube videos in the browser on the Raspberry pi using omxplayer. It's a crude hack but it seems to work pretty well on my system. Install instructions and a demonstration video are shown below.

You can install this by pulling the git repository and running the scripts below.
Commands to install are below (your user should have sudo privileges but you don't need to be root):

You may have to enable user scripts in Midori by going to Menu>Preferences>Extensions>UserScripts and clicking the check box.

sudo apt-get install git-core
git clone git://
cd PiAUISuite/Install/

**NOTE, this will ask you if you want to install a lot of different scripts because it is a SUITE. You only have to pick the ones you want to use. If you only want to use the youtube scripts, press n on any other question except for the dependencies and youtube.

Update Instructions 

cd PiAUISuite
git pull
cd Install
sudo ./


There is a lot of misinformation out there on how to do this. Using gnash or HTML5 is going to result in a frame rate so slow it can be considered unworkable. I've tried both of them out and you can't really watch videos with them. XBMC has a youtube plugin but it is buggy and crashes often.

I've been playing youtube videos using the command line and my voicecommand using the scripts found here.
After seeing a couple people ask about playing youtube in the browser last night, I decided to go ahead and do that and create some user scripts for midori which allow the browser to utilize the same hack.

Here is the technical overview:
I created a script called youtube which uses the youtube-dl -g flag to grab the video URL. It also handles playlists and other parsing. Then it passes that video URL to omxplayer for it to stream. 
Next I registered a new URL protocol yt:// and made it pass it's information to the youtube program whenever it runs. 
Finally, I created a user script in Midori which simply replaces all* URLs with yt://*.

Feel free to let me know any problems you have and enjoy your Youtube browsing experience.

 Consider donating to further my tinkering

Places you can find me