Hey Hans,
I had some time to go over this today, and I think I've got the response working. I didn't document my changes as I went along (sorry), but I think I remembered them all and wrote them at the top of the attached script. Also, I should take back what I said earlier about the bandwidth. Given this gui, it makes sense for it to be BW.
.mmb
On Tue, Feb 8, 2011 at 12:08 AM, Hans-Christoph Steiner hans@at.or.atwrote:
I'll check out the settings. As for running this, its a script, you can just run it on the Terminal. On GNU/Linux, it should just work. On Mac OS X, you'll probably need to have run it like this:
/usr/bin/wish filterview.tcl
.hc
On Feb 7, 2011, at 11:20 PM, Mike Moser-Booth wrote:
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.or.atwrote:
On Feb 7, 2011, at 8:35 PM, Spencer Russell wrote:
On Sun, Feb 6, 2011 at 11:15 PM, Mathieu Bouchard matju@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@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
-- Mike Moser-Booth mmoserbooth@gmail.com
"A cellphone to me is just an opportunity to be irritated wherever you are." - Linus Torvalds