iOS中的语音输出

Ann*_*mus 3 iphone speech-synthesis ios

是否可以访问用于辅助功能的iOS语音合成功能?

Kla*_*aas 6

以下是AVSpeechSynthesizer在iOS 7上使用的示例:

AVSpeechSynthesizer *synthesizer = [[AVSpeechSynthesizer alloc]init];
AVSpeechUtterance *utterance = [AVSpeechUtterance speechUtteranceWithString:@"Hey Guys"];
[synthesizer speakUtterance:utterance];
Run Code Online (Sandbox Code Playgroud)

要改变语音使用:

utterance.voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"de-DE"];
Run Code Online (Sandbox Code Playgroud)

获取所有声音的列表:

NSLog(@"voices %@", [AVSpeechSynthesisVoice speechVoices]);
Run Code Online (Sandbox Code Playgroud)