Search code examples
iosaudiofilteringwaveform

iOS - Audible pop after filtered sound stops


been programming a waveform generator on my iOS device. I have a second order low pass filter with a very high Q going through it. When I bypass the filter, the sound is clean and doesn't pop. However, when the filter is on, when I release the sound there is a pop. Should I be putting an envelope on the filter or should I be doing something else? It's really annoying and I definitely want the pop to be gone. Looking for any advice! Thanks!


Solution

  • A high-Q low-pass filter will by definition have a large time-constant (remember it's an Infinite Impulse response filter).

    A IIR filter is a weighted sum of output samples - the equation below is a simple, generalised example:

    y[n] = x[n]*K0 + y[n-1]*K1 + y[n-2]*K2 + y[n-3]*K3....y[n-z]*Kz

    When you bypass filter (presumably by routing the signal around it), you will suddenly remove any effect the feedback loop has on the output, which may result in a significant discontinuity in the output signal.

    Instead, try inserting zeros into the delay line - this will gradually diminish their contribution to the filter equation over subsequent samples.

    Alternatively, you could insert a mixer, that mixes 'dry' and 'wet' signal after the filter and change the proportion mixed together with an envelope.