"Popping" sound when adjusting mixer volume

In my game, when I completely stop audio sources, I often hear a popping sound. To avoid that, I’m trying to gradually lower the total game volume using the Audio mixer. However, even when using the Audio mixer to lower the volume, I’m still hearing popping sounds. This occurs the first frame that I change the audio mixer volume.

I’m using code like this to adjust the mixer volume while a sound is playing:

Mixer.TransitionToSnapshots(new AudioMixerSnapshot[] { snapshotA, snapshotB }, new float[] { 1,0 }, 0);

I’ve tested this out in a very simple scene, where there is just an audio source playing. I’ve set up two Audio Mixer snapshots, each simply has a different volume. While playing, I press a key to execute the code above to switch snapshots. This produces a very noticeable “pop” with every snapshot change. My expectation is that volume can be lowered without hearing popping sounds. It definitely seems worse depending on which sound I use. (Some seem more prone to popping than others.)

Is there any possibility of avoiding this? Or is audio popping a fact of life when changing mixer volume? I’ve tried all combinations of import settings on the audio file itself, and they all result in popping.

Try changing the starting volume of the default mixer group (which I’m guessing is at 0db?) to a slightly lower value (such as -0.05db).

I’ve found that Audio Mixer Snapshots can sometimes pop when they move from the default 0db but setting the value to something other than 0 fixes it.

If you still get popping after this, try using a longer time to reach value, (if you’re not already) e.g. 0.1f, to add a small fade.

1 Like

Wow, that’s great. Starting at -0.05 instead of 0 completely removes the popping. Thanks very much for the advice.

I did submit a bug on this (https://fogbugz.unity3d.com/default.asp?1101442_4k1hsii92pr6v7qm). Unfortunately I can’t add to it the information you provided.

2 Likes

You can - just reply to the email

Ah, thanks. I missed then in the email I got. Thanks for pointing that out.

Thanks guys! I was getting crazy with this! One year after and the bug is still there… Thank you so much!

Oh! Now I see that the answer is provided by John Leonard French… You are the best! If you need a kidney or something, let me know haha! Thanks again.

1 Like

I see this bug is closed. Can you ask them to reopen?

QA clearly misunderstood. Please reopen that bug. Doing a transition from 0 to -80db in half a second, sometimes results in a pop. Doing -0.05 to -80, in the same amount of time, does not result in a pop. It’s not about sudden changes, it’s about starting from 0db exactly. It’s a bug.

Sure. I replied to the issue asking them to reopen and consider what you’ve said here.

1 Like

QA replied that this is now fixed in 2020.2.0a4: Unity Issue Tracker - Changing AudioMixer volume from any volume in dB to 0 dB results in popping / spiking sound

2 Likes

Awesome, thank you @dgoyette

I’m hoping bug fix will be backported though, if not to 2018 LTS at least in time for 2019 LTS.

I get the audio popping any time I change the mixer of an AudioSource, even if the volume is the same (I change mixers because one mixer has effects while the other does not). I guess I could also just add effects to the one mixer and bypass them, disabling the bypass when needed, but that’s a workaround I would like to avoid.

Does anyone have experience dealing with popping when changing the mixer of an audio source? The volume for each is 1.0db (and the volume for any mixer I use set to 0 is actually -0.05db, as recommended)

To clarify: I’m not changing the volume of the mixer, but actually changing the mixing source/output stream of the AudioSource. The reason is because while the game is paused, the music/background sound is altered to reflect the paused state (pausing is a core gameplay mechanic of the game and more of a skill).

I have never changed the mixer associated with an audio source at runtime, so I don’t have any experience dealing with the popping issue you’re experiencing. However, one thing you could try is instead of changing the mixer, have you tried using snapshots for the different effects, instead of separate mixers?

I use AudioMixer.TransitionToSnapshots, for example, to kind of crossfade between two snapshots on an Audio Mixer as the player experiences loud explosion noises, and things get muffled for a while:

Normal sound effects:
6793175--787235--upload_2021-2-2_12-13-30.png

After an explosion:
6793175--787238--upload_2021-2-2_12-14-4.png

And since you get to set relative strengths of the different snapshots, you can animate the change from one snapshot to another, instead of an abrupt change that might occur if you’re changing the mixer in a single frame.

Anyway, just an approach you might consider.

If you look at the MainMixer in the Project-View.
Disable the “Auto Mixer Suspend” that should get rid of the popping sounds.

2 Likes

This works. Thank you!
Recently, I am spending more time chasing bugs implemented by Unity, than my own…