I've been looking at the [lop~] implementation (Pd-0.45-4) and noticed
something that seem weird to me.

In d_filter, line 176:

static void siglop_ft1(t_siglop *x, t_floatarg f)
    if (f < 0) f = 0;
    x->x_hz = f;
    x->x_ctl->c_coef = f * (2 * 3.14159) / x->x_sr;
    if (x->x_ctl->c_coef > 1)
        x->x_ctl->c_coef = 1;
    else if (x->x_ctl->c_coef < 0)
        x->x_ctl->c_coef = 0;

Is it correct that for:

y[n] = x[n] * a + y[n-1] * b

*a = 2π * Fc / Fs*
b = 1.0 - a

where Fc is the cut-off frequency and Fs the sampling frequency.

I appreciate the a coefficient is bounded afterwards but wouldn't that mean
that Fc values greater than Fs / 2π will have no impact on the sound being

For example if Fs is 44100, then Fc values above ~7020Hz will not affect
the filter.

Have I missed something crucial or could this a bug in the code?

The simple IIR filter described in
http://en.wikipedia.org/wiki/Low-pass_filter suggests that the actual
coefficient calculation should be more like:

a = 2π*Fc / (2π*Fc + Fs)

Looking forward to understand this more!


Follow me on Twitter @diplojocus
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 

Reply via email to