Back to index

Reading mail with flite/festival speech synthesis

As I planned to use the previously mentioned audio-enabled Sheevaplug as a kind of DIY-Squeezebox-alarm-watch bedroom music player, I thought it would be fun to add a simple audio-based mail reader utility. The previously mentioned ir remote handler triggers this mail reading feature when the "music button" key is pressed.

Installing Flite

Flite (festival-lite) is available as a regular Debian package, so installing it is easy: apt-get install flite alsa-oss
aoss flite "Hello world"
Note that flite assumes OSS audio API, so if you use ALSA you need the aoss wrapper tool to get any output.

Polling for new IMAP mail

To retrieve the list of new mail headers from the IMAP server, PHP provides an easy to use API. The script looks for UNSEEN messages, parses the headers and feeds them to flite.

Here's a simple PHP script that puts everything together: imap-to-speech.phps (run it from the CLI).