XCode 11.4.1. Run on simulators (iOS 13.4.1)
If we write this code for speech (Swift), 'willSpeakRangeOfSpeechString' delegate method will return a wrong character range
let speechSynthesizer = AVSpeechSynthesizer()
let speechUtterance = AVSpeechUtterance(string: "VIA, .\nNeedless to say, 2020 is off to an unprecedented start.")
speechUtterance.voice = AVSpeechSynthesisVoice(language: "en-US")
speechUtterance.rate = 0.40
speechUtterance.pitchMultiplier = 0.50
speechUtterance.volume = 0.75
speechSynthesizer.speak(speechUtterance)
willSpeakRangeOfSpeechString is wrong when the speaker says "2020".
Here below I list character range and word referenced each time:
character range: {0, 3} -> 'VIA'
character range: {3, 1} -> ','
character range: {5, 1} -> '.'
character range: {7, 8} -> 'Needless'
character range: {16, 2} -> 'to'
character range: {19, 4} -> 'say,'
character range: {47, 4} -> 'cede' // ERROR: instead of 2020 it send back wrong character range
character range: {29, 2} -> 'is'
character range: {32, 3} -> 'off'
character range: {36, 2} -> 'to'
character range: {39, 2} -> 'an'
character range: {42, 13} -> 'unprecedented'
character range: {56, 6} -> 'start.'
Interesting to note that if we change voice language, character range sent back is correct.
speechUtterance.voice = AVSpeechSynthesisVoice(language: "it-IT")
Is it a bug on speech framework on simulators?
Thanks