iOS语音简单播放

#import

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];//播放

你可能感兴趣的:(iOS语音简单播放)