Introduction
eSpeak can generate text-to-speech (TTS) audio files. This is useful for many purposes, such as creating audible CAPTCHA tests.
Install eSpeak
Log in as the root user.
Follow our best practices guide the update the server.
Install eSpeak.
# apt install espeak
Test eSpeak
Create a test WAV file with the following parameters.
Output file: /tmp/espeak-talk.wav
Content: Speak the letters y j w c t j
Word gap: 60
Pitch: 70
Speed: 100
# espeak "y j w c t j" -w /tmp/espeak-talk.wav -g 60 -p 70 -s 100
Other eSpeak Options
eSpeak supports text file input. Create /tmp/example.txt
# echo "The quick brown fox jumps over the lazy dog." > /tmp/example.txt
Generate the WAV file.
# espeak -f /tmp/example.txt -w /tmp/example.wav
eSpeak supports different voices. List the installed voices.
# espeak --voices
Pty Language Age/Gender VoiceName File Other Languages
5 af M afrikaans other/af
5 an M aragonese europe/an
5 bg - bulgarian europe/bg
5 bs M bosnian europe/bs
5 ca M catalan europe/ca
5 cs M czech europe/cs
...
Use the -v parameter to generate an example audio file with the afrikaans voice.
# espeak -v af -f /tmp/example.txt -w /tmp/exampleaf.wav
References
See the eSpeak documentation for more information.