[PD] how to create a lowpass filter from first principles?
Frank Barknecht
fbar at footils.org
Fri Jan 23 00:56:46 CET 2009
Hallo,
Geoff hat gesagt: // Geoff wrote:
> The DSP book I have read gives a simple lowpass filter function as
>
> g(n) = (f(n1) + f(n) + f(n+1))/3
>
> i.e the average value of three consecutive samples. I understand how
> this is in effect a lowpass filter.
>
> How do I implement that in PD?
A lot of that is explained in Miller's book:
http://crca.ucsd.edu/~msp/techniques/latest/bookhtml/node127.html
You better read the previous chapter on Delays first, it contains
important info as well.
Generally the basic objects for filter design are [rzero~], [rpole~] and
[czero~], [cpole~] and another one is [biquad~].
With the zero/pole objects you directly give the location of poles and
zeroes of your filter while the biquad~ is an alternative way to express
two zero and two pole objects in one.
I don't know the meaning of the variables in your formula, especially the
f(n+1) looks strange: Is this a value of the future or an output value,
like the "y" variables in many other filter equations? Anyway you can sum
up the current and the previous samples easily with rzero~:
[sig~ 1]

[rzero~ 1]

[snapshot~]

[2 \
For more complex filters check out Miller's book and the examples
included in Pd.
I recently also wrote a lot of filter abstractions for the RjDj library:
see http://trac.rjdj.me/browser/trunk/rjlib/rj The interesting objects
there are e_beequad.pd as a biquad~ clone and these for calculating
various coefficients: u_lowpass, u_lowpassq, u_highpass, u_highpassq, ...
e_lop4.pd also is interesting: It's a 4 pole resonant lowpass filter,
good for moogish synths, when combined with the bandlimited oscillators
of s_osc.pd there. All these filtes use zero/pole objects inside.
RjDj abstractions are for Pd vanilla, so they run everywhere.
Ciao

Frank Barknecht
More information about the Pdlist
mailing list