[linux-audio-user] Piping multiple text documents into Audio

Jeremiah Benham jjbenham at chicagoguitar.com
Mon Dec 6 09:36:17 EST 2004

On Mon, Dec 06, 2004 at 10:26:59AM +0200, mark at kfm.co.za wrote:
> Hello Everybody
> I have a lot of text documents that I wish to output into speech 
> audio. Firstly I wanted to know if there is any software that would 
> allow one to do this. This could be likened to an educational tool 
> of sorts that reads a file. 

festival comes with a program called text2wav. It does just what your are asking. Also if you do:
echo 'hello' | festival --tts

You can change the voices also.

you can do something like this in python if you want a seperate wav for each word (will probably make it easier if you want to only parts of words and such):

import os
x = ['the', 'way', 'that', 'can', 'be', 'experienced', 'is', 'not', 'true']
for s in x:
        os.system('echo %s | text2wave > tmp/%s.wav'% (s, s))
        os.system('sox tmp/%s.wav -r 44100 %s.wav '% (s,s))


More information about the Linux-audio-user mailing list