Skip to content

Fix audio clicking when enabling/disabling effects or toggling bus bypass - #124850

Open
JianghaoL wants to merge 2 commits into
godotengine:masterfrom
JianghaoL:fix/audio-effect-toggle-crossfade
Open

JianghaoL wants to merge 2 commits into
godotengine:masterfrom
JianghaoL:fix/audio-effect-toggle-crossfade

Conversation

@JianghaoL

Copy link
Copy Markdown

Fixes #95308

Before Fix: Audible clicks and pops when toggling effects' enable or buses' bypass. The original code directly skips effect processing when an effect is disabled or a bus is bypassed, which changes the wet (processed) signal to the dry (unprocessed) signal, creating abrupt changes in the waveform.

After Fix: A linear 5 ms crossfade is applied to every effect on toggling enable/bypass. It crossfades dry and wet signals to smooth out the change. In the tested cases, no audible clicks were generated.


The implementation has every Effect struct keep its own wet_mix state. The state is initialized when adding new effects to a bus, and it checks if both the effect is enabled and the bus is not bypassed. All channels use the same mix value to keep the processing synchronized. The state is updated per buffer block after all channels finish processing.

The code skips effect processing only after the targeted effect is disabled or the bus is bypassed and the mix has reached 100% dry.

Notice that the current implementation individually crossfades each effect when choosing to bypass the bus.


Tested on Windows with version 4.8.beta based on commit c8256a8. Tested cases:

  1. Enable and disable a single effect.
  2. Bypass and unbypass a bus.
  3. Multiple effects added in serial.
  4. Add new effects when bypassed.
  5. Load a bypassed bus layout.

Clicks and pops do not occur in the above situations.


Recording Waveform at effect enable point:

Before Fix
before-fix

After Fix
after-fix

AI Usage
Discussed test cases and identified possible causes. Reviewed code style and comments.

@JianghaoL
JianghaoL requested a review from a team as a code owner October 25, 2026 00:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pop when enabling audio filter, such as LowPassFilter

2 participants