FreeTTS
Jump to navigation
Jump to search
FreeTTS is a text-to-speech engine written in Java, available from http://freetts.sf.net/.
Reading text into a WAV file
The following command reads src.txt into dst.wav.
java -jar (installdir)/lib/freetts.jar -dumpAudio dst.wav -file src.txt
For decoding purposes, it may be important to note that the produced file (on my system, anyway) is PCM, 16000Hz, mono, 16-bit. Getting it into CD-quality form with SoX isn't hard, but it seems to take two passes (one for samplerate and one for channel) or it will screw up. Try
sox dst.wav -r 44100 -c 1 tmp.wav sox tmp.wav -r 44100 -c 2 dst.wav
I wrote a script called voice which does this automatically. It is designed for Cygwin; changing it for Unix should be trivial. The parts involving cygpath are only required because the versions of SoX and Java I am running are the native Windows versions and require Windows filenames.
#! /bin/sh TTS=/(insert freetts path here)/lib/freetts.jar WTTS=$(cygpath -w $TTS) ONE=/tmp/t-$$-temp1.wav WONE=$(cygpath -w $ONE) TWO=/tmp/t-$$-temp2.wav WTWO=$(cygpath -w $TWO) echo "Input: $1" echo "Output: $2" java -jar "$WTTS" -voice kevin16 -dumpAudio $WONE -file $( cygpath -w $1 ) && sox $WONE -r 44100 -c 1 $WTWO && rm $ONE && sox $WTWO -r 44100 -c 2 $( cygpath -w $2 ) && rm $TWO