DSPRelated.com
Forums

How to create peak/shelf filters, that are symmetric close to nyquist?

Started by jungledmnc November 3, 2011
On 11/12/11 11:35 AM, jungledmnc wrote:
>> well, maybe they're using a higher order IIR, or maybe they're using an >> FIR (and the FIR need not be linear phase), or maybe they're using a >> combination like a biquad with an FIR "fixing it", but if it's a basic >> 2nd-order IIR (a biquad either in straight-forward Direct 1 or in the >> state-variable or some other topology), there are only 5 numbers you can >> play around with. >> >> and no matter how it's done (if it ain't oversampled), the *slope* of >> the gain function must be 0 at Nyquist. the curve has to start leveling >> off at frequencies just below Nyquist. you cannot beat that without >> moving Nyquist to a higher frequency, which is oversampling. >> > > Yes, actually the filters in all the mentioned software all have "0 slope" > at Nyquist and I'm ok with that. And the Orfanidis filter looks > suspiciously similar! The only trouble is how the filter reacts to > different frequency/Q combinations. With all frequencies (at least so far) > I can find a Q (or rather Dw), which makes it look correct. So I think all > it needs is a good Dw definition. Unfortunately that's exactly what I don't > know anything about :(... >
well, if Orfanidis didn't toss an extra variable (the gain at Nyquist) into the mix, then the *only* possible difference between these would be however the Q or BW or Dw gets defined, how that quantity is related to the position of the knob controlling bandwidth. but you also have the gain at Nyquist to play around with. so you have two knobs to diddle with, in order to try to match the curve you have to the other products (like Izotope or whoever), not just one. with the pre-Orfanidis EQs, that gain was always set to 0 dB and with Orfanidis, that gain is set to whatever the gain the analog EQ would have at that frequency. but, because the slope must be zero at that frequency, the gain curve on the right side must shoot down a little faster (than the analog prototype) so that, when it levels off it can hit the target gain (which is the same gain as the analog filter) at Nyquist. so, perhaps you want that gain (at Nyquist) to be a little *higher* (assuming a peaking EQ in boost mode, not cut mode) than what Orfanidis suggests. so you have 5 coefficients (b0, b1, b2, a1, a2) and 5 constraints: 1. gain at 0 Hz is 0 dB 2. gain at Nyquist is *some* specified value... 3. at a given peak frequency, the slope of the gain is 0 4. at that same freq, the gain is some given boost gain 5. something concerning Q or bandwidth or "Dw". if you nail all 5 constraints, you *must* result in a unique set of 5 coefficients, you have no other choice (5 equations, 5 unknowns). but constraint 5 can be mushy because we don't all agree on the meaning of bandwidth and constraint 2 is now also sorta undetermined. if those other EQ products are biquads, then you have to nail down what they do for constraints 2 and 5. rots o' ruck. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
On Nov 11, 9:43&#4294967295;pm, "jungledmnc" <jungledmnc@n_o_s_p_a_m.gmail.com>
wrote:

> Anyway I tried these: > > const double Dw = Q * w0 / msin(w0); > const double Dw = 2 * w0 * msinh( (msin(w0)/w0) * masinh (1/(2*Q))); > const double Dw = masinh(0.5/Q) * (2/mln(2.0)) * w0 / msin(w0); > const double Dw = msin(w0) / (2*Q); > > None of them work well.
Did you read my comments about coding c++? If so, why do you keep doing the flaws I warned about? Rune
>Did you read my comments about coding c++? >If so, why do you keep doing the flaws I warned >about?
I'm afraid this won't be it Rune, and matlab does that too. Anyway I found an interesting thing: When I take the peak filter with just any Q and Dw defined like this: Dw = w0 / Q It behaves very well (in fact it is basically same as r-b-j's peak filter), but then when I start increasing the frequency, it behaves well until the point when the computed gain at nyquist exceeds the the bandwidth gain GB. Since that moment it starts getting wider and thiner and the width basically oscillates somehow. But when nyquist gain is lower than GB, it is fine. I suppose it could be some inaccuracy, but matlab does that too, so I don't really know. Any ideas? jungledmnc
On 18 Nov, 03:29, "jungledmnc" <jungledmnc@n_o_s_p_a_m.gmail.com>
wrote:
> >Did you read my comments about coding c++? > >If so, why do you keep doing the flaws I warned > >about? > > I'm afraid this won't be it Rune, and matlab does that too.
Doesn't matter. At some point this *will* be the problem and you will still find yourself in trouble, even if you get the formulae right. Programming in general, and numerics in particular, is about being proactive; about preventing errors to occur in the first place. If an error or flaw occurs, it is often enough too late to do anything about it anyway. Rune