Let your Linux terminal speak its mind

eSpeak is an open source text-to-speech synthesizer that can be invoked from the Linux command line.
146 readers like this.
Linux toy: cava

Jason Baker

Greetings from another day in our 24-day-long Linux command-line toys advent calendar. If this is your first visit to the series, you might be asking yourself what a command-line toy even is. We’re figuring that out as we go, but generally, it could be a game, or any simple diversion that helps you have fun at the terminal.

We hope that even if you've seen some of these before, there will be something new for everybody in our series.

Some of you may be too young to remember, but before there was Alexa, Siri, or the Google Assistant, computers still had voices.

Many of us will never forget HAL 9000 from 2001: A Space Odessey helpfully conversing with the crew (sorry, Dave). But between 1960s science fiction and today, there was a whole generation of speaking computers. Some of them great, most of them, not so great.

One of my favorites is the open source project eSpeak. It's available in many forms, including a library version you can use to include speech technology in your own project, but it also coms as a command-line program that you can install and use easily. In my distribution, this was as simple as:

$ sudo dnf install espeak

Invoking eSpeak then can be invoked either interactively, or by piping text to it using the output of another program or a simple echo command. There are a number of voice files available for eSpeak, and if you're especially bored over the holidays, you could even create your own.

A fork of eSpeak called eSpeak NG ("Next Generation") was created in 2015 from some developers who wanted to continue development of the otherwise lightly-updated eSpeak. eSpeak is made available as open source under a GPL version 3 license, and you can find out more about the project and download the source code on SourceForge.

I'll also throw in a bonus toy today, cava. Because I've been eager to give each of these articles a unique screenshot as the lead image, and today's toy outputs sound rather than something visual, I needed to find something to fill the space. Short for "console-based audio visualizer for ALSA" (although it supports more than just ALSA now), cava is a nice MIT-licensed terminal audio visualization tool that's fun to watch. Below, is a visualization of eSpeak's output of the following:

$ echo "Rudolph, the red-nosed reindeer, had a very shiny nose." | espeak

Linux toy: cava

Do you have a favorite command-line toy that you we should have included? Our calendar is basically set for the remainder of the series, but we'd still love to feature some cool command-line toys in the new year. Let me know in the comments below, and I'll check it out. And let me know what you thought of today's amusement.

Be sure to check out yesterday's toy, Solve a puzzle at the Linux command line with nudoku, and come back tomorrow for another!

What to read next
User profile image.
Jason was an Opensource.com staff member and Red Hatter from 2013 to 2022. This profile contains his work-related articles from that time. Other contributions can be found on his personal account.


This is great! I had forgotten about 'espeak'. You can pipe a text file to an mp3 with ffmpeg too. Lots of great opportunities for fun on the command line. Here's a sample 'espeak -f myfile --stdout | ffmpeg -i - -ar 44100 -ac 2 -ab 192k -f mp3 final.mp3' that came from a help forum. I remember that I had an Lego EV3 robot talking using 'espeak.'

I used to use festival, another text to speech utility. Recently, though, I tried to install and use it again, but somehow it's more difficult that it used to be.

I used 'espeak' to convert text files to speech for visually impaired students in summer school one year. It's a great utility.

Creative Commons LicenseThis work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.