MacMost Now 424: Convert Text to Spoken Word Audio

Learn how to use Automator to convert selected text, or text from a file, to audio. You can listen to the result on your Mac, iPod or iPhone while on-the-go.

Video Transcript
Hi, his is Gary with MacMost Now. On today's episode, let's convert text to spoken audio.
So consider the situation where you've got a long text document, maybe a report or a news article, that you want to read and you've got a long car ride or perhaps a jog in the future. Well, you can create an audio file of spoken text from that document using Automator. Let's take a look.
So when we run Automator, first thing we want to do is choose the template, we'll just do a simple workflow here. Then on the left we can search for commands to add to the right. Now what appears here will depend on what applications you have installed, but some of the defaults are always there. Like, uh, the get contents from clipboard. We'll drag that over and add that. And then we'll search for speak, and, if we actually search for speech we can look and find text-to-audio file. We'll drag that there. So we have a very simple thing where you have the contents of a clipboard and then it puts the text to an audio file. Now it'll ask for a voice and if we just find a file name here, what we can do is instead of defining the file name we go to options and check off show this action. And that means that when it gets to the step instead of just doing these defaults it'll actually prompt us, ask for voice and a file name and location to save to, which is what we want so we can name it something appropriate. So let's test it out here. In the web browser I've selected some text I'll copy it to the buffer, and then I'll go back to Automator, and hit the run button and then it will prompt me for voice and a file name. Then when it's done, I will see that there's a file now created on the desktop and I play it, I can see what the results are. is a site for people who want to learn more about their Mac-
So let's say we don't want to just select a text, we want to actually convert a file. So we can do that by changing what's here at the beginning. Let's remove the clipboard function there. And, let's start with files and folders here on the left, and ask for finder items, I'll drag that over there. And, you can customize this if you want. So the next step we want to do is open that file, and we can do that using the open finder items action. Put that right there. And, it'll ask us what to open it with. We can select from the list text edit. And then the next thing after that would be to get the content of the text edit document. So we'll search for text edit. And we can see it get contents right here. So it'll now it'll ask for a finder item, open it in text edit and get the contents of the current text edit document and then we'll feed that into the audio file we're gonna create. So let's test it out on the desktop I've got test.rtf which is a text-edit document, I will choose it, and then it will prompt me for the name of the file to export. And, when I'm done I actually have this file here, it's test2.aif. And I can try it out.
This is a test.
So you can continue to use this as an automated work flow. You could also save it as an application by going to save as, and, file format application.
So once you have an audio file like that you can just drag and drop it into iTunes, drag and drop it into a playlist there, and sync it with your iPod and your iPhone and very quickly and easily you can a file to listen to while on the go. Hope you like this look at creating spoken text audio files, until next time this is Gary Rosenzweig with MacMost Now.

Comments: 14 Responses to “MacMost Now 424: Convert Text to Spoken Word Audio”

    7/14/10 @ 2:45 pm

    Hi Gary,

    I always forget about Automator, so I was glad to see this presentation. However, the first time I run my, it fails to complete. If I leave TextEdit open, it seems to work correctly after that.

    Here is the message I get:

    The action “Get Contents of TextEdit Document” encountered an error.

    Check the action’s properties and try running the workflow again.

    I’m running OS 10.6.4. Any ideas?



      7/14/10 @ 2:48 pm

      So are you saying you need to have TextEdit running in the first place in order for it to work? That’s odd. Does it do that even if you run the workflow in Automator instead of a stand-alone app? If so, what happens when you run it step-by-step?

        7/14/10 @ 3:23 pm

        It doesn’t seem to do it in Automater, just as an app. However, I found that by adding a “Pause” of 1 second after “Open Finder Items”, it works correctly.

        Obviously, I have a lot to learn about Automator!

        Thanks, Drew

    7/15/10 @ 8:01 am

    Hi Gary,

    I use a couple of these one for text files and one for PDFs. I use the PDF one so that I don’t have to read boring files from work, I can just have them read to me on the commute.

    Text one:
    Set value of variable (use filename)
    open finder items (select textedit)
    Get contents of textedit document
    Text to Audio file (save as Filename (the variable from above))
    Import files into iTunes (create a playlist that they will be added to)

    PDF one:
    extract PDF text
    open finder items
    Get contents of textedit document
    Text to Audio file
    Import files into iTunes (create a playlist that they will be added to)


    brian whitnell
    7/15/10 @ 12:58 pm

    Hi Gary
    Please clarify what happens at 2.29, ie how do I choose the doc I want to hear?

      brian whitnell
      7/15/10 @ 12:59 pm

      NB In my earlier post, I mistyped 2.59 as 2.29.

        7/15/10 @ 3:49 pm

        You select the text document in the Finder and then run the script.

    7/26/10 @ 3:51 pm

    Hi Gary,

    Your podcasts are always interesting and informative, but this one was an absolute GEM! Being able to take text with me in the form of audio files is absolutely crucial to someone like me who works full time, AND has a part time job, AND is going to school.

    Now for my question: Looking through the built in commands in Automator, I found one which automatically sends the aiff file to iTunes. That’s all well and good, but once I have it there, I don’t need the original file and would just as soon not have it cluttering up my hard drive. However, every time I tried to have Automator automatically send that file to the Trash, it failed. It either sent the iTunes file to the trash, or trashed the whole “Text to Speech” folder I created. Any ideas?

    I am so appreciative of any feedback you can offer.

      7/26/10 @ 4:03 pm

      Are you using AppleScript variables? If not, they it won’t work. You see, when you move the audio file to iTunes, then and try to put “it” in the trash, it will think “it” is the result of the last action, which is the iTunes audio, not the original file. You’d need to store the file in a variable, then import into iTunes, then recall the variable to put it in the trash — it gets complex, as you can see.
      So you have to decide whether you want to delve more deeply into Automator, AppleScript and variables, or just settle for what you have now.

    9/3/10 @ 2:59 am

    I did that all the time. But now in iTunes10 it broke. So I rewrote it in Applescript.
    Feel free to take a look at it. Its pretty individualized for my needs though. So you have to adapt it to make use of it.

      9/3/10 @ 7:49 am

      I’ve heard about the Automator bug in iTunes 10, and I’m sure it will be fixed shortly (10.0.1 or whatever).

        9/3/10 @ 1:57 pm

        I forgot to say that I use this with Launchbar. But with some AS knowledge you can easily replace the “handle_string” section with e.g. a dialog.

        And yes, there is already a fix for the Automator bug
        I’m not sure how quick Apple will be with an official update though. They tend to play rather with there i-products recently.

    2/9/11 @ 2:20 pm

    I do not see Get from clipboard in my Library Actions. What am I missing?

      2/9/11 @ 2:21 pm

      Perhaps you aren’t looking at all of the actions. Make sure you haven’t selected a subset. Also, which version of OS X do you have?

Comments Closed.