Make Your Own Audiobook Podcast with Text To Speech

Sep
08
2005

A recent posting on how to Turn Any RSS Feed Into A Podcast, Using Text-To-Speech echoed the earlier posting I made on using PHP or Javascript to do Text-to-Speech. However, their sample really was lacking in sounding like something I'd want to listen to for an hour or 2. His system also seemed to be a bit overly complicated for much of the process as I don't really need all of my feeds processed this way. Doing a few semi-manually makes more sense for me. The result (hear a sample) is a classic geeky lifehack: custom code to do a simple job and make my life easier.

Cepstral offers a series of voices for the MS TTS engine that sound 100x better than the default voices that come with Windows. They run about $30. Here's a sample I made using their "Diane" voice and the JScript.NET sample from this posting. If you're torn between the voices, get the "Diane" voice as it's the biggest file (most complex logic for pronounciation) . Also be sure to get a voice in the same dialect as your own. You'll already be tuning your ear to the "TTS" accent and adding another accent to the mix is going to result in lots of "what did she say?" kinds of moments. Trust me on this one. I also have the "Millie" voice and often miss what she's saying in longer blocks of text. Do note that the license for redistributing the audio isn't exactly wide open, so check before you get dreams of building some massive service using these voices.

My JScript.NET TTS that turns text file into .wav file

import System;
import System.Reflection;
import System.IO;
var $voice;
var $text;
var $text_command;
var $content;
var $stream;
var $filetext;
var $fs;
var $ts;
var $filestream;
var $filename;
var $args = System.Environment.GetCommandLineArgs();

$text_command = $args[1];
$voice = new ActiveXObject("Sapi.SpVoice");
$filestream = new ActiveXObject("Sapi.SpFileStream");
$fs = new ActiveXObject("Scripting.FileSystemObject");
$ts = $fs.OpenTextFile($text_command, 1, 1);
$content = $ts.ReadAll();
$filename="podcast.wav";

$filestream.Open($filename, 3, 1);
$voice.AudioOutputStream = $filestream;
$voice.Speak($content);
$filestream.Close();

Compile this using the jsc.exe compiler? from the free .NET SDK to get txt2wav.exe. Now you can run it, pointing to a .txt. It will dump out "podcast.wav". You can easily extend this to then run "lame.exe podcast.wav" and get a quick MP3 out of the end.

If you have LAME installed already, you can create a shortcut to lame.exe and put it somewhere convenient, like your desktop and you can just drag your .wav onto the shortcut and you'll get the MP3 that way too.

 

Comments on this post

Feedback is always welcome. Read some from other folks or leave your own below. Just keep things civil and remember that what you post lives on in public. Forever.

Thanks,
J

One Response to “Make Your Own Audiobook Podcast with Text To Speech”

  1. LetterJ Says:

    Incidentally, this is pretty much what Talkr.com is doing to make their podcasts as near as I can tell.

Leave Your Own Comment

By submitting a comment, you agree to license it under the terms of the Creative Commons Attribution license.

People who post comments get the added benefit of visiting the site without advertising.

© 2003-2008 J Wynia. All original content is licensed under the terms of the Creative Commons Attribution license unless otherwise noted. Content from other sources is licensed under its original terms.