declick

waveform de-click module when the waveform has sudden changes in it's dirac difference, the sudden offset will be fed into a LP filter, which then "slowly" fades the offset back to zero.
Author: Remco van der Most
License: BSD
Github: sss/filter/declick.axo

Inlets

frac32buffer in

Outlets

frac32buffer out

Parameters

frac32.u.map damp

frac32.u.map threshold

Declaration
int32_t p1;
int32_t p2;
int32_t p3;
int32_t val1;
int32_t val2;
Control Rate
int32_t damp;
MTOF((1 << 27) - param_damp, damp);
Audio Rate
int32_t diff1 = inlet_in - p1;
int32_t diff2 = p1 - p2;
int32_t diff3 = p2 - p3;
int32_t avg = diff1 + diff3 >> 1;
int32_t davg = diff2 - avg;
int32_t savg = davg;
davg = davg > 0 ? davg : -davg;
if (davg > (param_threshold)) {
  val1 += diff2;
}
val1 -= ___SMMUL(val1, damp);

p3 = p2;
p2 = p1;
p1 = inlet_in;
int32_t out = p2 - val1;
val2 += (out - val2) >> 10;
outlet_out = out - val2;

Privacy

© 2024 Zrna Research