Speech Synthesis on iPhone 3GS

Posted this on Twitter a week back, but maybe it's of some interest to blog readers; here's how to do simple voice synthesis on the iPhone 3GS (3GS-only, I'm afraid). It's a private API, but hopefully if we file enough Radars they'll make it a public one.

To enable the following code to work you'll need to link the VoiceServices.framework (from the PrivateFrameworks folder of the SDK) in your app.

NSObject *v = [[NSClassFromString(@"VSSpeechSynthesizer") alloc] init]; [v startSpeakingString:@"All your base are belong to us"];

Apologies for my lazy 'NSObject' define above, but you get the idea :-)

With that, you have simple speech synthesis for your application (obviously you cannot include this when you submit to the App Store as it links to a private framework, but you can use it in your internal applications). It requires the 3GS because the Speech stuff just isn't in the firmware for the older devices.

Obligatory video below:

6 comments:

  1. Nice find, I knew there'd be something like this in there.

    ReplyDelete
  2. Wonder if you can use cepstral voices with it somehow? That would really kick ass (that said, the voice in the demo you showed sounded pretty good).

    ReplyDelete
  3. Any idea when the text to speech feature will be made public?

    ReplyDelete
  4. Hi,

    I've actually tried to integrate the VoiceServices framework into an application of mine. Sadly, I cannot get it to speak :-(
    Is there anything more to it than just linking against the VS framework and using the VSSpeechSynthesizer? The object I've instantiated seems to respond to startSpeakingString. However, there is no sound output. (Yes, it's *not* muted ;-))

    Cheers,
    Josh

    ReplyDelete
  5. Hi !

    I don't manage to make an application which works ; namely, I don't see how to "link the VoiceServices.framework in my application" (I am a beginner in Xcode !); is it possible to have a copy of the project ?

    Thanks a lot.

    regis.andre.2001@gmail.com

    Regis

    ReplyDelete
  6. hi
    I am an Italian student,

    I too am new to Xcode and for a university project i need this function.

    I can also have a copy of the project?

    Thanks.

    mat.oldani@tiscali.it

    ReplyDelete