美文网首页
AVSpeechUtterance

AVSpeechUtterance

作者: 低吟浅唱1990 | 来源:发表于2017-11-28 20:29 被阅读236次

AVSpeechUtterance是iOS中语音合成的类。

AVSpeechUtterance *utterance = [AVSpeechUtterance speechUtteranceWithString:@"Hello World"];  //创建语音  Hello World 合成的文本
    utterance.voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"en-US"]; //合成英文 嗓音属性
    utterance.rate = 0.5f;    //  播放速率
    utterance.pitchMultiplier = 0.8f;  //改变音调
    utterance.postUtteranceDelay = 0.1f;  //播放下一句是有个短时间的暂停
    AVSpeechSynthesizer *av = [[AVSpeechSynthesizer alloc] init];  //运用合成器
    [av speakUtterance:utterance];            //变成音频输出

输入iOS支持的语言

[AVSpeechSynthesisVoice speechVoices];

相关文章

网友评论

      本文标题:AVSpeechUtterance

      本文链接:https://www.haomeiwen.com/subject/ipdsbxtx.html