Nirav Hathi Nirav Hathi - 1 year ago 147
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?

Answer Source

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];
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download