Linux OSBN/Ubuntuusers Planet XING / LinkedIn

Compile Pico TTS on Raspbian

To translate text into voice, a TTS software (Text-to-Speech) is required. Under Linux there are basically two free tools: CMU Flite and eSpeak.

CMU Flite (festival-lite) exists since 2001 and is therefore considered a veteran in speech synthesis under Linux, eSpeak was first released in 2006. From a sound perspective, both tools deliver usable results when using english language, the german voices could be improved heavily.

Of course, there are also cloud-based TTS solutions (for example Amazon Polly oder Google Cloud TTS) – but you should decide on your own whether you would like to go for such a solution.

And there is Pico TTS – a software from the Android project that works offline and – at least of for the german language – sounds way better than eSpeak and Flite. Under Debian, the appropriate packages are part of the non-free channel – for Raspbian there are no pre-compiled packages.

For manually compiling the software, the APT source list (/etc/apt/sources.list) needs to be altered in order to include source code packages:

deb-src buster main contrib non-free rpi

Afterwards, the source code is downloaded:

$ apt-get update
$ apt-get source libttspico-utils

Before compiling the software, ensure to install some tools:

# apt-get install autoconf libtool help2man libpopt-dev debhelper

After this, move to the svox folder and start compiling the software:

$ cd svox-<TAB>
$ dpkg-buildpackage -rfakeroot -us -uc

Create the packages takes at about 2 minutes on a Raspberry Pi 4, the older Pi 3 needs at about 4,5 minutes.

Move to the previous folder, you will find multiple DEB pakages from which you will need to install some:

# dpkg -i libttspico-data_*all.deb libttspico-utils*.deb libttspico0*.deb

Afterwards you can remove the tools required for compiling the software if you want to save some space:

# apt-get remove --purge autoconf libtool help2man libpopt-dev debhelper
# apt-get autoremove --purge

Finally, after that installation text can be converted into WAV files by leveraging the pico2wave command:

$ pico2wave -l de-DE -w output.wav "Franz jagt im komplett verwahrlosten Taxi quer durch Bayern"

Sharing is caring

17 Comments Add New Comment

  1. Simon says:

    Hi Christian, this is exactly what I was looking for because I’m not happy with the results of espeak in Italian. Problem is I’m getting an error on the very first step of your recipie, when I run
    deb-src buster main contrib non-free rpi
    I get bash: deb-src: command not found
    I’m new to Pi/Linux and have no idea what to do to fix the error. I’d really appreciate if you can guide me on that.
    Many thanks in advance

  2. Simon says:

    Christian, please disregard my preivous comment. I found what I was doing wrong by asking to Mr. Google (I should have done that before posting the remark).

    Anyway many thanks for the article, I have everything running!


  3. maldex says:

    in one go

    cd /usr/local/src
    sudo sed -i ‘s/^#deb-src/deb-src/g’ /etc/apt/sources.list
    sudo apt-get update
    sudo apt-get install -y autoconf libtool help2man libpopt-dev debhelper

    sudo rm -rf svox*
    sudo apt-get source libttspico-utils

    cd svox-1.0*/

    time sudo dpkg-buildpackage -rfakeroot -us -uc

    cd ..

    sudo dpkg -i libttspico-data_*all.deb libttspico-utils*.deb libttspico0*.deb

    cd ~

    pico2wave -w ~/test.wav -l de-DE “Franz jagt im komplett verwahrlosten Taxi quer durch Zürich” && aplay ~/test.wav

  4. Colin says:

    Do you know any way to have pico speak directly, or to pipe its output to aplay instead of using an intermediate file?

    1. Christian says:

      Hi Colin,
      I’m afraid this is not possible – at least currently. I checked the manpage and also whether there are additional pico commands that are part of the installation that could do this. 🙁

      Best wishes,

  5. Don M says:

    This was a great find for me Christian. Thanks so much for posting.
    Have you had any luck compiling nanotts on raspbian? It seems to be based on picotts.

    My unix knowledge is limited so i haven’t had much luck understanding or fixing the missing lib errors it shows when I try.

  6. Ralf says:

    Dear Christian,
    thanks a lot for this.
    After numerous trials your approach worked for me.
    pico2wave is running.
    I wonder if there are additional voices available – and when: where?
    Currently I get a female voice which is nice but for a specific project I’m looking for a male voice.
    Any idea?

    Thanks a lot for any hint!

    Warm regards,

    P.S.: Your message board is not working properly on a tablet (iPad): None of three browsers is showing the checkbox for acknowledging data handling…

    1. Christian says:

      Hi Ralf,
      thanks a lot – happy to help!

      I don’t have a Pico TTS installation around currently but I had a look at the manpages and Debian packages. Using the -l parameter you can select the language (e.g. de-DE), language files should be below /usr/share/pico/lang. As far as I can see there are no additional male voice files.

      If you’re looking for an alternative with optional male voices, you might want to have a look at MaryTTS or Larynx. You can try them both using OpenTTS – there’s a Docker image that can be started in a couple of seconds.

      Thanks a lot for the feedback – sorry to hear that the box isn’t working properly. I will have a look at the theme – hopefully there is an update available..

      Hope this helps – best wishes,

  7. Ralf Korell says:

    Dear christian,
    thanks for your reply and extended information.
    I will double check your suggestions.

    Warm regards,

Leave a Reply

Your email address will not be published.