This guide explains what is eSpeak NG, how to install eSpeak NG in Linux and how to convert text to speech using eSpeak NG in Linux.
Table of Contents
What is eSpeak NG?
eSpeak NG is a command line, multi-lingual software speech synthesizer for English and many other languages. We can convert text to speech using eSpeak NG in Linux and Unix-like systems. eSpeak NG is an updated version of eSpeak engine created by Jonathan Duddington.
You can use eSpeak NG to listen to blogs and news sites and also convert text files to voice for visually impaired people. eSpeak includes different voices, and their characteristics can be altered.
eSpeak NG is a cross-platform application that supports Android, Linux, Mac OS and Windows. It is a free, open source program written in C programming language. The source code of eSpeak NG project is hosted in GitHub.
How eSpeak NG works?
eSpeak NG will read aloud the given text for you! It can able to speak text either from standard input or from a file. So, you can directly give the phrase to speak as input for eSpeak NG or save the text in a file and then pass that text file as an input. It uses text-to-speech to speak through the default sound device.
You can also save the output file in wav
or mp3
format, instead of speaking directly. The resulting file can be played on any media players, such as VLC, SMplayer etc. It can also translate text into phoneme codes.
Supported languages
eSpeak NG does text to speech synthesis for 100+ languages and accents, including Afrikaans, Albanian, Aragonese, Armenian, Bulgarian, Cantonese, Catalan, Croatian, Czech, Danish, Dutch, English, Esperanto, Estonian, Farsi, Finnish, French, Georgian, German, Greek, Hindi, Hungarian, Icelandic, Indonesian, Irish, Italian, Kannada, Kurdish, Latvian, Lithuanian, Lojban, Macedonian, Malaysian, Malayalam, Mandarin, Nepalese, Norwegian, Polish, Portuguese, Punjabi, Romanian, Russian, Serbian, Slovak, Spanish, Swahili, Swedish, Tamil, Telugu, Turkish, Vietnamese, Welsh and more. Some languages are supported better than others.
Install eSpeak NG in Linux
eSpeak NG is packaged for popular Linux operating systems, so you can install eSpeak using the default package manager.
To install eSpeak NG on Arch Linux, EndeavourOS and Manjaro Linux, run:
$ sudo pacman -S espeak-ng
Debian, Ubuntu and its derivatives like Linux Mint and Pop OS:
$ sudo apt install espeak-ng
Fedora, CentOS, AlmaLinux, and Rocky Linux:
$ sudo dnf install espeak-ng
openSUSE:
$ sudo zypper install espeak-ng
Convert text to speech using eSpeak NG
eSpeak NG is fully compatible with its predecessor eSpeak. In fact, eSpeak NG uses the same command line options as eSpeak, with several additional functionalities. Let us see a few examples.
1. Speak a phrase aloud using eSpeak NG:
$ espeak-ng "Welcome to OSTechNix blog"
Alternatively, you can use echo
command to pipe the phrase as input to eSpeak NG like below:
$ echo "Excellence is not by accident. It is process, where an individual, organisation or nation continuously strive to better oneself. - APJ Abdul Kalam" | espeak-ng
eSpeak NG will read aloud the given string through the default sound device.
2. As stated earlier, eSpeak NG can read aloud the contents from a file.
$ espeak-ng -f file.txt
Or,
$ cat file.txt | espeak-ng
3. Read text input from standard input instead of a file:
$ espeak-ng
Type the word to speak and hit ENTER key. To exit, press CTRL+C
.
4. If you want to save output to a WAV audio file, rather than speaking it directly, use -w
flag:
$ espeak-ng -w audio.wav "I use Arch, BTW"
5. eSpeak can able to print the phonemes of a text.
The following command will speak the word "ostechnix", and print the phonemes that were spoken.
$ espeak-ng -x ostechnix
Sample output:
'0stEkn,Iks
6. eSpeak NG supports several different voices. To list all voices supported by eSpeak NG, run:
$ espeak-ng --voices
You can also list all voices that speak a specific language, for example English (en), like below:
$ espeak-ng --voices=en
7. eSpeak NG will speak the given text using the default English voice. If you want to use a different voice, run:
$ espeak-ng -v <voice>
Example:
$ espeak-ng -vta "வாழ்க தமிழ்மொழி!"
8. For more details about eSpeak NG, refer the man pages:
$ man espeak-ng
Gespeaker - A GTK front-end to eSpeak
Gespeaker is a text to speech GTK+ front-end for eSpeak and mbrola. It allows you to play a text in many languages. You can adjust various settings such as voice, pitch, volume and speed.
To install Gespeaker in Debian, Ubuntu and its derivatives, run:
$ sudo apt install gespeaker
Once installed, launch Gespeaker from menu or application launcher. The default interface of Gespeaker will look like below:
Gespeaker usage is fairly easy! Enter the text to speak and click Play button. it's that simple!!
You can choose language and the voice (male or female) to use from Base settings tab and adjust the values for pitch, volume, speed and delay settings as you wish from the Advanced settings section.
Resources: