pyFDN.td.DCBlocker#
- class pyFDN.td.DCBlocker(channels, R=0.995, correct_loss=False, fs=48000.0, env_tau_s=0.05, gain_tau_s=0.02, max_gain=4.0)[source]#
Stateful per-channel first-order DC blocker with optional slow energy compensation,
y[n, c] = x[n, c] - x[n-1, c] + R * y[n-1, c].The differencing term removes the DC offset a nonlinearity such as
ControllableFullWaveRectwould otherwise inject into a feedback loop, at the cost of also attenuating content near DC. Whencorrect_lossis enabled, a slowly-varying gain tracks the ratio of input to output power through two exponential envelope followers – one over the signal power, one smoothing the resulting gain – and rescales the output to compensate for that loss.- Parameters:
channels (
int) – Number of channels processed independently.R (
float) – Pole location of the blocker,0 < R < 1. Closer to 1 pushes the cutoff frequency down and preserves more low-frequency content.correct_loss (
bool) – IfTrue, apply the energy-compensation gain described above.fs (
float) – Sampling rate in Hz, used to convert the time constants below into per-sample smoothing coefficients.env_tau_s (
float) – Time constant of the power envelope followers, in seconds.gain_tau_s (
float) – Time constant of the gain smoothing, in seconds.max_gain (
float) – Ceiling on the compensation gain. A signal the blocker removes almost entirely – anything close to pure DC – has an output power near zero, so the uncapped ratio grows without bound: it would undo the blocking it is compensating for and run away inside a feedback loop.
- __init__(channels, R=0.995, correct_loss=False, fs=48000.0, env_tau_s=0.05, gain_tau_s=0.02, max_gain=4.0)[source]#
Methods
__init__(channels[, R, correct_loss, fs, ...])filter(block)Filter one block and advance internal state.
process(signal, *[, squeeze])Filter a whole signal in one call, from the current state.
reset()Clear internal state (no-op for stateless operators).
Attributes
in_channelsout_channels