Sometimes I come across an article on the web that I want to read, but I just don't have the patience or time at that precise moment. So I wrote this little script that takes a plain text file as input, and generates an audio MP3 using Vicki's voice. Then you can load the MP3 onto your iPod or other portable player and listen on the run. If you save the following script as
txt2mp3 (make it executable, too!), then you simply type
txt2mp3 textfile at the Terminal's prompt to convert your file. The script assumes that you have the
LAME encoder installed on your system.
#/bin/csh
strings $1 > /tmp/$1.txt
say -v Vicki -f /tmp/$1.txt -o /tmp/$1:r.aiff
rm -f /tmp/$1.txt
lame --quiet /tmp/$1:r.aiff $1:r.mp3
rm -f /tmp/$1.aiff
[
robg adds: An
earlier hint covers the use of the
say command to convert text files to audio AIFF files.]