Why should we humans have to exhaust ourselves yapping into microphones all day when we can make our computers do all the work for us? Let's install eSpeak, the speech synthesizer:
pi@raspberrypi ~ $ sudo apt-get install espeak
Now let's make the Pi say something:
pi@raspberrypi ~ $ espeak "I'm sorry, Dave. I'm afraid I can't do that."
If you receive warnings from ALSA whenever you run espeak
, these can be safely ignored.
We could also make it read beautiful poetry in a French accent from a file:
pi@raspberrypi ~ $ espeak -f /etc/motd -v french
Or combine espeak
with other applications for endless possibilities, as shown here:
pi@raspberrypi ~ $ ls | espeak --stdout | sox -t wav - -d reverb 99 50 0
To write the resulting speech to a WAV file, use the -w
argument:
pi@raspberrypi ~ $ echo "It's a UNIX system. I know this." | espeak -w iknow.wav
Finally, to get a list of the different voices available, use the --voices
and --voices=en
arguments.