1

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

Thanks, Elijah

objectiveccoder001
  • 2,981
  • 10
  • 48
  • 72

4 Answers4

6

Cocoa also has the NSSpeechSynthesizer class.

Philip Regan
  • 5,005
  • 2
  • 25
  • 39
  • 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 Aug 05 '10 at 17:31
2

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"];
Alex Nichol
  • 7,512
  • 4
  • 32
  • 30
1

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

SO Description

Community
  • 1
  • 1
ACBurk
  • 4,418
  • 4
  • 34
  • 50
0

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
  • 5,496
  • 6
  • 32
  • 40
  • Given that he mentions Applescript and Objective-C, it seems extremely unlikely that he'd be using Windows or C#. – Chuck Aug 05 '10 at 17:21