Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

jongleurjon

macrumors newbie
Original poster
Apr 28, 2010
4
0
Glasgow, UK
Hi,

I’m preparing a linguistics experiment for my university degree. I need my Mac to read words to the participant, who must memorize and recall these at a latter stage. I want to use Apple’s VoiceOver (i.e., Alex) for this, so that I can quickly create recordings that are pronounced in a uniform way.

Each participant will have a slightly different set of around 30 words, so overall I’m going to require many VoiceOver recordings. I could prepare these manually by, for example, typing the word into TextEdit > CTRL-click > Speech > Start speaking, and then record my Mac’s sound output, but ideally I want a much faster method. Also, each participant’s set of words will be generated by the previous participant, so I need to be able to prepare the recordings quickly in time for the next participant.

Therefore, what I need is an application/AppleScript/Automator workflow/whatever that will help me produce VoiceOver recordings. I.e., I input a list of 30 words, and it generates 30 sound files (ideally AAC or MP3) of these words. The filename of each sound file would reflect the word it contains.

I’m hoping someone here might be able to recommend the best way I can go about achieving this?

Thanks for reading and I hope the above makes some kind of sense...

Jon.
 
(Incase anyone’s looking for an answer to this...)

In the terminal you can use the Say command to generate a sound file of any given text. Type:

say -o filename.m4a "Hello world"

to generate such a file. You can also generate .aiff files (and probably other formats too) by providing the relevant extension to the filename.

I’m going to try work out an AppleScript to do this en masse.
 
(Incase anyone’s looking for an answer to this...)

In the terminal you can use the Say command to generate a sound file of any given text. Type:

say -o filename.m4a "Hello world"

to generate such a file. You can also generate .aiff files (and probably other formats too) by providing the relevant extension to the filename.

I’m going to try work out an AppleScript to do this en masse.


Don't bother with Apple script. A simple shell script is easy, just one line.

There is a command called "foreach" it works like this

foreach x in (a, b, c, d, e, f)
say $x.mp3 "$x"


The foreach command will run the say command once for each item in the list changing the vale of X to be equal to each list item.

See the man pages (in terminal for the exact syntax of foreach.
 
There is a command called "foreach" it works like this

foreach x in (a, b, c, d, e, f)
say $x.mp3 "$x"

Thanks, Chris. This is exactly what I need. I just don’t know how to implement it. I’ve created a shell script (in Xcode) with the exact syntax you gave above, saved it, ran it in the terminal and got the following error "syntax error near unexpected token ‘(’ . What am I doing wrong? (Sorry, I haven’t worked with shell scripts before.)

Apple’s man page here gives slightly different syntax, but I can’t get that to run either.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.