PiRobot Build 5: Raspberry Pi Audio Hardware, Software & Text To Speech

Installation:

$ sudo apt-get install alsa-utils

http://www.alsa-project.org/main/index.php/Main_Page

$ sudo nano /etc/modules

Add snd_bcm2835 (if its is not already there)

$ sudo nano /usr/share/alsa/alsa.conf

change the line “pcm.front cards.pcm.front” to “pcm.front cards.pcm.default”

$ sudo apt-get install mplayer

http://mplayerhq.hu/design7/news.html

$ sudo nano /etc/mplayer/mplayer.conf

Hit control + v to get to the end of the file fast (page by page).

add line nolirc=yes

$ sudo apt-get install lame

http://lame.sourceforge.net

$ sudo apt-get install festival

http://www.cstr.ed.ac.uk/projects/festival/

$ sudo apt-get install espeak

http://espeak.sourceforge.net

Google Translate Bash Shell Script install

http://elinux.org/RPi_Text_to_Speech_(Speech_Synthesis)

$ mkdir ~/TTS

$ cd ~/TTS

$ sudo wget https://gist.github.com/r1b4z01d/5350927/download.tar

$ sudo mkdir /tmp/dirtree

$ sudo tar xfz download.tar -C /tmp/dirtree

$ sudo find /tmp/dirtree -type f -exec mv -i {} . \;

$ sudo rm -rf /tmp/dirtree

$ sudo rm download.tar

$ sudo chmod u+x GoogleSpeech.sh

$ wget http://r1b4z01d.com/audio.mp3

Verification:

$ sudo reboot

Reboot the Raspberry Pi

$ lsmod

Displays the kernel modules currently loaded

Look for snd-bcn2835     Broadcom snd-bcn2835

http://en.wikipedia.org/wiki/System_on_a_chip

http://www.broadcom.com/products/BCM2835

$ amixer cset numid=3 1

OutputSelect: 0=auto, 1=analog, 2=hdmi

$ amixer cset numid=1 -- 100%

Testing:

$ speaker-test -t sine -f 440 -c 2 -s 1
$ speaker-test -t wav -c 2

ALSL speaker-test utility

http://www.mythtv.org/wiki/Using_ALSA’s_speaker-test_utility

$ aplay ./usr/share/scratch/Media/Sounds/Animal/Kitten.wav

http://linux.die.net/man/1/aplay WAV player that comes with ALSA

$ sudo find -name *.wav

./usr/share/sounds/alsa/Side_Right.wav

./usr/share/sounds/alsa/Front_Center.wav

./usr/share/sounds/alsa/Side_Left.wav

$ mplayer ~/TTS/audio.mp3

$ echo "hello" | festival --tts

$ sudo espeak -ven+m2 -k6 -s250 "hello" 2>/dev/null

$ ~/TTS/GoogleSpeech.sh hello<em id="__mceDel"><em id="__mceDel"><em id="__mceDel"> </em></em></em>

Click/Poping update your firmware