In this blog post, we will show you how to make your Linux terminal talk using espeak-ng.
Imagine a small voice synthesizer on your computer. eSpeak NG is basically that. eSpeak NG is derived from the original eSpeak project, with the “NG” standing for community-driven efforts to enhance and expand its functionality. eSpeak NG is a small, open-source program that converts text to spoken word in a variety of languages and accents.
eSpeak NG takes a different approach from the more complex text-to-speech systems, which rely on large databases of recorded human voices. It understands the rules of each language’s pronunciation and constructs sounds from the basic phonetic units. This makes it very lightweight and portable!
While its synthesized sound may not match the naturalness of a human, its clarity and versatility make it an invaluable tool for a variety of automated tasks.
Installation of espeak-ng
eSpeak NG has a wide range of platform support, making it a universal text-to-speech solution across all environments.
Linux (Debian/Ubuntu)
sudo apt install espeak-ng
Windows 10/ Windows 11
You can grab Window binaries from its GitHub releases.
MacOS
brew install espeak-ng
Android
You can grab apk from its GitHub releases.
Basic Usage
The basic way to use eSpeak NG is through its command-line interface. You just call the espeak-ng command and enter the text you want it to say. Saying “Hello, world”:
espeak-ng "Hello, world"
Running this command will play the phrase “Hello, world” using the default voice.
Reading from standard input
echo "Linuxtechi is one of the leading Linux blogs" | espeak-ng
You can also pipe text(with |) to espeak-ng.
Save output as WAV file
espeak-ng -w output.wav
This will be saved to a file. Use the -w option to save the synthesized voice as a .wav audio file.
Support for other languages
espeak-ng (short for eSpeak Next Generation) supports multiple languages and dialects. This is one of its features. English, German, Indonesian, Russian, Hindi, Swedish, and a lot of other languages are supported. You can list all the supported languages using the command
espeak-ng --voices
Creating whisper sound
You can play with modifiers like +whisper, +croak, +klatt, and others.
espeak-ng -v en+croak -p 40 -s 120 "Warning: system under load."
espeak-ng -v hi+whisper "यह गोपनीय जानकारी है, इसे केवल एन्क्रिप्टेड चैनल के माध्यम से साझा करें"
The following command displays a list of all available voice variants(modifiers).
espeak-ng --voices=variants
Change Speed and Pitch
-p flag changes the pitch while -s flag changes the speed of voice.
espeak-ng -p 80 -s 210 "This is a fast and high voice. espeak-ng -p 30 -s 120 "This is a slow and deep voice."
Creating Custom Audio Alerts in Shell Scripts
Creating custom audio alerts in shell scripts using tools such as espeak-ng is an effective way to make your terminals interactive and productive. Below are some real-world use cases where audio alerts would be very useful.
1) Long-running build or compile alerts
Compiling large libraries, such as the Linux kernel or Android ROM, can take minutes or even hours.
make -j5 && espeak-ng "Build complete"
This way, you can do other tasks without having to keep checking the terminal.
2) File Transfer or Backup Completion
rsync -avh /media/backup/ /mnt/remote/ && espeak-ng -v en+croak -s 150 -p 40 "Backup finished"
When copying large files or synchronizing directories using tools such as rsync, it’s convenient to be notified by an audio alert when the process is complete.
3) Test suite notifications
pytest && espeak-ng "Tests passed" || espeak-ng "Some tests failed"
Run automated tests (e.g. pytest, JUnit, etc.) and get audio feedback on success or failure.
4) Download Completion
wget https://chuangtzu.ftp.acc.umu.se/debian-cd/current-live/amd64/iso-hybrid/debian-live-12.10.0-amd64-xfce.iso && espeak-ng "Download complete"
If you are downloading a large file, you can add a voice notification when it is ready.
5) System Maintenance Scripts
sudo apt update && sudo apt upgrade -y && espeak-ng "System updated"
Instead of reading logs, you can be notified when a cleanup, update, or backup is complete.
6) Make your terminal greet you on login
espeak-ng -p 30 -s 120 "Welcome, $USER. Let's write some good code today!"
Add this to your ~/.bashrc.
Conclusion
We’ve seen how powerful (and fun) espeak-ng can be, turning a silent terminal into a talking partner. From customizing pitch and tempo, to applying whisper effects, from setting script alerts for long-running tasks, to adding feedback during tests or backups, espeak-ng gives your shell a real voice.
Whether you’re a developer, system administrator, or automation enthusiast, voice feedback can increase productivity, reduce context switching, and even add a little personality to your workflow.
Don’t be afraid to experiment with modifying voices and accents and script dynamic alerts with espeak-ng.
Also Read: 12 Funny Commands of Linux that can make you laugh