iOS语音简单播放

2017-03-04  本文已影响0人  Satanshun

#import<AVFoundation/AVFoundation.h>

AVSpeechSynthesizer *synth2 = [[AVSpeechSynthesizer alloc] init];

AVSpeechUtterance *utterance1 = [AVSpeechUtterance speechUtteranceWithString:@"你瞅啥,瞅你咋滴"];//播放语

AVSpeechSynthesisVoice *voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"zh-CN"];//汉语

utterance1.voice = voice;

utterance1.rate = 0.3;//语速

[synth2 speakUtterance:utterance1];//播放

上一篇 下一篇

猜你喜欢

热点阅读