Does iOS provide built in text to speech support or any class like NSSpeechRecognizer?

后端 未结 1 852
星月不相逢
星月不相逢 2020-12-07 17:59

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 NSSpeechRecog

相关标签:
1条回答
  • 2020-12-07 18:34

    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.

    0 讨论(0)
提交回复
热议问题