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

spotlite

macrumors newbie
Original poster
Jan 28, 2008
18
0
Hello everyone,

I'd like to develop a small Console App that when passed in a String, will output via speakers or return/create a .wav file of said string. Very similar to what Mac OS does with its built-in Text to Speech feature. Are there any built in libraries or frameworks that support this. Thank you for your help!
 

kpua

macrumors 6502
Jul 25, 2006
294
0
It essentially already exists. Try the "say" command.

If you still want to fiddle with it, look at the SpeechSynthesis framework.
 

asciimov

macrumors newbie
Jan 31, 2008
10
0
in terminal take a look at the manual page for say

ie... in the terminal type man say

you will find that the flag for output is -o

so if you typed in terminal say -o wave.aiff "Hello, I am talking."
It will generate an aiff file with the spoken text in the directory that you run the command from (pwd will give you the current directory in terminal)
 

toddburch

macrumors 6502a
Dec 4, 2006
748
0
Katy, Texas
Cool. That worked great. However, when I double clicked it, it opens iTunes, played it, and added it to my library. How can I play the saved aiff without iTunes involvement?

Thanks, Todd
 

asciimov

macrumors newbie
Jan 31, 2008
10
0
use say without the -o flag, and say will just output sound
ie... say "hello how are you"
 

kpua

macrumors 6502
Jul 25, 2006
294
0
open -a "Quicktime Player" <file> to open it from the command line in Quicktime.
 

kainjow

Moderator emeritus
Jun 15, 2000
7,958
7
A right-click allows me to open it with Quick Time. I was wondering if there was a command that would play it.

AFAIK there is no built-in command to play audio files, but there is an open source app called qtplay that you can download that does this.
 

don't do it

macrumors regular
Apr 18, 2008
101
0
somewhere on the Earth
Here is a applescript that will do what you want it to it will first ask for a voice to use then what you want changed to speech then where you want to save it. Also keep the .aiff part there otherwise it will not work and you can change it to an .mp3 file in iTunes just make sure it opens in something other than iTunes. Also it might have some bugs so if anyone would be so kind as to fix them and tell me about them that would be great.:D
 

Attachments

  • Text to Speech V 1.1.zip
    22.9 KB · Views: 111

CaptainZap

macrumors regular
Jan 17, 2007
170
0
If you want a simple command line audio player, look in the TextMate resources, you should find one called play. It works nicely and can even play the audio of videos.

It is in Contents/SharedSupport/Support/bin
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.