带有 en-us 语音的 AVSpeechsynthesizer 的“A”发音是“大写 A”,但只想要“A”怎么办?
最佳答案
只有当字符串中只有单个字符时才会发生这种情况,
您可以使用此解决方法检查字符串长度是否为 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];
关于ios - AVSpeechSynthesizer 文本转语音,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38519154/