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

messhof

macrumors newbie
Original poster
Feb 12, 2008
4
0
Hi,
I'm trying to convert a series of transcribed interviews to spoken text through applescript. So far I've been using:

Code:
say "this is what one person says" using "Ralph" saving to file (((path to desktop) as string) & "test.aiff")

But I'd like to use two different voices (eg. "Ralph" and "Fred") to differentiate the two speakers. This is very time consuming to do with the above script. What I'd like to have is a script that takes a text file like this:

Ralph: Where were you born?
Fred: Montana
Ralph: I see

And uses the strings "Ralph: " and "Fred: " to create speech files with the different voices as well as a number in the filename to show it's position in the conversation. I guess ideally it would just create one speech file with all the back and forth speech files compiled, but I have a feeling that isn't possible with applescript... although maybe it can do it through quicktime or audacity.

Any help is much appreciated!
-Mark
 

toddburch

macrumors 6502a
Dec 4, 2006
748
0
Katy, Texas
A ruby (or other language) could be written to take the form you want and produce the form you need. I can help. Send it to me in the form you want to write (or post a URL where I can get it) and I'll make it look like the form you need. Sounds fun!

Todd
 

messhof

macrumors newbie
Original poster
Feb 12, 2008
4
0
Well I think I'd need the script myself as I'd be doing this every week for a podcast, but my transcripts look just like the quote I posted--
Ralph: Where were you born?
Fred: Montana
Ralph: I see
And I think I would just use the Ralph and Frank mac speech voices. Maybe add the recognition for Vicki, Victoria, and the rest in case I have more speakers?

It would be so awesome if you can help!
 

toddburch

macrumors 6502a
Dec 4, 2006
748
0
Katy, Texas
That's what I meant - I'll give you the script (well, I'll just post it here).

I'll set it up to work with any voice left of the colon. I can do this tonight.

Todd
 

toddburch

macrumors 6502a
Dec 4, 2006
748
0
Katy, Texas
OK, here you go. There are two different versions of this ruby script.

The first one, called saydialog.rb, generates the applescript "dialog.scpt" and puts in on your desktop. You can then run dialog.scpt to generate the aiff files. They are numbered test1.aiff through testnn.aiff.

The second script, saydialog_and_play.rb, generates the same applescript as above, but then goes on to play the dialog (without actually creating the test1.aiff + files) for you to preview them.

To run either ruby script, stick them in a folder or on your desktop, then open Terminal and navigate to the folder. On the command line, enter:

Code:
$ ruby saydialog.rb input_file_name 

or 

$ ruby saydialog_and_play.rb input_file_name

where input_file_name is the name of the file with your dialog, like "dialog.txt" or some such name. If your dialog file is not in the same folder, then qualify it so Ruby can open it.

I've also attached the file I used to test this with called saytext.txt. To use it, you would type:
Code:
$ ruby saydialog.rb saytext.txt
assuming they were both in the same folder.

Todd

p.s. I had to add a .txt extension to both scripts so I could upload them. Rename them by removing the .txt extension.
 

Attachments

  • saytext.txt
    86 bytes · Views: 134
  • saydialog_and_play.rb.txt
    634 bytes · Views: 119
  • saydialog.rb.txt
    529 bytes · Views: 136
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.