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

最佳答案

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

AVSpeechSynthesizer *synthesizer = [[AVSpeechSynthesizer alloc]init];
AVSpeechUtterance *utterance = [AVSpeechUtterance speechUtteranceWithString:@"Hey Guys"];
[synthesizer speakUtterance:utterance];

要更改声音,请使用:
utterance.voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"de-DE"];

要获取所有声音的列表:
NSLog(@"voices %@", [AVSpeechSynthesisVoice speechVoices]);

07-26 09:40