How To: Make the espeak voice sound better

If you have espeak installed on your system you know how the default voice from it might sound. The good news is, that you can pipe the output to another program.


And here is a simple video I made to demonstrate what I am talking about:
(Apologies for bad quality)

Now in the video I talk about how to turn a .wav file from espeak into a chorus-like robot voice. I also took the time to write some bash-scripts to accompany the audio, like outputting the text character per character. However one thing i did not mention was that you can simply pipe the output of espeak into sox assuming you have it already installed on your box.

Enough talk, here is some code:

espeak “Hello robots” —stdout | play -

Now the above does nothing just play the sound normally. The play is just a common alias for sox and it tells it to just play the sound. Lets add some effects to it:

espeak “Hello robots” —stdout | play - chorus 0.6 1 35 0.6 5 0.8 

If you hit enter, you will hear that the voice has got some chorus to it now.
If you know how to manipulate sox you can now add all sorts of effects to it.
But if you liked the voice in the video, copy and paste the following into a file:

#!/bin/bash espeak $* —stdout | play - chorus 0.6 1 35 0.6 5 0.8 -t reverb 30 60 35 40 phaser 0.8 1 3 0.30 -t bass 5 120 flanger 0 3 -20 85 5 triangle 70 gain 5 norm

Make it executable with: chmod u+x copied.sh
To use it like espeak, do the following:

/path/to/copied.sh “Hello robots”

And that will output “Hello robots” with the effects added to it.

If you are interested in the bash-scripts, you can download them from my website:linuxsake.eu5.org
They include the little bash script that output a text character per character.

A final note: If you really want to go for the overkill, consider checking out HakTips - Free text to speech with Linux
Combine it with the script presented above to get the most out of it. They talk about piping a selection of text to festival through pressing a key combination and have the computer speak.
Have fun with text-to-speech!


Follow me on twitter: @Linuxsake
Website:linuxsake.eu5.org