You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Can I save Text to Speech to an Audio File?

I know I can right-click some text, and have it save the spoken track to iTunes. Is it possible to get the spoken track to be saved to a user-specified location rather than iTunes?

iMac 2.66 GHz standard configuration (April 2008), iPod Touch 1st Gen OS 3.1.2, Mac OS X (10.6.2), D-link DIR-625 router, iLife 09, iWork 09, XCode 3.2.1 (64-bit)

Posted on Jan 6, 2010 5:10 PM

Reply
Question marked as Top-ranking reply

Posted on Dec 15, 2010 6:55 AM

An AppleScript can say something to a file (see *Standard Additions* for other options), so you could use a *Run AppleScript* action in Automator to add a Service, for example:
<pre style="
font-family: Monaco, 'Courier New', Courier, monospace;
font-size: 10px;
font-weight: normal;
margin: 0px;
padding: 5px;
border: 1px solid #000000;
width: 720px;
color: #000000;
background-color: #B5FF6C;
overflow: auto;"
title="this text can be pasted into the AppleScript Editor">
on run {input, parameters}

say (input as text) saving to (choose file name default name "Speech.aiff")

-- return input
end run
</pre>
6 replies
Question marked as Top-ranking reply

Dec 15, 2010 6:55 AM in response to musicwind95

An AppleScript can say something to a file (see *Standard Additions* for other options), so you could use a *Run AppleScript* action in Automator to add a Service, for example:
<pre style="
font-family: Monaco, 'Courier New', Courier, monospace;
font-size: 10px;
font-weight: normal;
margin: 0px;
padding: 5px;
border: 1px solid #000000;
width: 720px;
color: #000000;
background-color: #B5FF6C;
overflow: auto;"
title="this text can be pasted into the AppleScript Editor">
on run {input, parameters}

say (input as text) saving to (choose file name default name "Speech.aiff")

-- return input
end run
</pre>

Dec 15, 2010 6:56 AM in response to red_menace

I know almost nothing about AppleScript, so I probably wouldn't know how to use that...What I'm looking for is a service or a extension to the right-click menu in Snow Leopard when I select some text so tt, similar to "Add to iTunes as a spoken track", I'd like it to prompt for a folder, and then convert the text to audio and output the result to the selected folder. Does that make sense?

Dec 15, 2010 6:56 AM in response to musicwind95

It is fairly easy to make a Service using Automator. When launching Automator, it will ask for a template to use - select Service. The default template will receive selected text from any application, so the only thing needed is to drag the *Run AppleScript* action (located in the Utilities category) into the workflow document and edit the script.

The AppleScript I posted previously (paste it into the *Run AppleScript* action) will put up a standard file dialog to select a name and location for the sound file that will be created from the selected text. After saving the workflow, it will be available in the Services menu.

Dec 15, 2010 6:56 AM in response to musicwind95

There are a few different ways to format script/code snippets. Placing your code between two {code} statements will (mostly) keep the forum from mangling the formatting, and you can also use HTML. I use an AppleScript that formats a script copied to the clipboard with HTML, it is available here. There is also a code formatting script in the *User Tips Library* here.

There are quite a few AppleScript resources out there, such as:
http://macscripter.net/
http://www.macosxautomation.com/
http://www.scriptweb.com/

...and Apple's Developer documentation, of course:
Introduction to AppleScript Overview
AppleScript Fundamentals
Introduction to AppleScript Language Guide

Can I save Text to Speech to an Audio File?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.