Supporting Ads

Sunday 7 September 2008

HowTo: Create an Audio File from a Text File

The new voice for Leopard, Alex, is an extremely comprehensive and realistic voice module, so it is worth looking at how you can use it to help you work. Got a long document to read, or a speech to memorise? This 3-step tip will show you how to get it into an audio file so you can listen to it on an ipod while commuting, or even turn a free online novel into an audiobook.

1) The first thing you need to do is ensure your document is in plain-text format. The easiest way to do this is to copy the contents into "TextEdit.app", go to the Format menu and select "Make Plain Text". For simplicity save this file as "wordstosay.txt" in the root folder of your "Macintosh HD".

2) Now our document is ready, open Terminal.app using spotlight or from the Utilities sub-folder of your Applications folder. When it opens, type "cd /" and hit return. This tells terminal that you are working in the root of Macintosh HD, and makes finding the text file much easier.

3) To get your mac to read out this text file to an audio file, type the following and hit return: 

say -v alex -f wordstosay.txt -o spoken.aiff

Lets have a look at what this command means. The "say" bit is simply the name of the program used to make your mac talk, and "-v alex" sets the voice as Alex. "-f [filename]" tells your mac where the text file to read from is, and "-o [filename]" tells it to output the speech to an audio file instead of reading out loud. If all has gone well, you should now find a file called "spoken.aiff" in the root of your "Macintosh HD" that you can load into iTunes.

Tip: If you want to get Alex to read content out for you regularly, a useful tip is to set a keyboard shortcut like ctrl-s by going to System Preferences > Speech > Text to Speech > Speak selected text when the key is pressed.

4 comments:

Anonymous said...

Good blog!

You might want to write up the "MouseLocator" utility, available at http://www.2point5fish.com/index.html .

A really handy utility for Mac users with small mouse cursors and large screens.

Tom Howe said...

Thanks for the tip. I'm downloading it now...

Caleb Nelson said...

A great freeware app that does this same thing is "Say it Save it".

Tom Howe said...

nice app find! it makes sense for someone to make an app like that when the shell-script is already there.