Speak, friend, and enter – Speech synthesis with eSpeak and SVOX-pico for the Raspberry Pi
Speech synthesis is a nice feature for embedded systems and tiny computers not only for home automation. In case of lacking display a sound (speech) output may be a cheap alternative to provide the user with information. For example a mobile device, which gets an IP address via DHCP in changing environments is able to announce its IP via speech output even if no connection to the Internet is established. I have realized this feature before in 2006 to remotely control an ActiveMedia Pioneer 3AT mobile robot via web interface. In 2006 I have used Mbrola-TTS for this task.
My mobile Activemedia Pioneer 3AT Robot at University of Hagen in 2006, realized with MBROLA TTS
To realize a similar functionality for a raspberry Pi you can simply install eSpeak, an open source Text-to-Speech (TTS) software wich is available in raspbian out of the box. It supports over 20 langugages and has a small memory footprint. To install it type:
sudo apt-get install espeak
To test the speech synthesis simply type
sudo amixer cset numid=3 1
espeak -ven “hello world this is raspberry pi talking”
The alsamixer command is required to select the phone jack as output, default is the HDMI out.
Better speech quality with Android SVOX pico TTS engine
To get much better speech quality out of your Raspberry Pi I would recommend the open source Android SVOX pico TTS engine. It supports high quality speech generation in five languages (en [uk|us], de, fr, it, es). I am using the same TTS engine for my free Pediaphon Wikipedia TTS service. SVOX pico is the best open source TTS engine available for Linux.
Unfortunately there is no prebuild binary available in the Raspbian distribution. But is is possible to build it from source yourself or simply download my prebuild binary ARM deb packet for raspbian. (MD5 hash: b530eb9ff97b9cf079f622efe46ce513) and install it.
apt-get install libpopt-dev
sudo dpkg --install pico2wave.deb
To test it try
sudo amixer cset numid=3 1
pico2wave --lang=en-US --wave=/tmp/test.wav "hello world this is raspberry pi talking"; play /tmp/test.wav;rm /tmp/test.wav
Instruction to build pico2wave from source:
git clone -b upstream+patches git://git.debian.org/collab-maint/svox.git svox-pico
apt-get install automake libtool libpopt-dev
automake
./autogen.sh
./configure
make all
make install
To speak the IP address every time the PI boots up add the following commands to the /etc/rc.local :
/usr/bin/amixer cset numid=3 1
/usr/bin/espeak -vde "my I P address is $_IP"
Enjoy!