AVSpeechSynthesizer Text-To-Speech
AVSpeechsynthesizer with en-us voice - the pronunciation for "A" is "Capital A" but just "A" How to do it?
This only happens when there is one character in the string,
you can use this workaround to check if string length is 1, than convert it to string string,
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];
Perfect pronunciation can be achieved thanks to the IPA (International Phonetic Alphabet) notation , without the need for a workaround. : ABOUT)
Place the value attributedString
AVSpeechUtterance
with the appropriate attribute as an input instance parameter AVSpeechUtterance
.
To get phonemes , I suggest using the iPhone feature located in Settings > General > Accessibility > Speech > Pronunciations
(iOS 12) ⟹, if you need more information, check out this WWDC 2018 video summary) .
Helpful implementation information can also be found in this answer .