iOS是否提供内置的文本到语音支持或诸如NSSpeechRecognizer之类的任何类? [英] Does iOS provide built in text to speech support or any class like NSSpeechRecognizer?
问题描述
我发现许多库都可以使用,例如 flite 在给定的此处中,但是我想知道iOS是否提供了任何内置类与OS X中提供的NSSpeechRecognizer相似的SDK.
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.
推荐答案
iOS 5或6中没有内置的文本语音转换支持-您需要使用第三方库.如果您使用的是iOS 7,那么您会很幸运.
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.
iOS 7中有一个名为AVSpeechSynthesizer
的新类(
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];
诸如速度和语音类型之类的属性是在AVSpeechUtterance
中设置的,而不是在合成器中设置的.
Properties such as speed and voice type are set in the AVSpeechUtterance
, rather than the synthesizer.
这篇关于iOS是否提供内置的文本到语音支持或诸如NSSpeechRecognizer之类的任何类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!