iosswiftavspeechsynthesizeravspeechutterance

Disabling automatic date detection for AVSpeechSyntesizer/AVSpeechUtterance


Today I stumbled upon a very curious behaviour of iOS's AVSpeechSynthesizer. If I give it a string containing "DON 21" using the German language, it'll say "Donnerstag, 21.". (It will automatically translate "THU 21" to "Thursday 21st" and read this string. Unfortunately I need to read the text provided by another source that may or may not contain strings like "DON 21" or others (depending on the language). Has anyone ever encountered this behavior? Does anyone know how to turn the automatic date transscription off?


Solution

  • Try deleting the space or adding other punctuation: it might pronounce "DON21" differently. If that doesn't work, use attributedSpeechString to tell the synthesizer to pronounce this part of the string the way you want it pronounced.