
Are you looking to infuse some creativity and functionality into your Linux environment? One delightful feature you can enable is making your Linux terminal speak. This can not only add some fun but can also be a practical tool for various tasks. Here’s a comprehensive look at some excellent text-to-speech tools available for Linux that will give your terminal a voice.
1. Mastering eSpeak
First on our list is eSpeak, a versatile and lightweight open-source speech synthesizer renowned for its speed and low resource consumption. With support for multiple languages and accents, it’s an excellent option for users worldwide.
Installing eSpeak is a breeze. For Debian or Ubuntu users, simply open your terminal and run:
sudo apt install espeak

If you’re using a different Linux distribution, just utilize your package manager like DNF, YUM, or Pacman for installation.
Once installed, simply type espeak
followed by the text you wish to vocalize:
espeak "Hello from your Linux terminal!"
Your computer will now audibly greet you! To read text from a file, use the -f
option followed by the filename:
espeak -f filename.txt
You can further customize your speech output by adjusting pitch (-p) and speed (-s) settings:
espeak "Task completed successfully" -p=30 -s=150
Prefer a different voice? eSpeak allows you to list available voices with the --voices
option:
espeak --voices

Once you’ve identified a specific voice, include it in your command:
espeak -v en-us "Hello, this is eSpeak"
Additionally, you can streamline command outputs into speech with:
ls -l | espeak --stdin
2. Exploring Festival
Next, let’s delve into Festival—an exceptional option for those who crave customization. With a comprehensive text-to-speech system, Festival provides various voices and advanced control over speech synthesis.
Installation is straightforward. If you’re on Debian or Ubuntu, execute:
sudo apt install festival
To convert text to speech using Festival, you can issue the following command:
echo "Festival is a powerful text-to-speech system." | festival --tts
If you want to read a text file, simply run:
festival --tts textfile.txt
Festival provides extensive customization options, enabling voice selection and pronunciation adjustments. For details on various options, check out the festival --help
man page—perfect if you seek more control over your speech synthesis experience.
3. Harnessing Google Speech (gTTS)
In contrast to conventional offline solutions, Google Speech capitalizes on cloud technology to tap into Google’s remarkable voice synthesis capabilities. Offering natural-sounding voices, it’s ideal for users who value high-quality output and have an internet connection.
To begin, you’ll need the gTTS (Google Text-to-Speech) Python library. Ensure Python and pipx are installed, then execute:
pipx install gtts

Next, install a suitable audio player like mpg123 or VLC:
sudo apt install mpg123
With gTTS and mpg123 ready, you can create audio output in one line:
gtts-cli "Hello and Welcome to Linux!" --output temp.mp3 && mpg123 temp.mp3
To explore available languages, simply use the --all
option. If you wish to select a different language, use the --lang
option before specifying output:
gtts-cli "Hello and Welcome to Linux!" --lang fr --output temp.mp3 && mpg123 temp.mp3
While setup is a bit more involved than simpler tools, if superior voice quality is important, gTTS is a stellar choice!
4. Employing Speech Dispatcher (spd-say)
If you’ve used macOS, you might be familiar with the say
command. While not natively available in Linux, you can achieve similar functionality through Speech Dispatcher paired with its spd-say
command.
To get spd-say
up and running, install Speech Dispatcher and a speech engine—like eSpeak—if not already present. For Debian/Ubuntu, type this command:
sudo apt install speech-dispatcher
Speech Dispatcher provides a unified command interface for various speech synthesizers, including eSpeak and Festival.
Now you can use spd-say
to make your terminal vocalize:
spd-say "Hello and Welcome to Linux!"
This will prompt Speech Dispatcher to vocalize using the default engine. Don’t forget to tune the speech attributes, like rate with -r
, pitch with -p
, and volume with -v
. Consult the additional options in the man-page with spd-say --help
.
5. Lightweight Flite
If you’re in search of a more lightweight alternative, then Flite is an exceptional choice. Designed to be a swift runtime speech synthesis engine, it’s essentially a compact version of Festival, perfect for resource-limited environments like older computers or embedded systems.
Installation on your preferred Linux distro is simple with the standard package manager. For Debian/Ubuntu, execute:
sudo apt install flite

Using Flite is akin to eSpeak in its ease of use. Just run:
flite -t "Flite is a small and fast speech synthesis engine."
Flite is ideal for terminals on low-resource systems. Now you have various options to ensure your Linux terminal speaks to you! Whether for accessibility, fun, or automation, these tools deliver an exciting experience.
I recommend beginning with eSpeak or Flite due to their simplicity. Once comfortable, explore the additional options that best fit your needs. You’ll be surprised by how these commands can spice up your Linux interaction!
Image credit: Frederick Medina via Unsplash. All alterations and screenshots by Haroon Javed.
Frequently Asked Questions
1. What is eSpeak and how can I use it?
eSpeak is a lightweight, open-source speech synthesizer perfect for quick text-to-speech needs. To use it, install it via your package manager, then run espeak "Your text here"
in the terminal.
2. How do I install Google Speech (gTTS) on my Linux machine?
To install gTTS, make sure Python and pipx are installed. Then simply run pipx install gtts
in your terminal.
3. Can I customize the speech settings in these tools?
Absolutely! Both eSpeak and Festival allow you to customize pitch, speed, and voice selection to enhance user experience. Use respective options in your command for adjustments.
Leave a Reply ▼