Wednesday, May 11, 2005

Making a Linux Computer Talk

I'm back from the trip. I've got a lot of topics I want to post, but first, today I read an article from this month's issue of Linux Gazette (.net), titled, Shelling your Linux box with Festival, which tells you about a Linux speech synthesis program, Festival.

The article has some neat tricks, such as having your computer read the headlines from the BBC News Feed.

However, what I want to talk about isn't in the article. What I want to do is to create a greeting which can be heard online, such as this one.

It's not too hard. In the Festival distribution is a program called text2wav, which seems to create .wav files. Anyway, this works:

$ echo "Please reed Linux and Things" | text2wav > plsrd.wav

where we have to say "reed" rather than "read", since Festival wants to put the latter in the past tense.

OK, that's a .wav file, which is 66498 bytes. I can compress it into an MP3 file using the MP3-enabled version of sox:

$ sox plsrd.wav plsrd.mp3

which comes in at 6588 bytes. Of course, I should use a politically correct format such as Ogg, but this way more of you can hear the voice.

Festival has other tricks, including a British accent, but I haven't figured out how to use them yet.

2 comments:

Anonymous said...

Thanks for the info about the tool.

Anonymous said...

There is another called espeak. The syntax can be $espeak "Please read linux and things" or you could parse a file eg. $cat foo.txt | espeak. This comment box won't let me do redirection, it sees it as broken html.
Thanks for the tip though. I'll have to try festival now.