Building a Speech Recognition with Python on Raspberry Pi

Recently I spent some money (less than $100) and time to build a speech recognition script with Python which can be run on my Raspberry Pi 2. Since I bought a RPi 2 as my media player, I was thinking to put my old RPi B+ to do something fun. So I started the speech recognition project.

Unfortunately, RPi B+ seems to be just too slow to handle the task. So I ended up buying another RPi 2. The script basically does three things:

1) Convert audio input to text
2) Respond to the text from step 1 and come up with response in text
3) Convert the response text into audio output.

So here are a couple demos I made in the last few days. You might need to turn up the volume to hear what I said in the videos. Let me know what you think.

Demo 1: At this point, the script can only answer the date and the time.

Demo 2: The script can access Internet to find answers to the questions.


Raspberry Pi Audio Input and Output with USB Sound Card

Raspbian sound input and output.

1) Force the USB sound card to be the default sound device
Use nano to open file /etc/modprobe.d/alsa-base.conf


options snd-usb-audio index=-2


options snd-usb-audio index=0

Then add:

options snd_bcm2835 index=1

2) To record sound

Use command:

arecord -f cd -d 10 -c 1 record.wav

This command records sound input from the microphone for 10 seconds and writes the audio to record.wav file.

3) To playback recorded audio

Use command:

aplay -f cd -D plughw:0,0 record.wav


Installing VirtualBox Guest Additions on Ubuntu Guest

It seems on Ubuntu guest OS, there is some dependency issue when trying to install the VirtualBox Guest Additions by using the following packages:

sudo apt-get install virtualbox-guest-dkms virtualbox-guest-utils virtualbox-guest-x11

The following errors will occur when the above command is run.

The following packages have unmet dependencies: virtualbox-guest-x11: Depends: xorg-video-abi-15 Depends: xserver-xorg-core (>= 2:

The solution is to run the command below before you install the VirtualBox Guest Additions packages.

sudo apt-get install xserver-xorg-core

This works for me on XUbuntu 14.04. I am still trying to resolve the resolution problem on Windows 10 guest. It doesn’t seem the VirualBox Guest Additions have any affect on Windows 10 guest even it is installed without error.


Walked Across Sydney Harbour Bridge


Ten Year Anniversary of Arriving to Australia

Last Friday, July 4th, was the ten year anniversary of my first time set foot on Australia. Ten years ago, July 4th 2004, my flight landed in Sydney airport and I knew very little about this country. It was a sunny day just like this July 4th. After ten years, I have settled down in Sydney and I enjoy living here so far. I am glad that I didn’t waist much of the last ten years.


New Setup of My Study Room

Study Room


I spent two weekends to replace the old furnitures in my study room and upgrade the desktop computer. With the new Dell screen (on the right hand side), finally I can have a vertical screen at home just like I do in office. It is very convenient for reading and coding. I still keep the shelf on the left as my standing desk solution.

This is the old setup of my study room: http://chaoming.li/blog/standing-desk-solution/

You can see I kept two good ideas from the old setup: Shelf as standing desk solution, and desk shelf to lift the monitor from the desk for more desk space.


Hunter Valley Day Trip

We went to Hunter Valley for a day trip. The whether was beautiful today. This is the second time I have been there. The first time I’ve been there was two years ago, and it was raining and cloudy. Everything looks so beautiful under the blue sky today. Here is a photo I took in Audrey Wilkinson Vineyard. The vineyard is on the top of a small hill which overlooks the valley. It is a must go place in Hunter Valley, for the awesome view.


Helicopter ride is $60 per person for 10 minutes, relatively affordable. Many tourists queued for a ride.


© Copyright 2014, All Rights Reserved