|
Usage Examples:
Play the System Log:
#tail -f /var/log/messages |festival --tts | sox -t wav - -t ossdsp /dev/audio echo 1 2 150 1
If that didn't work, which is very likely, then you need a more structured test method.
First create a text file to read:
$echo "hello world" > hello.txt
$festival --tts hello.txt
Play with the above and the Kmix sliders, till you can hear it talk to you.
The --tts switch means Text To Speech. Tie echo and festival together:
$echo "hello world" | festival --tts
Read the system log file:
$su -
password
#tail -f /var/log/messages|festival --tts
If it is a HTML file, then you need to strip the HTML tags and the Lynx text browser can be put to
good use, to do that on the fly:
$lynx -dump filename | festival --tts
For laughs, you can do this:
$lynx -dump http://slashdot.org|festival --tts
It is difficult to remove the annoying brackets from a web page, since grep uses a bracket as a
reserved character. An inverse literal match works. It breaks the bracketed tags and then Festival
ignores what is left. The following example removes brackets and vertical bars from a web page.
The result sounds quite acceptable:
$lynx -dump http://slashdot.org | grep -v -F "[" | grep -v -F "|" | festival --tts
To read PDF files, pipe together pdf2ps and ps2ascii like this:
$pdf2ps filename | ps2ascii | festival --tts
Read Email
The trick with email, is to use formail to filter out the subject and body parts of the incoming
messages, so that Festival doesn't have to slog through all the boring headers.
First, you have to find your mail Inbox. On this machine, my inbox is in
~/.thunderbird/default.hhj/Mail/mail.aeronetworks.ca.
So, change directory and try the following formail command:
#cd ~/.thunderbird/default.hhj/Mail/mail.aeronetworks.ca
# tail -f Inbox | formail -s formail -k -X From: -X Subject: | festival --tts
The tail utility reads any new additions to the Inbox and pipes it to formail. Formail splits the
mailbox up into separate mail messages and feeds each message to another copy of formail, which
extracts the From: and Subject: headers. The k parameter tells it to keep the body as well.
The result is piped into Festival.
Whenever a new mail message lands in my Inbox, Festival now reads it for me - small things, yeah,
I know... ;-)
Files Conversion:
16 kHz, 16 bit, mono are perfectly OK for pure speech.
Text2wav
- Convert from text to wave format:
$text2wave hi-dave.txt -o hi-dave.wav
- Convert from wav to ogg format:
Simplest version. Produces output as somefile.ogg.
$oggenc hi-dave.wav hi-dave.ogg
Specifying an output filename.
$oggenc dave.wav -o dave.og g
Opening with wav module: WAV file reader
Encoding "dave.wav" to
"dave.ogg"
at quality 3.00
[ 96.0%] [ 0m00s remaining] /
Done encoding file "dave.ogg"
File length: 0m 19.0s
Elapsed time: 0m 00.3s
Rate: 76.0444
Average bitrate: 31.1 kb/s
Specifying a high-quality encoding averaging 256 kbps (but still VBR).
$oggenc infile.wav -b 256 out.ogg
Specifying a maximum and average bitrate, and enforcing these.
$oggenc infile.wav --managed -b 128 -M 160 out.ogg
Specifying quality rather than bitrate (to a very high quality mode)
$oggenc infile.wav -q 6 out.ogg
Downsampling and downmixing to 11 kHz mono before encoding.
$oggenc --resample 11025 --downmix infile.wav -q 1 out.ogg
Adding some info about the track:
$oggenc somefile.wav -t "The track title" -a "artist who performed this" -l "name of album" -c
"OTHERFIELD=contents of some other field not explicitly supported"
This encodes the three files, each with the same artist/album tag, but with different title tags
on each one. The string given as an argument to -n is used to generate filenames, as shown in the
section above.
This example gives filenames like "The Tea Party - Touch.ogg":
$oggenc -b 192 -a "The Tea Party" -l "Triptych" -t "Touch" track01.wav -t "Underground"
track02.wav -t "Great Big Lie" track03.wav -n "%a - %t.ogg"
Encoding from stdin, to stdout (you can also use the various tagging options, like -t, -a, -l, etc.):
oggenc -
- Convert from wav to mp3 format:
$lame hi-dave.wav hi-dave.mp3
- Listen to the result:
$xmms hi-dave.mp3
|