Lesson 108: espeak Command
In this lesson, you’ll learn to use the espeak command to convert text into speech, customize voice settings, and apply it in scripts for alerts and automation.
The espeak command is an open-source text-to-speech (TTS) synthesis engine that uses a formant synthesis method. It generates speech by mathematically modeling the human vocal tract rather than stitching together recorded audio samples.
This makes espeak extremely lightweight (the entire engine and all language voices fit in a few megabytes), fast to respond, and capable of speaking in over 100 languages and dialects.
The trade-off is that it sounds more robotic than neural TTS engines like Google's or Amazon's, but for command-line scripting, system alerts, and accessibility use cases, that is often perfectly acceptable.
Installation
sudo apt install espeak # Debian/Ubuntu/Mint
Or:
sudo dnf install espeak # Fedora/RHEL 9+
Or:
sudo yum install espeak # RHEL/CentOS 7/8
Or:
sudo pacman -S espeak # Arch Linux
Or:
sudo apk add espeak # Alpine Linux
Or:
sudo zypper install espeak # OpenSUSE
Or:
sudo emerge -a sys-apps/espeak # Gentoo Linux
Syntax
espeak [OPTIONS] [TEXT]
espeak [OPTIONS] -f FILE
echo "TEXT" | espeak [OPTIONS]
Options
| Option | Description |
|---|---|
-v <voice> |
Set the voice or language |
-s <speed> |
Set the speed in words per minute (default: 175) |
-p <pitch> |
Set the pitch from 0 (lowest) to 99 (highest), default: 50 |
-a <amplitude> |
Set the volume/amplitude from 0 to 200, default: 100 |
-g <gap> |
Set the gap between words in units of 10ms |
-f <file> |
Read text from a file |
-w <file> |
Write speech output to a WAV file instead of speaking |
-m |
Interpret the input as SSML markup |
-x |
Print the phoneme translation of the text |
-q |
Quiet mode — do not produce audio output |
--ipa |
Print the IPA (International Phonetic Alphabet) transcription |
--voices |
List all available voices |
--voices=<lang> |
List voices for a specific language |
-k <integer> |
Indicate capital letters with a tone (1) or by speaking "capital" (2) |
--punct |
Speak punctuation character names |
1. Speak a Simple Text String
espeak "I Love TecMint.com"
espeak immediately speaks the text through your system's default audio output — no additional configuration needed if your audio is working.
The speech is synchronous by default — the command does not return to the shell prompt until it has finished speaking.
espeak has access to the audio device. On headless servers without audio hardware, espeak it will fail silently and use-w a WAV file instead.2. List All Available Voices and Languages
espeak --voices
5 af other/af Afrikaans
5 an europe/an Aragonese
5 bg europe/bg Bulgarian
5 bs europe/bs Bosnian
5 ca europe/ca Catalan
5 cs europe/cs Czech
5 cy europe/cy Welsh
5 da europe/da Danish
5 de europe/de German
5 el europe/el Greek
5 en en/ English (Great Britain)
5 en-us en/ English (America)
5 en-in en/ English (India)
5 es europe/es Spanish (Spain)
5 fr europe/fr French
5 hi asia/hi Hindi
5 it europe/it Italian
5 ja asia/ja Japanese
5 ko asia/ko Korean
5 pt europe/pt Portuguese (Portugal)
5 pt-br europe/pt Portuguese (Brazil)
5 ru europe/ru Russian
5 zh asia/zh Chinese (Mandarin)
...
espeak ships with over 100 voices. The second column is the voice identifier you pass to -v.
Filter by language group: