Thursday, May 20, 2010

Text to speech

I've decided to step beyond the limits of the audio books available at librivox by using text to speech to generate audio books from Project Gutenberg files. I'm currently using the Ivona Amy voice, which is a lovely British voice, but I may use Brian, too (for free 30 day trials, download their Ivona Reader). My initial conversions of the text files to ogg were with Expressivo, but my plan is to do the rest of the conversions with a perl script that calls the Windows SAPI interface for the voices. You can get the script here (which I hereby release under the FreeBSD license). It can be used as follows: perl txt2ogg --voice=amy InputFile.txt (this assumes you have no other voice with "amy" in it; if you do, you may need to include more text--the voice=... option takes a perl regular expression). If you want to pre-listen to the voice, do: perl txt2ogg --voice=amy --outloud InputFile.txt. Interrupt with ctrl-c.

1 comment:

Alexander R Pruss said...

I added a --split=re option, where re is a perl regular expression for recognizing chapter or part breaks. The ogg files are then broken up.

For instance, "--split=^CHAPTER [0-9]+" does the job on one Project Gutenberg book I am converting. (The quotes are so the shell doesn't break this up into separate arguments.)