New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SPXSpeechSynthesizer stopSpeaking() method cannot return immediately on iOS 17 #2081
Comments
bump- this is causing a crash in my app as my class deinits temp fix: have replaced the sdk with REST where i let users preview voices in my app |
Internal workitem: 5706031 |
@ssadel Does your app crash due to stop takes too long? Or crash happens inside SDK? Could you please share backtrace? |
May I know any ETA for this fix? Our production iOS app suffers from this issue, is there any suggested workaround in the meantime before the fix is available. Many thanks ! |
hopefully this can help, it's the trace from an iOS 17.0.2 device. context is the stopPreview func is called right before deallocation of a view model. comes from crashlytics btw might be a bit wonky, i'm unable to test myself as i haven't updated yet
|
@ssadel thanks for the backtrace, could you please share the sample code how this could be reproduced? @solossam we have a fix currently for the stop delay, the ETA would be 1.33.0 release (approx. end of the Oct 2023). The problem seems to be due to behavioral change in https://developer.apple.com/documentation/audiotoolbox/1501970-audioqueuestop?language=objc in iOS17 and which causes the delay with Speech SDK. If your use case is to do synthesis playback via speaker output, one workaround for the issue before the SDK fix is released is to create SpeechSynthesizer using PullAudioOutputStream or PushAudioOutputStream and get the audio bytes from synthesis to your application and then stream the audio bytes to the device speaker using AVFoundation APIs. If you want to try that route, for Push/PullAudioOutputStream examples, please take a look following Objective-C sample below (For Swift , it is similar, unfortunately we do not have Swift sample for the stream usage). |
This item has been open without activity for 19 days. Provide a comment on status and remove "update needed" label. |
hi @jhakulin is the update going out as planned? |
Desperately need this fix too! |
Desperately need this fix too! |
Fix has been released in 1.33.0 Speech SDK release. Let us know if there are any problems. |
stopContinuousRecognition still takes more than 5 seconds, even after I upgraded to 1.33. |
Not really fixed(1.36), synthesizer.addSynthesisCompletedEventHandler still needs 10-20s to receive callback. |
@jhakulin I am using version 1.37.0, and I have encountered a similar issue.
For example, if I generate a 14-second audio and execute let ssml =
"<speak version='1.0' xml:lang='en-US' xmlns='http://www.w3.org/2001/10/synthesis' xmlns:mstts='http://www.w3.org/2001/mstts'><voice name='\(identifier)'>\(mstts)</voice></speak>"
let speakResult = try self.synthesizer?.speakSsml(ssml)
print(speakResult?.reason ?? "") try synthesizer?.stopSpeaking() Here is a demo repositorie: https://github.com/wtto00/flutter_azure_speech/tree/main/example The swift code is in https://github.com/wtto00/flutter_azure_speech/blob/eb419b89fcc16903cabaa8f9820559d93ed80861/ios/Classes/AzureSpeechPlugin.swift#L294 |
After calling SPXSpeechSynthesizer startSpeakingSsml() to synthesize the speech, while the speech is playing back, and then call stopSpeaking() to stop the speech, stopSpeaking() cannot return immediately on iOS 17. The speech audio can be stopped immediately, but this method will take 10-20 secs to return.
iOS16 and iOS 15 doesn't have this issue.
Below is our sample swift code to illustrate this issue on iOS 17
// below is the code snippet to start text to speech
Below is the code snippet to stop text to speech
We're using MicrosoftCognitiveServicesSpeech-iOS ver 1.32.1
The text was updated successfully, but these errors were encountered: