Now have this blog read to you!

Got this link via Chris Pirillo’s site. If you notice, next to where it says “Trackback” for each entry on my site, you have a bit of text that says “Read It To Me.” Click on that to get a WAV file of the text in the entry, read by the AT&T Research Labs Text to Speech Converter. The original site had a bit of code there that displayed a button to pull it off, but I couldn’t stand having a button in my entries, so I hacked it a bit to write a text link. Here’s what I did:

In my <MTEntries> tag, I put the following:

<FORM METHOD="post" NAME="demoForm<$MTEntryID pad="1"$>" ACTION="http://morrissey.naturalvoices.com/tts/cgi-bin/nph-talk"><input type="hidden" name="txt" value="<$MTEntryBody words="49" remove_html="1"$>"><input type="hidden" name="voice" VALUE="crystal"><input type="hidden" name="rate" VALUE="8000"></FORM>

I limited the MTEntryBody length to 49 because the converter chokes on more than that, so longer entries will get cut off.

Then, my bit of text to display the link looks like so:

<a name="SpeakButton" href="javascript: document.demoForm<$MTEntryID pad="1"$>.submit();">Read It To Me</a>

This link does not have to be within the <FORM> tag to work properly, just as long as it's in the same <MTEntries> tag.

I've also put the MTEntryID in the form name and in the JavaScript call to it, otherwise you'll have a pile of forms on each page that all have the same name -- and JavaScript doesn't like that.

What do you think? I know it's a stupid feature, but so what? 😉

Comments

Say It Louder!

Thanks to UtterlyBoring I’ve changed the ‘Say It’ to a link. Blends much better than that button! UPDATE: Apparently it doesn’t like double-quotes. Just an FYI!…

Hmm… a little short tho. But the voice itself is surprising… err… sexy, actually. Sounds much better than the one Apple uses in it’s text-to-speech system.

Xkot says:

Let’s hear it for pointless features!

Shall we play a game? If you’re feeling too lazy to actually read my posts, now you can click the ‘Speak It’ link on each entry to have them read to you. The first 49 words of them, anyway, since that is the maximum it will handle. It works well with s…