AVSpeechSynthesizer 文字转语音
简单示例:
1 2 3 4 5
| AVSpeechSynthesizer *synthesizer = [AVSpeechSynthesizer new]; AVSpeechUtterance * utterance = [[AVSpeechUtterance alloc] initWithString:@"需要转化的文字"];
[synthesizer speakUtterance:utterance];
|
指定声音:
1 2 3
| AVSpeechSynthesisVoice *voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"en-US"]; utterance.voice = voiceType;
|
语速:
队列中插入语音
使用 https://github.com/quentinhayot/QHSpeechSynthesizerQueue