Audio stopping on MacOS build

Apologies for cross-posting, but am not sure how many people will see this in the Audio forum.

/////////////////

I have an audio-based project that has a bunch of objects, each with an AudioSource playing synthesized tones (OnAudioFilterRead drives them). I’ve run it on several different systems (Windows/Mac) for hours with no problem, but when the build was installed on a Mac Mini (not sure of OS, it’s in a gallery), the audio will stop working after awhile. Restarting the app fixes it.

I think I’m driving the audio engine too hard as there are 144 sound sources, and each uses OnAudioFilterRead which I know is processor intensive. What’s the best way to make this less intensive so it won’t quit? What audio settings could I change? I need both the large number of sound sources as well as the synthesis, that’s kind of the basis of the project.

Alternatively, is there a way to “reset” the audio system from within the app? I don’t care if there’s a sound gap every now and then…what I need to avoid is having it stop altogether, it’s in a gallery and I don’t have access to restart it, and I don’t want the gallery folks to have to babysit it!

AudioSettings.Reset will restart the audio system

it will stop all of your AudioSources though, so you will need to go and restart them all. You can use Unity - Scripting API: AudioSettings.OnAudioConfigurationChanged to set a callback for when the reset has happened, then go and start your sources again.

If you have time it would be nice to get a minimal repro and report it to us as a bug so we can check if anything on our side is wrong https://support.unity.com/hc/en-us/articles/206336985-How-do-I-submit-a-bug-report. It sounds strange that it takes a while for the problem to occur - and that all sound stops. Regardless it might be worth bumping the number of real/virtual voices Unity - Manual: Audio if you have not already tried that.

Very helpful, thank you!

I don’t know about getting a repro/bug as it’s pretty random, and everything else continues to work (graphics, interaction). Also, at least so far, it was only on a Mac Mini, and an older one at that, so maybe it’s not that relevant anymore. Would sending the project be helpful for testing? And/or the build? Would be no problem.

I’ll experiment with calling Reset, but am also going to reduce the number of AudioSources. The author of the synth library I’m using did warn me not to use too many, so…yeah. But it sounds so cool, I couldn’t help myself :wink:

Was thinking to increase the dsp buffer size as well.