It uses sox to convert the wav’s to .ogg which seem to play OK on my Nexus One. To install sox on Ubuntu, just do:

sudo apt-get install sox

Please feel free to leave a comment if you know how to do it for another platform.

It sits in a loop and checks for messages every 2 minutes, converting them if it sees a new one. So, you’ll probably want to run it on a server in a screen session. Or maybe it’d be better in cron and delete the loop/sleep.