Thinking here about a simple anti-pop system for bypass/gate switches like the Vactrol. It seems (naively) that a simple exponentially weighted average could be used to deal with the problem and simulate the resistor designs I’ve seen for general bypass circuits.
To set the bypass
Set the bypass target to
false (this could be 1.0 or 0.0 to get around type converting a boolean.)
To test the bypass
Check if the EWMA is greater than zero.
We have to attenuate the signal over N samples after turning on the bypass, which means we cannot rely on the desired state. Testing the EWMA’s output tells us whether the bypass is fully in effect.
If the bypass is not in effect (see 2), run the circuit and multiply the output by the EWMA weight. Otherwise do nothing and return zero.
If the sample size is fixed N, then we are only adding to every sample:
- A single branch and,
- Three multiplications and an addition
Allowing a changeable N (based on sample rate) is the same, but also adds one read to each sample.
It’s worth experimenting to see if the resistance gate needs to be relative to sample rate or can just be some short fixed value (enough to kill the DC offset.)