Skip to content
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

On using AVSpeech... objects, warnings: TTSPlaybackCreate unable to init dynamics #13

Closed
apraka16 opened this issue Dec 2, 2017 · 13 comments

Comments

@apraka16
Copy link
Owner

apraka16 commented Dec 2, 2017

Warning:
2017-12-02 19:54:00.302555+0530 ARKitBasics[434:108636] [TTS] TTSPlaybackCreate unable to initialize dynamics: -3000

@apraka16
Copy link
Owner Author

apraka16 commented Dec 2, 2017

This probably has to do with issues with iOS itself rather than bug with current codebase.

@apraka16
Copy link
Owner Author

apraka16 commented Dec 2, 2017

  • On implementing AVSpeechSynthesizer.isSpeaking console issues another type of warning:
    2017-12-03 00:02:03.493353+0530 ARKitBasics[308:28050] [TTS] _BeginSpeaking: couldn't begin playback

@apraka16
Copy link
Owner Author

private var voice = AVSpeechSynthesisVoice(identifier: "com.apple.ttsbundle.siri_female_en-US_compact") choice of voice seems to be the problem owing to which the warning is being issued. Additionally, sound crashes at times, which is a more severe issue.

@KonradMaroszek
Copy link

Hi did you solve the problem ?, I have the same issue in my application. What's more, it only occurs in three places in whole app. I suspect that it has a connection with threads. Unfortunately, I was unable to find a solution yet.

@apraka16
Copy link
Owner Author

Hey, yeah probably it is. I am using global threads for handling the voices. However, note that in my case the voice works. It's just that there are warning issued. As much as I have googled about it and fiddled with choice of my voice problem seems to be stemming from choice of voice. But till now no solution. Still looking for it.

@KonradMaroszek
Copy link

I do not choose the voice, I use the user's choice in the system options and the problem still occurs. The application is multilingual, the problem occurs for every country. If I fix something, I'll let you know. Good luck :)

@KonradMaroszek
Copy link

I solved my problem. One view was starting speaking when another was stopping (in didDisapear function)

@apraka16
Copy link
Owner Author

In such cases, I use interruption, as:

    func sayWithInterruption(text: String) {
        if self.isSpeaking {
            self.stopSpeaking(at: AVSpeechBoundary.immediate)
        }
        let speechUtterance = AVSpeechUtterance(string: text)
        speechUtterance.voice = voice
        speechUtterance.rate = 0.5
        self.speak(speechUtterance)
}

I wonder did it really stop? The warning? What was the solution?

@KonradMaroszek
Copy link

I'm using small hack:

sometimes when you call speak and stop in short intervals AVSpeechSynthesizer return isSpeaking==true even though the class did not read... After each cancellation, i create a new instance of synthesizer to avoid this situation. I know it is not elegant way but it works. I think it is bug in apple code.

it is part of my code:

func cancelReading() - Void {
**** my code ****

self.stopSpeaking(at: AVSpeechBoundary.immediate)

synthesizer = AVSpeechSynthesizer()

synthesizer.delegate = self

currentlyReading = nil
sequence.removeAll()

*** my code ***

}

@apraka16
Copy link
Owner Author

Ah, new instances! Yeah, probably it is a bug I suppose, I will incorporate this in my code as well and see what happens, if it works for you though I am sure it would for me as well. Thanks.

@apraka16
Copy link
Owner Author

apraka16 commented Jan 7, 2018

Reported bug to Apple https://bugreport.apple.com/web/?problemID=36339935

@apraka16
Copy link
Owner Author

Apple Developer Relations
January 25 2018, 10:08 PM

There are no plans to address this based on the following:

The only way we’ve been able to reproduce this here is by performing access to the same synthesizers on several threads simultaneously.

Based on your github reference it looks like you are interfacing with the synthesizer on the global concurrent queues.

Suggest you interact with an instance of the speech synthesizer on a serial queue instead.

We are now closing this report.

If you have questions about the resolution, or if this is still a critical issue for you, then please update your bug report with that information.

Please be sure to regularly check new Apple releases for any updates that might affect this issue.

@apraka16
Copy link
Owner Author

Though Apple has prescribed the use of serial queue, and I've tried using the same, somehow this issue is cropping up despite that. However, creating AVSynth object every time speech is needed does serve the purpose. On analysing ARC in Instruments, AV Synth objects which are not used anymore are flushed out (deallocated) by the system which contains the memory hence is good enough to go.

@apraka16 apraka16 changed the title On using AVSpeech... objects, console issues warnings On using AVSpeech... objects, warnings: TTSPlaybackCreate unable to init dynamics Jan 31, 2018
ch3n0l1 added a commit to uts-ios-dev/project3-group-26 that referenced this issue Jun 2, 2018
bug:2018-06-02 19:21:49.861087+1000 project3-group-26[47238:848040] [TTS] _BeginSpeaking: couldn't begin playback
refer to: apraka16/iOSAR#13

Audio cannot replay after stopping it immediately. Need renew an instance to replace the old AVSpeechSynthesizer.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants