Friday, February 1, 2013

Using Google TTS (text to speech)

I was doing some investigation on Text-To-Speech (TTS) for iOS and found a little snippet of code that could be added to any app for some quick TTS.

The catch is that it's limited to just 100 characters and you never know when Google might pull the plug on it, but still, it's pretty cool.

#import <AVFoundation/AVFoundation.h>


    NSString *linkTTS = [NSString stringWithFormat:@"",@"this+is+really+quite+cool"];
    NSData *dataTTS = [NSData dataWithContentsOfURL:[NSURL URLWithString:linkTTS]];
    AVAudioPlayer *_googlePlayer = [[AVAudioPlayer alloc] initWithData:dataTTS error:nil];
    [_googlePlayer play];

No comments:

Post a Comment