Performance: 'Flush DSP Connections' spikes

Hey everyone,

I have been searching the internet up and down, but don’t seem to find anything regarding an issue we have, so please bear with me.

While profiling our project (editor and dev build), I came across some performance spikes caused by an Fmod method called ‘Flush DSP Connections’, and now I am trying to figure out what the best way is to mitigate that.

Now, we don’t use Fmod itself, but if I remember correctly, unity uses some (older) version of it on a lower level.

This method call seems to be related to start playing an AudioSource using ‘AudioSource.Play()’, but also when setting various reverb filter values, or when disabling the GameObject of the AudioSource.

I already created some workarounds like making sure to only set filter values when they actually change, as well as to only start the source if we haven’t done that.
Also, at this point, we completely refrain from disabling our AudioSource GameObjects when returning them to the pool.

All these things helped a bit, but especially in situations where we need to spawn a lot of sounds in a rather short timeframe, these spikes are still noticeable.

The last resort would obviously be to heavily reduce the amount of sounds played per time interval, however I would still like to ask if anyone else encountered this issue.
And maybe there is even someone from Unity / Fmod that can enlighten me what this call exactly does, and what would cause these spikes.

Some more info about our project / implementation:

  • we use Unity 2022.2.15
  • we pool our audio sources
  • we heavily rely on the OnAudioFilterRead() callback, which we use to route all our audio instances through
  • when a new audio instance is played, we call AudioSource.Start(), and update some filters (low-pass and reverb) on the respective AudioSource

If you need more information about our audio system, feel free to ask.

Thanks in advance!

Edit:
I added some profiler info.
Now, this is done with the Deep Profiler, so I know those values are a bit bloated.
However, they clearly show the spikes I was referring to.

Audibility computation:

AudioSource.Play():

AudioSource.Stop() and GameObject.Deactivate():

Hi Matthias,

There was a big performance improvement in the Audibility Computation algorithm earlier this year made by a colleague ( 2022 Performance - FMOD Audibility Computation ) and I think it was merged and backported since. Could you try updating your 2022 LTS version and see if it’s fixed?

Cheers!

Thanks for the reply!
I will try that out as soon as possible.

It is good to know that we might be able to mitigate at least one of these spikes.

Cheers :slight_smile: