2

AVSpeechsynthesizer with the en-us voice is pronunciation for "A" is "Capital A" but Just want "A" How can do that?

Eric Aya
  • 69,473
  • 35
  • 181
  • 253
Nirav Hathi
  • 1,507
  • 3
  • 12
  • 20

2 Answers2

4

This only happens when there is single character in the string,

you can use this workaround of checking if lenght of string is 1 than convert it to lowercase 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];
Bhumit Mehta
  • 16,278
  • 11
  • 50
  • 64
0

The perfect pronunciation can be obtained thanks to the IPA notation (International Phonetic Alphabet), no need of workaround. :o)

Put an attributedString with its appropriate attribute as incoming parameter of the AVSpeechUtterance instance.

To get the phonemes, I suggest to use the iPhone feature located at Settings > General > Accessibility > Speech > Pronunciations (iOS 12) ⟹ see this WWDC 2018 video summary if you need further details.

Helpful information for the implementation can be found in this answer as well.

XLE_22
  • 5,124
  • 3
  • 21
  • 72