b2cloud

3rd April 2014

Make iOS talk (speech synthesizing)

Reviews | Tutorial By 3 years ago

iOS7 introduced the abiltiy for developers to do speech synthesizing. This means now you can translate text into speech.

It’s quite simple to do:

First import the AVFoundation framework – you may also need to link your project with it as well.

#import <AVFoundation/AVFoundation.h>

Now create an utterance and give it to a speech synthesizer instance:

NSString* textToSpeak = @"Look ma', no hands!";
AVSpeechUtterance* utterance = [[AVSpeechUtterance alloc] initWithString:textToSpeak];

AVSpeechSynthesizer* synthesizer = [[AVSpeechSynthesizer alloc] init];
[synthesizer speakUtterance:utterance];

For the most part that’s it. If you want to do some more advanced stuff, you can adjust the voice, speech rate, and get notifications of how far through speaking your synthesizer is.

  • Mouhamed Assafiri

    Wow that’s too easy. What about using a Speech To Text library, like OpenEars. Any reviews on that?

    • Tom

      I haven’t used any others before. It would be interesting comparing how realistic other libraries are compared to Apple’s.

      • myRepoSpace

        Does the Apple’s SDK provide a Speech to Text framework?

        • Tom

          Sorry I thought you said text to speech, nope they don’t offer that.

Recommended Posts

iOS performSelector with multiple parameters

Post by 3 years ago

On iOS the built in convenience method performSelector method call only allows for up to 2 parameters. - (void) aMethod { [self performSelector:@selector(doSomethingWithObject:otherObject:) withObject:@(1) withObject:@(2)]; } - (void) doSomethingWithObject:(id) object otherObject:(id) otherObject { // Code

Got an idea?

We help entrepreneurs, organizations and established brands from around
the country bring ideas to life. We would love to hear from you!