views:

83

answers:

4

In applescript there is a say command. Is there something like this for objective c?

Thanks, Elijah

+1  A: 

You can just use NSTask to run the 'say' commandline program

SO Description

ACBurk
+5  A: 

Cocoa also has the NSSpeechSynthesizer class.

Philip Regan
Yep, in fact one of the first exercises in Hillegass (Cocoa programming for Mac OS X) is a simple GUI app that says whatever you type in the textfield, after clicking a button.
Henno Brandsma
A: 

Are you switching to the windows environment?? If so, you can utilized the Speech SDK:

http://msdn.microsoft.com/en-us/library/ms723627(VS.85).aspx

Here is an example of how to implement it in C# (sorry, not that familiar with C, hopefully its helpful):

http://www.c-sharpcorner.com/UploadFile/ssrinivas/TextToSpeechConversioninCSharp11222005060134AM/TextToSpeechConversioninCSharp.aspx

If you aren't switching to windows, hopefully there is a way to use the say SKD...

tylerthemiler
Given that he mentions Applescript and Objective-C, it seems extremely unlikely that he'd be using Windows or C#.
Chuck
+1  A: 

On the iPhone there is no way. If you are talking about mac code, Cocoa has a class to do this (NSSpeechSynthesizer).

Code:

NSSpeechSynthesizer * syn = [[NSSpeechSynthesizer alloc] init];
[syn startSpeakingString:@"my string"];
Cappuccino Plus Plus