ios - AVSpeechUtterance en-US 语音在 iOS 12 上听起来乱码

标签 ios ios12 avspeechutterance

我有一个使用 AVSpeechUtterance 的应用程序,该应用程序在 iOS 12 之前一直运行良好。它仍然可以运行,但 en-US 语音听起来乱码。在 xcode 模拟器或新的 iPhone XS Max 上不会发生这种情况。这似乎只发生在 iPhone X 上。删除并重新安装该应用程序并不能解决问题。唯一的解决办法是将语音更改为 en-IE。 有其他人经历过这个或找到解决方法吗?

AVSpeechUtterance *utterance = [[AVSpeechUtterance alloc] initWithString:@"This is a test"];
utterance.voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"en-US"];
utterance.rate = AVSpeechUtteranceDefaultSpeechRate;
[self.synthesizer speakUtterance:utterance];

最佳答案

iOS12 Made 'en-US' 使用 Fred 而不是 Samantha

尝试替换:

utterance.voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"en-US"];

与:

utterance.voice = [AVSpeechSynthesisVoice voiceWithIdentifier:@"com.apple.ttsbundle.Samantha-compact"];

关于ios - AVSpeechUtterance en-US 语音在 iOS 12 上听起来乱码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52693071/

相关文章:

ios - 使用 openURL 的 '#' 结尾

ios - 初始化 CBCentralManager : Type of expression is ambiguous without more context

ios - "AppleARMPMUCharger"在 iOS 12 之前通过 idevicediagnostics.exe 运行时不再导出电池信息/诊断

ios - 尝试从 URL 获取数据并获取控制台警告

ios - 有人得到 [[NSBundle mainBundle] pathForResource :ofType:inDirectory] to work recursively?

ios - 使用 AVPlayer 在 UIView 中播放延时

Swift 4 WebkitView URL 更改未完成其工作

ios - 在 didReceiveRemoteNotification 中播放声音,同时在后台使用文本到语音功能

Swift - 完成后重置/重启 SpeechSynthesizer