AVFoundation-avspeechsynthesizer文字转语音 发表于 2016-10-10 | 更新于 2018-11-23 | 分类于 essay , AVFoundation | 评论数: | 阅读次数: 本文字数: 500 | 阅读时长 ≈ 1 分钟 AVSpeechSynthesizer 文字转语音 简单示例: 12345AVSpeechSynthesizer *synthesizer = [AVSpeechSynthesizer new];AVSpeechUtterance * utterance = [[AVSpeechUtterance alloc] initWithString:@"需要转化的文字"];//语音合成器会生成音频[synthesizer speakUtterance:utterance]; 指定声音: 123//设置语言类别(不能被识别,返回值为nil)AVSpeechSynthesisVoice *voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"en-US"];utterance.voice = voiceType; 语速: //设置语速快慢 utterance.rate *= 0.5; 队列中插入语音 使用 https://github.com/quentinhayot/QHSpeechSynthesizerQueue