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

Pop when enabling audio filter, such as LowPassFilter #95308

Open
Tracked by #76797
jitspoe opened this issue Aug 9, 2024 · 5 comments
Open
Tracked by #76797

Pop when enabling audio filter, such as LowPassFilter #95308

jitspoe opened this issue Aug 9, 2024 · 5 comments

Comments

@jitspoe
Copy link
Contributor

jitspoe commented Aug 9, 2024

Tested versions

4.0 - 4.3 rc2

System information

Windows 10, Vulkan forward +, Nvidia 3070

Issue description

When enabling filters on a bus, there can be a pop or crack, depending on the wave form when the filter is enabled. For example, I enable a low pass filter when the player enters the water, and sometimes there's a very audible click or pop.

Steps to reproduce

  1. Add a LowPassFilter to the Master bus.
  2. Toggle it on and and off with AudioServer.set_bus_effect_enabled()
  3. Note that sometimes there's a pretty glaring pop.

Minimal reproduction project (MRP)

test_filter_pop.zip

@jitspoe
Copy link
Contributor Author

jitspoe commented Aug 9, 2024

I guess this behavior is kind of expected, but it would be nice if it just had a very small crossfade, like when starting/stopping sounds or changing samples, to avoid pops.

I was considering enabling the low pass filter with the cutoff set very high then pan it down quickly in code, but it looks like there's no interpolation from the start/end values for all the frames in the buffer, so even that would probably have micro pops, especially at lower framerates.

My use case is that I'm enabling a low pass filter on everything when the player goes underwater, and clicking/popping can be pretty audible every time you jump in water.

@jitspoe
Copy link
Contributor Author

jitspoe commented Sep 11, 2024

So I tried a couple ways to work around this and failed.

Method 1: Start at a high cutoff rate, like 48000 and adjust it every frame to reduce pops.
Failure: High cutoff values cause the sound to cut out completely, and anything that doesn't cut out still results in pops (strangely, even 24000 seems to have worse pops than setting it to like 1000).

Method 2: Pass to 2 busses. One with the filter and one without and cross-fade.
Failure: Doesn't appear to be any way to send to more than one bus.

I think we'll need an engine fix to be able to enable low-pass filters on the fly without popping.

@jitspoe
Copy link
Contributor Author

jitspoe commented Sep 11, 2024

Probably the most relevant related issue: #77669

@michaelhartung
Copy link

This is just a hunch:

audio_effect_filter.cpp does not interpolate the coefficients when updating them, and it doesn't use the provided process_one_interp method that uses the interpolated coefficients.

From what I know about DSP, changing filter coefficients without any smoothing can generate discontinuities (pops).

Maybe sth. to look into.

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

3 participants