[PD] algorithms for drawing filter response curves

Mike Moser-Booth mmoserbooth at gmail.com
Tue Feb 8 05:20:14 CET 2011


I don't really know how to test this and I don't really know tcl, but I
tried looking at the code to see if I could make some sense of it anyway,
because why the hell not. ;-) Anyway, the only part I really understood was
the calculation of the coefficients, and I noticed something wrong. You are
calculating alpha for bandwidth instead of Q. I'm guessing you're just
borrowing what is in the ggee externals (given the code's comments), because
it's done the same way there, but it's not really conventional for a lowpass
filter. That's really more for bandpass, notch, and peaking filters. Using Q
is also a simpler calculation: alpha = sin(omega)/(2*Q). With Q set to .7071
(or -3 dBfs), you have a filter with no resonance, which makes sense because
the cutoff frequency for a lowpass filter is defined as the frequency where
the response falls be 3 dB. This is also how Max's [filtergraph~] works.

It's all defined here in Robert Bristow-Johnson's Cookbook:

http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt

The ggee externals, as far as I can tell, are all based on this cookbook,
though with mistakes like using BW instead of Q.

Hope that helps,
.mmb

On Mon, Feb 7, 2011 at 10:03 PM, Hans-Christoph Steiner <hans at at.or.at>wrote:

>
> On Feb 7, 2011, at 8:35 PM, Spencer Russell wrote:
>
>  On Sun, Feb 6, 2011 at 11:15 PM, Mathieu Bouchard <matju at artengine.ca>
>> wrote:
>>
>>> On Sun, 6 Feb 2011, Spencer Russell wrote:
>>>
>>>  [1] gives the magnitude frequency response given the biquad
>>>> coefficents, and it linked to from several places around the net. Is
>>>> this the sort of thing you're looking for?
>>>> [1] http://bit.ly/eFck4j
>>>>
>>>
>>> This link got me directly to :
>>>
>>>  USB complete: everything you need to develop custom USB peripherals
>>>  Par Jan Axelson
>>>  Chapitre 12
>>>  Page 364
>>>
>>> and nothing else. (??)
>>>
>>>
>> Whoops, I meant to send this: http://bit.ly/gUCBu4. Sorry.
>>
>> Here he's basically just taken the transfer function of a biquad and
>> made the z = exp(j*w/Fs) as Mike suggested, followed by taking the
>> magnitude and log-scaling for dB, but he's done the algebraic legwork.
>> Just note that w (lower-case omega) is 2*pi*f and you should be good
>> to go. He's also done some trig-substitution for more numerical
>> precision.
>>
>
> I'm making good progress, but now am getting lost in the filter math
> meeting the pixel math.  Can someone mathy check my math?  Or even try it
> out?
>
>
> https://github.com/pd-projects/filterview
>
> .hc
>
>
>
> ----------------------------------------------------------------------------
>
>                  ¡El pueblo unido jamás será vencido!
>
>
>
>
> _______________________________________________
> Pd-list at iem.at mailing list
> UNSUBSCRIBE and account-management ->
> http://lists.puredata.info/listinfo/pd-list
>



-- 
Mike Moser-Booth
mmoserbooth at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20110207/8eb9d737/attachment.htm>


More information about the Pd-list mailing list