Skip to content

De Clicker

mzuelch edited this page Jan 24, 2026 · 1 revision

plugin_id: declicker · UI: De-Klicker (Impuls-/Click-Entfernung) · Source: plugins/declicker.py

Removes short impulse-like clicks/pops using a pragmatic detect → group → inpaint pipeline. It is designed for offline post-processing of stems (especially residual).

Parameters

Parameter Type Default Range Meaning
mode choice highpass highpass derivative
smooth_ms float 1.0 0.05..10 ms Moving-average window used only in highpass mode.
sensitivity float 8.0 (typ.) 3..15 Multiplier for the robust scale estimate; higher detects more (risking transients).
min_level_db float -45.0 (typ.) -80..0 dBFS Absolute minimum click level; prevents over-triggering on very quiet signals.
max_click_ms float 5.0 ≥ 0 ms Skip segments longer than this (assumed not a click).
pad_ms float 0.20 ≥ 0 ms Expand repaired region around the detection.
merge_ms float 0.50 ≥ 0 ms Merge detection gaps up to this duration into one region.
mix float 1.0 0..1 Blend repaired signal with original.

Algorithm

1) Build a high-frequency proxy

  • derivative mode:

    proxy = |diff(x)|
    

    (expanded to also cover neighbor samples)

  • highpass mode:

    lp    = moving_average(x, win = smooth_ms)
    proxy = |x - lp|
    

2) Robust thresholding (per channel)

sigma = 1.4826 * median(|proxy - median(proxy)|)    # MAD → σ estimate
thr   = max( median(proxy) + sensitivity*sigma, 10^(min_level_db/20) )
mask  = proxy > thr

3) Segment formation & repair

  • Merge mask gaps up to merge_ms into a single segment.
  • For each segment (s,e):
    • expand by pad_ms
    • if segment length exceeds max_click_ms: skip
    • otherwise repair by linear interpolation between boundary samples
x[s:e] = linspace(x[s-1], x[e+1])

Implementation notes

  • The repair method is intentionally simple and fast; for large defects you usually want a more advanced restoration method.
  • If strong transients are being “repaired”, reduce sensitivity, increase min_level_db, or switch to derivative mode.

References

  • S. J. Godsill, P. J. W. Rayner, Digital Audio Restoration, Springer, 1998. (Click/impulse restoration overview.)
  • F. R. Hampel, “The Influence Curve and Its Role in Robust Estimation,” Journal of the American Statistical Association, 69(346), 1974. (MAD as robust scale basis.)

Clone this wiki locally