eSpeak: Text To Speech Tool For Linux

eSpeak is a command line tool for Linux that converts text to speech. This compact speech synthesizer provides support for English and many other languages. It is written in C.

eSpeak reads the text from the standard input or input file. The voice generated, however, is nowhere close to a human voice. But it is still a compact and handy tool if you want to use it in your projects.

Some of the main features of eSpeak are:

  • Speaks text from a file or from stdin
  • Shared library version to be used by other programs
  • SAPI5 version for Windows, so it can be used with screen-readers and other programs that support the Windows SAPI5 interface
  • Ported to other platforms, including Android, Mac OSX etc.
  • Several voice characteristics to choose from
  • Speech output can be saved as .WAV file
  • SSML (Speech Synthesis Markup Language) is supported partially along with HTML
  • Uses a “formant synthesis” method. This allows many languages to be provided in a small size.
  • Tiny in size, the complete program with language support, etc is under 2 MB.
  • Can translate text into phoneme codes so that it could be adapted as a front end for another speech synthesis engine.
  • Development tools are available for producing and tuning phoneme data
  • Supports several languages; however, in many cases these are initial drafts and need more work

Install eSpeak

To install eSpeak in Ubuntu based system, use the command below in a terminal:

sudo apt install espeak

eSpeak is an old tool and I presume that it should be available in the repositories of other Linux distributions such as Fedora. You can install eSpeak easily using the respective package manager. I

n case of Arch Linux, the repository has espeak-ng in place, which is described in the next section.

To use eSpeak, enter espeak in the terminal. It waits for input. You can start typing your text. When you press enter (new line), you can hear the text you had entered.

You can continue adding text in lines to hear it out. Use Ctrl+C to close the running program.

espeak in terminal
eSpeak in terminal

There are several other options available. You can browse through them through the help section of the program.

espeak --help
espeak help section explaining the usages
eSpeak help section explaining the usages

GUI Version: espeakedit

If you prefer the GUI version over the command line, you can install espeakedit which provides a GTK front end to eSpeak.

Use the command below to install espeakedit:

sudo apt install espeakedit

Once installed, you need to copy the data on /usr/lib/x86_64-linux-gnu/espeak-data/ to your home directory. For this, open a terminal and run:

sudo cp -r /usr/lib/x86_64-linux-gnu/espeak-data/ <your-home-directory-path>

Once done, you can open the espeakedit application. It will look like:

espeak edit gui app
epeakedit GUI app

You can enter the text on the field provided and press speak to start. You can save the file as .WAV file and listen later.

The interface is straightforward and easy to use. You can explore the submenus and functions all by yourself.

A New Tool: eSpeak NG

The eSpeak NG is a compact open-source text-to-speech synthesizer, based on eSpeak engine created by Jonathan Duddington.

It offers the features of eSpeak and is in active development. The project also provides a separate espeak-ng-data package, to avoid conflict with the espeak-data package offered by eSpeak project.

To install this, on Ubuntu, run:

sudo apt install espeak-ng

The new eSpeak NG project is a significant departure from the eSpeak project, aiming to clean up the existing codebase, add new features, and add to and improve the supported languages.

Also, it is important to note that espeakedit GUI is not part of this new project.

Some of the notable features:

  • Uses the same command-line options as espeak with several additions.
  • Provides new functionality such as specifying the output audio device name to use.
  • Has been ported to other platforms, including Solaris and Mac OSX.
  • Includes different voices whose characteristics can be altered.
  • Available as a command-line program for Linux and Windows to speak text from a file or from stdin.
  • Available as a shared library version for use by other programs.

Wrapping Up

On It’s FOSS, we use Play.ht to provide audio formats of selected articles. The espeak tools are not as good as the professional AI tools.

However, if you want something basic and free to be used in your project, you can give it a try.

Become a Better Linux User

With the FOSS Weekly Newsletter, you learn useful Linux tips, discover applications, explore new distros and stay updated with the latest from Linux world

It's FOSS

Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to It's FOSS.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.