Issue with AVSpeechSynthesizer
I’m using AVSpeechSynthesizer
to pass text to be spoken. When I change the voice to male in the settings, the text is still being spoken in a female voice.
func speakOutText(_ textToRead:String ){
let audioSession = AVAudioSession.sharedInstance()
do {
try audioSession.setCategory(AVAudioSessionCategoryPlayback)
try audioSession.setMode(AVAudioSessionModeDefault)
try audioSession.setActive(true, with: .notifyOthersOnDeactivation)
} catch {
print("audioSession properties weren't set because of an error.")
}
let speakUtterance = AVSpeechUtterance.init(string: textToRead);
speakUtterance.voice = AVSpeechSynthesisVoice(language: "en-IN")
speakUtterance.pitchMultiplier = 1.2
speakUtterance.rate = 0.5
speechSynthesizer.speak(speakUtterance)
}
Why is the text still being spoken in a female voice even after changing to a male voice in the settings?