Post

Replies

Boosts

Views

Activity

Reply to TextToSpeech crash on iOS 14.2+
Hi I think this is an iOS bug. I have this on production, 1k crashes every day.  I last updated my app in August so it can't be my fault. Unfortunately, I can't reproduce it on my device.  Can you please tell me how to reproduce this? I am desperately looking for some workaround to this problem.
Jan ’21
Reply to AVSpeechSynthesizer CRASH with certain voices under iOS 14.2+
I made an interesting observation.  I write a simple app. Basically it do this: let voices = AVSpeechSynthesisVoice.speechVoices() for voice in voices{    let utterance = AVSpeechUtterance(string: "Hi")    utterance.voice = voice    synthesizer.speak(utterance) } When I run it I observe various phenomena. Some voices simply works, some crashed, some throws epic warnings: Siri TTS for certain Indian celebs isn't correct ` And one give very interesting message: [AXTTSCommon] Error (hex)80000004 at /Library/Caches/com.apple.xbs/Sources/TextToSpeech/TextToSpeech-421.5/TextToSpeechBundleSupport/TTSVocalizer.m:264 (loading resource) (file:///private/var/MobileAsset/AssetsV2/com_apple_MobileAsset_VoiceServices_VoiceResources/a90d1e0d5bdcf4e8df75585d4843cd6006ba7cf3.asset/AssetData/vocalizer-user-rules-compact.dat) I analyzed this comappleMobileAssetVoiceServicesVoiceResources directory and find it very interesting.  It contains mostly pronunciation dictionaries, for example:  /\bMelania(?= Trump)\b/   -->   "\e/+m$.'lA.ni.^\e/+" /\bJoss Whedon\b/   -->   "\e/+'d&ZA+s_'wi.dn%)\e/+" /\bJean-Claude Van Damme\b/   -->   "\e/+'ZAn_'klOd_'v@n_'d@m\e/+" And one very interesting file comappleMobileAssetVoiceServicesVoiceResources.xml, this file exist also at URL https://mesu.apple.com/assets/com_apple_MobileAsset_VoiceServices_VoiceResources/com_apple_MobileAsset_VoiceServices_VoiceResources.xml. This file contains entries like this: <key>_CompressionAlgorithm</key> <string>zip</string> <key>_DownloadSize</key> <integer>83658</integer> <key>_IsZipStreamable</key> <true/> <key>_MeasurementAlgorithm</key> <string>SHA-1</string> <key>_UnarchivedSize</key> <integer>210944</integer> <key>__BaseURL</key> <string>http://updates-http.cdn-apple.com/2020/mobileassets/001-72580/C130C5C5-9C87-42F9-90BC-83CB9BE97872/</string> <key>lastTimeChecked</key> <date>2021-01-20T23:48:18Z</date> So, for example, If they find some Indian celebrity they forgot about then they don't have to do an iOS upgrade, they simply modify VoiceResources.xml on the server and it will soon or later propagate for all iOS devices on the planet. My hypothesis is that the latest update contains some bug. That might even be right because the crashes started on January 19 and that's also the date the mesu.apple.com returns for  VoiceResources.xml (Last-Modified: Tue, 19 Jan 2021 19:28:19 GMT). If my hypothesis is correct the fix should be rather simple and should appear within a few days.  Please Mr. Frameworks Engineer  very much, correct this, our customers will devour us if it lasts more than a few days!
Jan ’21
Reply to AVSpeechSynthesizer buffer conversion, write format bug?
The same happens on iOS 14.6. The code below produces a very noisy audio file. let speechSynthesizer = AVSpeechSynthesizer() let utterance = AVSpeechUtterance(string: "Hi, my name is ALex.") let voice = AVSpeechSynthesisVoice(identifier: "com.apple.speech.voice.Alex")! utterance.voice = voice let audioFileSettings = voice.audioFileSettings let audioUrl = ... //valid URL var audioFile = try! AVAudioFile(forWriting: audioUrl, settings: audioFileSettings, commonFormat: .pcmFormatInt32, interleaved: false) speechSynthesizer.write(utterance) { buffer in let pcmBuffer = buffer as! AVAudioPCMBuffer if pcmBuffer.frameLength > 0{ try! audioFile.write(from: pcmBuffer) } } On some voices (example: Alex), it happens, and on others (example: Samantha), it doesn't. The code is so simple that I don't think there is a bug there. It must be a framework problem. Mr. Frameworks Engineer, fix this, please.
Jul ’21