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:
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.
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.
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:
After an explosion:
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.