Raspberry Pi - Text to Speech
By Leo Gaggl
Just a quick note on Speech Synthesis a Raspberry Pi project. I had to research some of the options on the Raspberry Pi while looking into a project where I need some audio announcements.
Configuring Sound
echo 'snd-bcm2835' >> /etc/modules<br></br>sudo modprobe snd-bcm2835
sudo apt-get install mplayer alsa-base alsa-utils pulseaudio mpg123<br></br># make mplayer use mpg123 codec instead of default ffmp3float<br></br>echo "afm=mp3lib" >> ~/.mplayer/config
Since I am using Raspbian which is a Debian based (Wheezy) Distribution I used some Ubuntu documentation (https://help.ubuntu.com/community/TextToSpeech) as the starting point.
Festival
sudo apt-get install festival festival-english<br></br>echo "Hello World - Testing" | festival --tts
Plus: Local install (no internet connection required)
Minus: Mechanical sounding voice
Espeak
sudo apt-get install espeak<br></br>espeak -v en "Hello World - Testing"
Plus: Local install (no internet connection required)
Minus: Mechanical sounding voice (slightly better than Festival)
Google Translate
Create a shell script tts.sh
#!/bin/bash<br></br>mplayer -ao alsa -noconsolecontrols "http://translate.google.com/translate_tts?tl=en&q=$*" > /dev/null 2>&1
chmot +x tts.sh<br></br>./tts.sh "Hello World - Testing"
Plus: needs live internet connection
Minus: excellent human sounding voice
Google Speech API
I will most likely look at this in the long run to get better control rather than calling the Google Translate url too much.