eSpeak NG: Text-to-Speech on Debian with MBROLA Voices
Created:
Introduction
eSpeak NG is a compact, open-source text-to-speech (TTS) engine that supports multiple languages, including German and English. It is lightweight, fast, and works offline, making it ideal for systems where internet access is limited or unnecessary. While its default voices are synthetic, you can significantly improve voice quality by integrating MBROLA, a high-quality speech synthesizer that provides more natural-sounding voices.
Personally, I use eSpeak NG to read out text files like Markdown documents or (summarized) news articles, and the improved voice quality with MBROLA makes it much more enjoyable to listen to.
This article guides you through installing and configuring eSpeak NG on Debian, including how to add MBROLA voices for enhanced German speech output.
Installation of eSpeak NG
Step 1: Install eSpeak NG
Open a terminal and run the following command to install eSpeak NG and its data package:
sudo apt-get install espeak-ng espeak-ng-data
espeak-ng: The core TTS engine.espeak-ng-data: Additional voice data for multiple languages.
Step 2: Verify Installation
Check if eSpeak NG is installed correctly by listing available voices:
espeak-ng --voices
This command displays a table of available voices, their languages, and genders (e.g., de for German, en for English, M for male, F for female).
Adding MBROLA Voices
MBROLA is a speech synthesizer that works alongside eSpeak NG to provide higher-quality voices. Debian’s repositories include several German MBROLA voices, both male and female.
Step 1: Install MBROLA
First, install the MBROLA binary:
sudo apt-get install mbrolaStep 2: Install German MBROLA Voices
Debian provides multiple German MBROLA voices. To list all available German MBROLA voices, run:
apt-cache search mbrola | grep de
This returns a list like:
mbrola-de1 - German female voice for Mbrola
mbrola-de2 - German male voice for Mbrola
mbrola-de3 - German female voice for Mbrola
mbrola-de4 - German male voice for Mbrola
mbrola-de5 - German female voice for Mbrola
mbrola-de6 - German male voice for Mbrola
mbrola-de7 - German female voice for Mbrola
mbrola-de8 - German-Bavarian male voice for Mbrola
To install all German MBROLA voices, use:
sudo apt-get install mbrola-de*
This installs all available German voices, including both male and female options.
Using eSpeak NG with MBROLA
Step 1: Test Default eSpeak NG Voices
Try the default German voice:
espeak-ng -v de "Hallo, das ist ein Test mit eSpeak NG."
-v de: Uses the default German voice.
Step 2: Use MBROLA Voices
To use MBROLA voices with eSpeak NG, specify the MBROLA voice in the command. For example, to use the **German female voice de1**:
espeak-ng -v mb-de1 "Hallo, das ist ein Test mit MBROLA." -p 20 -s 150
-v mb-de1: Uses the MBROLA German female voicede1.-p 20: Adjusts the pitch (higher values sound more feminine).-s 150: Adjusts the speed (words per minute).
Available MBROLA German Voices
| Voice Package | Gender | Description |
|---|---|---|
mbrola-de1 | Female | German female voice |
mbrola-de2 | Male | German male voice |
mbrola-de3 | Female | German female voice |
mbrola-de4 | Male | German male voice |
mbrola-de5 | Female | German female voice |
mbrola-de6 | Male | German male voice |
mbrola-de7 | Female | German female voice |
mbrola-de8 | Male | German-Bavarian male voice |
Customizing Voice Output
eSpeak NG allows you to fine-tune the speech output:
- Pitch: Use
-pto adjust pitch (e.g.,-p 30for a higher pitch). - Speed: Use
-sto adjust speed (e.g.,-s 120for slower speech). - Volume: Use
-ato adjust amplitude (e.g.,-a 200for louder output).
Example:
espeak-ng -v mb-de3 -p 30 -s 130 -a 150 "Das ist ein angepasster Test."Saving Speech to a File
You can save the speech output to a WAV file for later use:
espeak-ng -v mb-de1 -w output.wav "Hallo, das ist eine Audiodatei."
-w output.wav: Saves the speech tooutput.wav.
Read a Text File
To read text from a file, use:
cat /path/to/your/file.txt | espeak-ng -v mb-us2
cat: Reads the content of the specified file and pipes it to eSpeak NG.-v mb-us2: Uses the MBROLA US English voiceus2.
Alternatively, you can directly specify the file with the -f option:
espeak-ng -v mb-en1 -f /path/to/your/file.txt
-f: Specifies the input file to read.mb-en1: Uses the MBROLA English voiceen1.
Conclusion
eSpeak NG is a versatile and lightweight TTS solution for Debian, and integrating MBROLA voices significantly enhances the naturalness of the speech output. Whether you need a simple command-line TTS tool or a more customizable solution with higher-quality voices, eSpeak NG and MBROLA provide a robust and flexible option.
Experiment with different voices and settings to find the best fit for your needs!
Feedback
Have thoughts or experiences you'd like to share? I'd love to hear from you! Whether you agree, disagree, or have a different perspective, your feedback is always welcome. Drop me an email and let's start a conversation.