AVSpeechSynthesizer problem in iOS 16 Beta

Setting a voice for AVSpeechSynthesizer leads to an heap buffer overflow. Turn on address sanitizer in Xcode 14 beta and run the following code. Anybody else experiencing this problem, is there any workaround?

let synthesizer = AVSpeechSynthesizer()
var synthVoice : AVSpeechSynthesisVoice?

func speak() {
	let voices = AVSpeechSynthesisVoice.speechVoices()
     
    for voice in voices {
      if voice.name == "Daniel" {    // select e.g. Daniel voice
        synthVoice = voice
      }
    }
     
    let utterance = AVSpeechUtterance(string: "Test 1 2 3")
     
    if let synthVoice = synthVoice {
		    utterance.voice = synthVoice							
    }
     
    synthesizer.speak(utterance)						// AddressSanitizer: heap-buffer-overflow
}
Post not yet marked as solved Up vote post of And0Austria Down vote post of And0Austria
5.7k views

Replies

Heya! While there is no workaround I can offer, I do want to let you know that we are aware of this issue. Thanks for taking the time to bring this up!

  • Thank you for the answer. This bug makes my app completely unusable, do you know if it'll be fixed before release?

  • Any news on this? It seems to still be broken after release.

  • Any new on this?

As far as I know there isn't currently a solution. Hopefully Apple will fix it before release.

Unfortunately it hasn't been fixed for the iOS 16 release, now I'm seeing a lot of crashes due to this problem.

I have a similar problem with an old Objective-C program. I queue some utterances and nothing happens. No errors and the didFinishSpeechUtterance delegate method never gets called. Is this a confirmed problem with iOS 16?

The problem happens on simulator with iOS 16 for me. But on physical devices, it works as expected, the return of speechVoices is not empty. It may be a bug only on simulator with iOS 16?

I'm also experiencing this crash.

Still broken in iOS 16.0.2 and iOS 16.1 beta 2. @all: Please add tickets in http://feedbackassistant.apple.com and refer to my ticket number FB11401700 to let Apple know that many Apps have this problem.

I was able to get my app to start speaking again on the iOS 16 simulators by downloading a voice. It appears those simulators have no voices loaded by default. Here are the steps (on the simulated device itself):

  • Settings/Accessibility/Spoken Content
  • Must turn on Speak Selection. That will cause a "Voices" button to display. Touch that.
  • Select your language.
  • Pick a voice. Click the download button. Wait.
  • When done, you can back out and turn off Speak Selection on the way if

you want. Turning it on is necessary to be able to select and download a voice.

I don't have access to a real iOS 16 device right now so don't know if it's a problem on the devices or not.

  • Unfortunately, I followed these steps but it didn't solve my issue. Since the error messages I often see on my console is somthing like "[catalog] Unable to list voice folder", it sounds simulators don't have a voices. However, print (AVSpeechSynthesisVoice.speechVoices()) correctly lists up the available voices I want to use.

    This is a problem on my real iOS 16 device as well, while voice-over with Safari browser works fine.

  • Have you found way to slove that problem?

Add a Comment

feedback assistant report link

FB11809156

I was able to make it work on simulators by following the instructions from ejrowlance1.

It does NOT work on the device.

  1. The voices array from AVSpeechSynthesisVoice.speechVoices() is NOT empty.
  2. The utterance is not spoken
  3. Forcing a voice on the utterance (with the id of one of the listed voices) does NOT make the synthesizer speak.
  4. Forcing a voice on the utterance creating the voice with a local identifier (example "en-US") does not work.
  5. Downloading more voices and killing settings does not work
  6. Setting a rate on the utterance does not work (why it would work anyways, it is just a rate... but I just do not know what else to try).

HERE IS THE CODE

 private var synthesizer: AVSpeechSynthesizer = AVSpeechSynthesizer()

  func read() {

        let utterance = AVSpeechUtterance(string: "Some text")


        synthesizer.speak(utterance)


    }

These are the errors I get in the console:

  • [catalog] Unable to list voice folder
  •  [AXTTSCommon] File file:///var/MobileAsset/AssetsV2/com_apple_MobileAsset_Trial_Siri_SiriTextToSpeech/purpose_auto/14b85d56e1353471b77c970980a81324be7cdf4e.asset/AssetData/vocalizer-user-dict.dat contained data that was not null terminated
  •  [AXTTSCommon] MauiVocalizer: 11006 (Can't compile rule): regularExpression=\Oviedo(?=, (\x1b\pause=\d+\)?Florida)\b, message=unrecognized character follows , characterPosition=1 **(WHY THE HELL IS TRYING TO READ OVIEDO AND FLORIDA? I HAVE NOT IDEA!)**😂😂😂😂
  • [AXTTSCommon] MauiVocalizer: 16038 (Resource load failed): component=ttt/re, uri=, contentType=application/x-vocalizer-rettt+text, lhError=88602000

Any update to this issue? I spent two entire days trying to find why my utterance is not speaking sometimes. I found that Apple has a bug. The delegate doesn’t kick func startedSpeaking

  • Same problem here. Works in Simulator, but not on iPhone 14 Pro running iOS 16. No more speech synthesis? Help?

    [AXTTSCommon] MauiVocalizer: 11006 (Can't compile rule): regularExpression=\Oviedo, (\x1b\pause=\d+\)?(?=Florida)\b, message=unrecognized character follows , characterPosition=1 2023-04-13 20:54:46.115465-0400 Boswell[18755:3961616] [AXTTSCommon] MauiVocalizer: 16038 (Resource load failed): component=ttt/re, uri=, contentType=application/x-vocalizer-rettt+text, lhError=88602000

Add a Comment

I still can't get this to work in Xcode 15b5 and iOS 17. Any update how to get text to speech work?

I've got a similar problem. It seems that AVSpeechSynthesizer does not work well with Address Sanitizer. I spent a lot of time trying to figure this out. Terrible experience! Don't want to believe that the Apple engineering team left this problem unsolved for a year. For a temporary solution, can they just turn off the Address Sanitizer for AVSpeechSynthesizer?