【发布时间】:2019-06-04 22:08:50
【问题描述】:
带有 en-us 语音的 AVSpeechsynthesizer 是“A”的发音是“Capital A”但只是想要“A”怎么做?
【问题讨论】:
标签: ios text-to-speech avspeechsynthesizer
带有 en-us 语音的 AVSpeechsynthesizer 是“A”的发音是“Capital A”但只是想要“A”怎么做?
【问题讨论】:
标签: ios text-to-speech avspeechsynthesizer
只有当字符串中有单个字符时才会发生这种情况,
您可以使用此解决方法来检查字符串的长度是否为 1,而不是将其转换为小写字符串,
NSString *stringToUtter = @"A";
if (stringToUtter.length==1) {
stringToUtter = [stringToUtter lowercaseString];
}
AVSpeechUtterance *utterance = [[AVSpeechUtterance alloc] initWithString:stringToUtter];
utterance.rate = AVSpeechUtteranceMinimumSpeechRate;
utterance.voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"en-us"];
[self.synthesizer speakUtterance:utterance];
【讨论】:
借助国际音标符号 (国际音标),可以获得完美的发音,无需变通。 :o)
将具有相应属性的attributedString 作为AVSpeechUtterance 实例的传入参数。
致get the phonemes,我建议使用位于Settings > General > Accessibility > Speech > Pronunciations 的iPhone 功能(iOS 12) ⟹ 如果您需要更多详细信息,请参阅此WWDC 2018 video summary。
也可以在此answer 中找到有关实施的有用信息。
【讨论】: