Advertisement

First update and upgrade the Raspberry Pi related software using the commands below and reboot your Raspberry Pi for a fresh look:

 [stextbox id=”grey”]$ sudo apt-get update
$ sudo apt-get upgrade[/stextbox]

To install sound on Raspberry Pi, you need to install ‘alsa’ sound utilities using the command below. Refer Fig. 3.

 [stextbox id=”grey”]$ sudo apt-get install alsa-utils[/stextbox]

Now edit the module file at ‘/etc/modules’ using nano editor. For that, run the command below to open the file in nano editor and add ‘snd_bcm2835.’ Refer Fig. 4 and Fig. 5.

 [stextbox id=”grey”]$ sudo nano /etc/module[/stextbox]

If ‘snd_bcm2835’ line is already present, leave the file as it is. Once done, save the file by ‘CTRL+O’ and exit by ‘CTRL+X.’

Now install the mplayer audio/movie player by command mentioned below:

 [stextbox id=”grey”]$ sudo apt-get install mplayer[/stextbox]

To sort out the mplayer error message, edit file ‘/etc/mplayer/mplayer.conf’ using nano editor and add ‘nolirc=yes.’ Refer Fig. 6 and Fig. 7.

 [stextbox id=”grey”]$ sudo nano /etc/mplayer/mplayer.conf[/stextbox]

Once you have completed all the steps mentioned above, you can install Festival text-to-speech using the command below:

 [stextbox id=”grey”]$ sudo apt-get install festival[/stextbox]

You can try out Festival installation using the command below in the terminal and you will hear ‘Hello EFY’ in the earphones.

 [stextbox id=”grey”]$ echo “Hello EFY” | festival –tts[/stextbox]

Python GPIO module for Raspberry Pi. The code is written in Python programming language and compiled using Python in the Raspberry PI. Python comes as a built-in package for the Raspberry Pi and we only need to install the GPIO package modules.

Fig. 3: Install alsa-utils
Fig. 3: Install alsa-utils
Fig. 4: Open module file in nano editor
Fig. 4: Open module file in nano editor
Fig. 5: Add ‘snd_bcm2835’ in the file
Fig. 5: Add ‘snd_bcm2835’ in the file
Fig. 6: Open mplayer configuration file
Fig. 6: Open mplayer configuration file

Download the ‘RPi.GPIO-0.1.0.tar.gz’ from ‘http:// pypi.python.org/packages/source/R/RPi.GPIO/RPi.GPIO-0.1.0.tar.gz’ and extract into a suitable directory using the command:

 [stextbox id=”grey”]$ tar -zxvf RPi.GPIO-0.1.0.tar.gz[/stextbox]

Fig. 7: Add ‘nolirc=yes’ to the file
Fig. 7: Add ‘nolirc=yes’ to the file

Now use ‘cd’ command to go inside the extracted directory and install the package using:

 [stextbox id=”grey”]$ sudo python setup.py install[/stextbox]

Once the package is installed, download the source code in a suitable directory and run it using:

 [stextbox id=”grey”]$ sudo python filename.py[/stextbox]

Download Source Code: Click Here

You can also copy the code in nano editor and save it with .py extension. Please note that Python is strictly indented language and the indentation normally change when you paste the code in nano editor.


The author is a student of M.Sc. at IIT, Kharagpur

SHARE YOUR THOUGHTS & COMMENTS

Please enter your comment!
Please enter your name here