Text to speech in objective-c iPhone

Shivomkara Chaturvedi picture Shivomkara Chaturvedi · Jul 4, 2013 · Viewed 10.5k times · Source

I am developing an application in which I have to play string as an audio.

I am using http://translate.google.com/translate_tts?tl=en&q=Hello API to speak the string but it is a little bit slow.

Is there any library in objective-c to play string as an audio "Text To Speech".

Answer

user926643 picture user926643 · Aug 30, 2013

Look at the classes AVSpeechUtterance and AVSpeechSynthesizer in io7. Basically you can just do the following.

     AVSpeechUtterance *utterance = [AVSpeechUtterance speechUtteranceWithString:text];
     AVSpeechSynthesizer *syn = [[[AVSpeechSynthesizer alloc] init]autorelease];
    [syn speakUtterance:utterance];