Installing Pico TTS
Installing Pico TTS
Sooner or later you may wish to hear your Raspberry Pi speaking.
Its nice to get messages from your RPi by Whatsapp, or reading on a small display (or TV), but hearing this device answering you with a real voice could be amazing!
There are several TTS (Text To Speech) engines avaliable for a Raspberry Pi and you can find a list here.
Usually offline engines suffer from low quality voices (and sometimes limited languages avaliable). On the opposite side, online TTS engines could have really high speech quality, but you need an internet connection (and your recorded voice will be analyzed from someone else).
Fortunately there is a really good engine available for our device that produces quite good voices, but is completely offline: SVOX Pico.
The bad thing is that its not easy to install. On many websites you can find an "easy" installation using just aptitude (apt-get install libttspico), but if you try it, you will find that this doesnt work, even adding the non-free repository for installation.
Anyway the sources are available, so you can compile the packages by yourself. I found just a bunch of information about this topic online, so Im going to summarize all the steps in this post.
First of all you need to open the file /etc/apt/sources.list and check it contains (uncommented) the following lines:
If these are not present or they are commented, edit and save the file.
Then launch an update:
Next you need to install some dependecies for the compilation:
Probably fakeroot is already installed, but I put it anyway just in case you are missing it. Now we can create the folder to keep the sources and download them:
After downloading the sources, you should find a folder named like svox-1.0+git20110131 that will contain all the files. Note that the last part could be different, so please check before proceeding.
Enter the sources folder and prepare the packages:
First of all you need to open the file /etc/apt/sources.list and check it contains (uncommented) the following lines:
deb http://mirrordirector.raspbian.org/raspbian/ wheezy main contrib non-free rpi
deb-src http://mirror.ox.ac.uk/sites/archive.raspbian.org/archive/raspbian/ wheezy main contrib non-free rpi
deb-src http://mirror.ox.ac.uk/sites/archive.raspbian.org/archive/raspbian/ wheezy main contrib non-free rpi
If these are not present or they are commented, edit and save the file.
Then launch an update:
sudo apt-get update
Next you need to install some dependecies for the compilation:
sudo apt-get install fakeroot debhelper automake autoconf libtool help2man libpopt-dev hardening-wrapper
Probably fakeroot is already installed, but I put it anyway just in case you are missing it. Now we can create the folder to keep the sources and download them:
mkdir pico_build
cd pico_build
apt-get source libttspico-utils
cd pico_build
apt-get source libttspico-utils
After downloading the sources, you should find a folder named like svox-1.0+git20110131 that will contain all the files. Note that the last part could be different, so please check before proceeding.
Enter the sources folder and prepare the packages:
cd svox-1.0+git20110131
dpkg-buildpackage -rfakeroot -us -uc
dpkg-buildpackage -rfakeroot -us -uc
Now go for a coffee... Compiling the packages require about 15-20 minutes to complete, but fortunately its an autonomous task, so theres no need for you to stay beside the RPi.
If no errors arose during packages compilation, you should find four packages in the pico_build folder. Check by changing folder and listing files:
If no errors arose during packages compilation, you should find four packages in the pico_build folder. Check by changing folder and listing files:
cd ..
ls
ls
These are the packages in my folder:
libttspico0_1.0+git20110131-2_armhf.deb
libttspico-data_1.0+git20110131-2_all.deb
libttspico-dev_1.0+git20110131-2_armhf.deb
libttspico-utils_1.0+git20110131-2_armhf.deb
libttspico-data_1.0+git20110131-2_all.deb
libttspico-dev_1.0+git20110131-2_armhf.deb
libttspico-utils_1.0+git20110131-2_armhf.deb
To use the library you just need three of them, but they have to be installed in a specific order, so type:
sudo dpkg -i libttspico-data_1.0+git20110131-2_all.deb
sudo dpkg -i libttspico0_1.0+git20110131-2_armhf.deb
sudo dpkg -i libttspico-utils_1.0+git20110131-2_armhf.deb
sudo dpkg -i libttspico0_1.0+git20110131-2_armhf.deb
sudo dpkg -i libttspico-utils_1.0+git20110131-2_armhf.deb
Now Pico engine is ready to be used. Connect audio output and test the library typing:
pico2wave -w test.wav "it works! "
aplay test.wav
aplay test.wav
You can change language with option -l and you can choose english (uk or us), german, italian, french or spanish (inside the sources folder you can also find some documentation).
Now that you have built the packages, save them somewhere, so next time you need to install SVOX Pico engine you can just install them and avoid the whole compilation process.
In my next post i will show you how to integrate SVOX Pico TTS engine with our Yowsup parser and how to make the voice just a bit more interesting...