Nirav Hathi Nirav Hathi - 3 months ago 10
Swift Question

AVSpeechSynthesizer Text-To-Speech

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


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];