Festival supports text to speech for raw text files. If you are not interested in using Festival in any other way except as black box for rendering text as speech, the following method is probably what you want.
festival --tts myfile
This will say the contents of myfile. Alternatively text may be submitted on standard input
echo hello world | festival --tts cat myfile | festival --tts
Festival supports the notion of text modes where the text file
type may be identified, allowing Festival to process the file in an
appropriate way. Currently only two types are considered stable:
STML
and raw
, but other types such as email
,
HTML
, Latex
, etc. are being developed and discussed below.
This follows the idea of buffer modes in Emacs where a file's type can
be utilized to best display the text. Text mode may also be selected
based on a filename's extension.
Within the command interpreter the function tts
is used
to render files as text; it takes a filename and the text mode
as arguments.