以下是AVSpeechSynthesizer在iOS 7上使用的示例:
AVSpeechSynthesizer *synthesizer = [[AVSpeechSynthesizer alloc]init];
AVSpeechUtterance *utterance = [AVSpeechUtterance speechUtteranceWithString:@"Hey Guys"];
[synthesizer speakUtterance:utterance];
Run Code Online (Sandbox Code Playgroud)
要改变语音使用:
utterance.voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"de-DE"];
Run Code Online (Sandbox Code Playgroud)
获取所有声音的列表:
NSLog(@"voices %@", [AVSpeechSynthesisVoice speechVoices]);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4309 次 |
| 最近记录: |