Speech

Machine Learning in Linux: Piper

In Operation

Let’s send some text from our website and pipe that to piper.

$ more LinuxLinks.txt | piper --cuda --model en_GB-alba-medium --output_file LinuxLinks-Intro-Machine-Learning.wav

Intonation is very good although not perfect.

As you see, the command uses three options:

--cuda instructs piper to use the GPU for much faster processing compared to using the CPU.

--model tells Piper which language and voice to use. Piper offers a fairly wide range of languages including English, Czech, French, Italian, Spanish, Danish, Chinese, Swedish, and others. For each language there are different voices. For example, English (British) offers 8 different voices. In the sample above, we’re using the alba voice. Voices are trained at one of 4 ‘quality’ levels. The alba voice is available at the medium quality level which is using a samplerate of 22,050 Hz, 15-20 params. Alba is the Scottish Gaelic name for Scotland.

--output_file is self-explanatory.

Let’s repeat using an American voice.

$ more LinuxLinks.txt | piper --cuda --model en_US-lessac-high --output_file LinuxLinks-Intro-Machine-Learning-American-voice.wav

The voice is trained at the high quality level (sample rate 22,050 Hz audio, 28-32M params).


Summary

Piper is highly recommended.

From our tests, the software is very fast and lightweight which even performs well even on inexpensive single-board computers such as the Raspberry Pi 4. The project provides binaries for 64-bit desktop Linux, 64-bit Raspberry Pi 4, and 32-bit Raspberry Pi 3/4.

The pre-built models are very good, but you’ll probably want to train a voice for Piper. This is a 3-step process requiring preparation of the dataset, training the voice model, and then exporting the voice model.

The software can stream raw audio to stdout, and it also accepts JSON input, a standard text-based format for representing structured data based on JavaScript object syntax. If you want to stream a lot of text, it’s best to use --output_raw.

Piper doesn’t offer a graphical frontend, but we’ll shortly publish a review of software that offers such a frontend.

Website: github.com/rhasspy/piper
Support:
Developer: Michael Hansen
License: MIT License

Artificial intelligence icon For other useful open source apps that use machine learning/deep learning, we’ve compiled this roundup.

Piper is written in C++ and Python. Learn C++ with our recommended free books and free tutorials. Learn Python with our recommended free books and free tutorials.

Pages in this article:
Page 1 – Introduction and Installation
Page 2 – In Operation and Summary

Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments