eSpeak is a compact open-source software speech synthesizer for English and other languages, for Linux and Windows. In this article, we will explain how you can install the command like tool eSpeak and its GUI alternative Gespeaker on your Ubuntu. Here is some basic intro to the two tools:
eSpeak: This command-line tool takes input in the form of a text string, input file, and also from stdin and plays the input in a computer-generated voice. This speech synthesizer supports 107 languages and accents.
Gespeaker: Gespeaker is a free GTK+ frontend for espeak. It allows you to play a text in many languages with settings for voice, pitch, volume, and speed. The text read can also be recorded to WAV file for future listening.
We have run the commands and procedures mentioned in this article on a Ubuntu 18.04 LTS system.
Install and Use eSpeak on Ubuntu
Installation
eSpeak is easily available on the official Ubuntu repositories and can easily be installed through the command line using the apt-get command. Please follow these steps to install eSpeak via the command line.
Open your Terminal application either through the system Application Launcher Search or through the Ctrl+Alt+T shortcut.
The next step is to update your system’s repository index through the following command:
$ sudo apt-get update
This helps you in installing the latest available version of a software from the Internet. Please note that only an authorized user can add, remove and configure software on Ubuntu.
Now you are ready to install eSpeak; you can do so by running the following command as sudo:
$ sudo apt-get install espeak
The system might ask you the password for sudo and also provide you with a Y/n option to continue the installation. Enter Y and then hit Enter; the software will be installed on your system. The process may, however, take some time depending on your Internet speed.
You can check the version number of the application, and also verify that it is indeed installed on your system, through the following command:
$ espeak --version
Use eSpeak for Text to Audio conversion
Through the eSpeak utility, you can easily listen to your specified text aloud. There are two ways through which you can listen to an input string:
1. Use the following command to listen to the text specified in the inverted commas:
$ espeak "enter the text that you want to listen to"
Example:
2. Enter the following command and then hit Enter:
$ espeak
On the prompt that appears, enter the text you want eSpeak to say and then hit Enter.
You can enter as many lines of text as you want. Whenever you want to quit the utility, simply hit Ctrl+C
There are many other ways you can use the application; please use the following command to view help on those:
$ espeak --help
However, this is one of the very useful ways you can use this application, i.e, to listen to text from a text file. Use the following syntax to specify the text file whose text you want espeak to say out aloud.
$ espeak -f filename.txt
Example:
Remove eSpeak
If you ever want to remove eSpeak installed through the above mentioned method, please use the following command to do so:
$ sudo apt-get remove espeak
The following command will help you in removing any additional packages that were installed with eSpeak or any other software, for that matter:
$ sudo apt-get autoremove
Gespeaker-A GTK frontend for espeak
For a person who does not want to open the Command Line much, installing a software through the Ubuntu UI is very simple. Please follow these steps in order to install the Gespeaker tool; available on the Ubuntu Bionic Universe repository:
On your Ubuntu desktop Activities toolbar/dock, click the Ubuntu Software icon.
Click the search icon and enter ‘gspeaker’ in the search bar. The search results will list the relevant entries as follows:
The Gespeaker entry listed here is the one maintained by Ubuntu bionic Universe. Click on this search entry to open the following view:
Click the Install button to begin the installation process. The following authentication dialog will appear for you to provide your authentication details as only an authorized user can install software on Ubuntu.
Please note that only an authorized user can add/remove and configure software on Ubuntu. Enter your password and click the Authenticate button. After that, the installation process will begin, displaying a progress bar as follows:
Gespeaker will then be installed on your system and you will get the following message after a successful install:
Through the above dialog, you can launch the tool directly and also Remove it immediately for whatever reason.
If you want to use the command line to install the same application, use the following command in your Terminal.
$ sudo apt-get install gespeaker
Launch Gespeaker
You can access Gespeaker from the Ubuntu application launcher bar as follows, or directly access it from the applications listing:
Alternatively, you can use the following command in your Terminal to launch Gespeaker through the command line:
$ gespeaker
Important: The Gspeaker UI will only launch if you have Python-dbus installed on your system. Please use the following command in your Terminal to install the said utility:
$ sudo apt-get install python-dbus
This is how the Gespeaker UI looks like:
The Gespeaker UI is pretty much straight-forward and you will have absolutely no problem in figuring out how to convert your text and text files to audio.
Remove Gespeaker
If you want to remove Gespeaker that was installed using the above method, you can remove it from your system as follows:
Open the Ubuntu Software Manager and search for Gespeaker. You will see the “Installed” status in the search entry. Click this entry and then click Remove from the following view:
Then, the system will prompt you with an Authentication dialog. The software will be removed when you provide the password for sudo user and click Authenticate on the dialog.
Whether you prefer the UI or the command line, you can easily use the Gespeaker and espeak tools to convert text from various input ways into a voice output.