AVSpeechSynthesisMarker - iOS 18 - Sync lost

Hello,

in an AVSpeechSynthesisProviderAudioUnit sending word position to host using AVSpeechSynthesisMarker / AVSpeechSynthesisMarker.Mark.word seems to be broken on iOS 18.

On the app/client side all the events are received immediately whereas they should be received synchronised with the audio.

The exact same code works perfectly on iOS 17

On the AVSpeechSynthesisProviderAudioUnit the AVSpeechSynthesisMarker are appended with the correct Position/SampleOffset

 let wordPos = NSMakeRange(characterRange.location, characterRange.length)

let marker = AVSpeechSynthesisMarker(markerType: AVSpeechSynthesisMarker.Mark.word, forTextRange:wordPos, atByteSampleOffset:byteSampleOffset)

// also tried with
// let marker = AVSpeechSynthesisMarker(wordRange:wordPos, atByteSampleOffset:byteSampleOffset)
           
markerArray.append(marker)

print("word : pos \(characterRange) - offset \(byteSampleOffset)")
        
// send events to host
 speechSynthesisOutputMetadataBlock?(markerArray, self.request!)
word : pos {7, 7} - offset 2208
word : pos {15, 8} - offset 37612
word : pos {24, 6} - offset 80368
word : pos {31, 3} - offset 118652
word : pos {35, 2} - offset 128796
...

But on the client side they are all received in the same time (at the beginning of speech) whereas on iOS 17 they arrive sync to the audio.

func speechSynthesizer(_ synthesizer: AVSpeechSynthesizer, willSpeakRangeOfSpeechString characterRange: NSRange, utterance: AVSpeechUtterance) { 
        print("characterRange : \(characterRange)")
}

Using Apple Voice/engine works so there is obviously something to change but documentation of AVSpeechSynthesisProviderAudioUnit / AVSpeechSynthesisMarker seems unchanged

Thanks in advance

Hello @Sebboe, thank you for your post. Our engineering teams need to investigate this issue, as resolution may involve changes to Apple's software. I'd greatly appreciate it if you could open a bug report, include a sysdiagnose, and post the FB number here once you do. Bug Reporting: How and Why? has tips on creating your bug report.

Hello,

thanks for your answer. Bug report opened FB16028541

If needed I think we could provide source code or provide a test application to reproduce but this cannot be public so we need to be contacted directly.

If needed we alos had a case opened Case-ID: 3653994

Regards

AVSpeechSynthesisMarker - iOS 18 - Sync lost
 
 
Q