18

i have found many libraries like flite which can be be used, as in given here, but I want to know if there is any Built-In class provided by iOS SDK similar to NSSpeechRecognizer provided in OS X.

Community
  • 1
  • 1
Krishna
  • 293
  • 3
  • 11
  • 1
    this is a confusion question. the question indicates speech recognition in the description but is tagged with "text-to-speech" and also states "text to speech support" in title. – Peter Theill Apr 13 '15 at 14:36

1 Answers1

45

There is no built in text-to-speech support in iOS 5 or 6 - you'll need to use a third party library. If you are using iOS 7 you're in luck.

There's a new class in iOS 7 called AVSpeechSynthesizer (Apple's docs can be found here). You can use this to perform text-to-speech. Here's a simple example:

AVSpeechUtterance *utterance = [AVSpeechUtterance 
                                speechUtteranceWithString:@"Hello world"];
AVSpeechSynthesizer *synth = [[AVSpeechSynthesizer alloc] init];

[synth speakUtterance:utterance];

Properties such as speed and voice type are set in the AVSpeechUtterance, rather than the synthesizer.

lxt
  • 31,146
  • 5
  • 78
  • 83
  • 4
    although still in beta iOS 7 is public now and includes the class `AVSpeechSynthesizer` that can be used for text-to-speech. [Reference](https://developer.apple.com/library/prerelease/ios/documentation/AVFoundation/Reference/AVSpeechSynthesizer_Ref/Reference/Reference.html#//apple_ref/doc/uid/TP40013447). – eliocs Sep 10 '13 at 07:53
  • iOS7 is relased today so you can update your answer with your actual code. – Topsakal Sep 18 '13 at 21:36
  • NSSpeechRecognizer isn't for text-to-speech, it is for speech-to-text. What does iOS 7 have for speech recognition? – Gerry Jun 17 '14 at 21:31
  • @Gerry - there is no public API for that. See this question: http://stackoverflow.com/questions/16812399/how-to-use-speech-recognition-inside-the-ios-sdk – lxt Jun 18 '14 at 21:48
  • this function not work in ios8. how to use this function in ios 8. – Shashi Sharma Oct 16 '14 at 06:16
  • No reason why it shouldn't work in iOS 8. If you're having trouble using it, ask a question here or file a bug. – lxt Oct 16 '14 at 16:57