DSPRelated.com
Forums

Shelving filter co-eff calculation.

Started by Prassi March 5, 2007
Hi,

   I am using RBJ Audio cook book for calculation of the shelving
filter co-efficient.
for a low pass shelving filter with cutoff of f0 = 3KHz (means
bandwith is 3KHz) i want to calculate alpha with bandwidth given.
Formula for alpha according to the cookbook is


alpha = sin(w0) * sinh(ln(2)/2*BW*w0/sin(w0)) where w0 = (2*pi*f0)/fs
and fs = 44.1KHz


here in this formula if i take BW = 3KHz and claculate the value in
matlab i am getting  "INF", so please can you help me out how to
calculate "alpha" when bandwidht is given.


Thanks a lot,


Rgds,
-Prasad

On Mar 5, 7:46 am, "Prassi" <mailpra...@gmail.com> wrote:
> > I am using RBJ Audio cook book for calculation of the shelving > filter co-efficient. > for a low pass shelving filter with cutoff of f0 = 3KHz (means > bandwith is 3KHz) i want to calculate alpha with bandwidth given. > Formula for alpha according to the cookbook is > > alpha = sin(w0) * sinh(ln(2)/2*BW*w0/sin(w0)) where w0 = (2*pi*f0)/fs > and fs = 44.1KHz > > here in this formula if i take BW = 3KHz and claculate the value in > matlab i am getting "INF", so please can you help me out how to > calculate "alpha" when bandwidht is given.
so did you put in 3 or 3000 in for BW? maybe you could measure bandwidth in megahertz and set BW to 0.003 . it shouldn't matter since the algorithm doesn't know and shouldn't care with what units you measure or express time or frequency. r b-j
Prassi wrote:

> I am using RBJ Audio cook book for calculation of the > shelving filter co-efficient. > for a low pass shelving filter with cutoff of f0 = 3KHz (means > bandwith is 3KHz) i want to calculate alpha with bandwidth > given.
But you've just written yourself that f0 already sets the bandwidth! In the shelving case the parameter BW affects the transition width, as the cookbook implies by relating alpha to either of BW and S. Martin -- Quidquid latine scriptum est, altum videtur.
On Mar 5, 7:11 pm, Martin Eisenberg <martin.eisenb...@udo.edu> wrote:
> Prassi wrote: > > I am using RBJ Audio cook book for calculation of the > > shelving filter co-efficient. > > for a low pass shelving filter with cutoff of f0 = 3KHz (means > > bandwith is 3KHz) i want to calculate alpha with bandwidth > > given. > > But you've just written yourself that f0 already sets the bandwidth! > In the shelving case the parameter BW affects the transition width, > as the cookbook implies by relating alpha to either of BW and S.
i have to confess to being a little cryptic. the BW parameter doesn't really make direct sense for the shelving filters, but i suppose it could be used. i think it would have something to do with the width (in log frequency) of the transition region of the shelf. anyway, even if it were a BPF or notch or peaking EQ (where BW makes direct sense) it is BW in *octaves*. and it's essentially dimensionless (which is why it need not be normalized against a like dimensioned quantity before stuffing it into the sinh() function). if the OP put in 3000 in for BW, bad things would happen. but i dunno what the bad things would be. but they would be bad. very bad.
> Quidquid latine scriptum est, altum videtur.
whomever writes this in Latin is profound. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
Hi,

 My formula substitution i have used is 3000
i.e,   alpha = sin(w0) * sinh(ln(2)/2*(3000)*w0/sin(w0))

here in the above formula i have used 3000, should i use 3 instead of
3000 and also in low pass filter case the bandwidth is nothing but the
cut of frequency it self right.

please help me out in this i am really confused and not abel to solve.

rgds,
-Prasad
robert bristow-johnson wrote:
> On Mar 5, 7:46 am, "Prassi" <mailpra...@gmail.com> wrote: > > > > I am using RBJ Audio cook book for calculation of the shelving > > filter co-efficient. > > for a low pass shelving filter with cutoff of f0 = 3KHz (means > > bandwith is 3KHz) i want to calculate alpha with bandwidth given. > > Formula for alpha according to the cookbook is > > > > alpha = sin(w0) * sinh(ln(2)/2*BW*w0/sin(w0)) where w0 = (2*pi*f0)/fs > > and fs = 44.1KHz > > > > here in this formula if i take BW = 3KHz and claculate the value in > > matlab i am getting "INF", so please can you help me out how to > > calculate "alpha" when bandwidht is given. > > so did you put in 3 or 3000 in for BW? maybe you could measure > bandwidth in megahertz and set BW to 0.003 . > > it shouldn't matter since the algorithm doesn't know and shouldn't > care with what units you measure or express time or frequency. > > r b-j
robert bristow-johnson wrote:

>> Quidquid latine scriptum est, altum videtur. > > whomever writes this in Latin is profound.
I'm not sure whether you're trying to translate or pulling my leg, but either way -- not quite ;) Martin -- Whatever is written in Latin looks profound.
On Mar 6, 6:23 am, Martin Eisenberg <martin.eisenb...@udo.edu> wrote:
> robert bristow-johnson wrote: > >> Quidquid latine scriptum est, altum videtur. > > > whomever writes this in Latin is profound. > > I'm not sure whether you're trying to translate or pulling my leg, > but either way -- not quite ;)
it was the best a Neaderthal could do. r b-j
On Mar 5, 10:22 pm, "Prassi" <mailpra...@gmail.com> wrote:
> Hi, > > My formula substitution i have used is 3000 > i.e, alpha = sin(w0) * sinh(ln(2)/2*(3000)*w0/sin(w0)) > > here in the above formula i have used 3000, should i use 3 instead of > 3000 and also in low pass filter case the bandwidth is nothing but the > cut of frequency it self right. > > please help me out in this i am really confused and not abel to solve. > > rgds, > -Prasad > > robert bristow-johnson wrote: > > On Mar 5, 7:46 am, "Prassi" <mailpra...@gmail.com> wrote: > > > > I am using RBJ Audio cook book for calculation of the shelving > > > filter co-efficient. > > > for a low pass shelving filter with cutoff of f0 = 3KHz (means > > > bandwith is 3KHz) i want to calculate alpha with bandwidth given. > > > Formula for alpha according to the cookbook is > > > > alpha = sin(w0) * sinh(ln(2)/2*BW*w0/sin(w0)) where w0 = (2*pi*f0)/fs > > > and fs = 44.1KHz > > > > here in this formula if i take BW = 3KHz and claculate the value in > > > matlab i am getting "INF", so please can you help me out how to > > > calculate "alpha" when bandwidht is given. > > > so did you put in 3 or 3000 in for BW? maybe you could measure > > bandwidth in megahertz and set BW to 0.003 . > > > it shouldn't matter since the algorithm doesn't know and shouldn't > > care with what units you measure or express time or frequency.
please read the cookbook text carefully. it shows three different ways to compute the intermediate parameter "alpha": alpha = sin(w0)/(2*Q) (case: Q) = sin(w0)*sinh( ln(2)/2 * BW * w0/sin(w0) ) (case: BW) = sin(w0)/2 * sqrt( (A + 1/A)*(1/S - 1) + 2 ) (case: S) from one of three other parameters supplied as a design spec. which one should you use for the shelving filters? what does the cookbook say? Q (the EE kind of definition, except for peakingEQ in which A*Q is the classic EE Q. That adjustment in definition was made so that a boost of N dB followed by a cut of N dB for identical Q and f0/Fs results in a precisely flat unity gain filter or "wire".) _or_ BW, the bandwidth in octaves (between -3 dB frequencies for BPF and notch or between midpoint (dBgain/2) gain frequencies for peaking EQ) _or_ S, a "shelf slope" parameter (for shelving EQ only). When S = 1, the shelf slope is as steep as it can be and remain monotonically increasing or decreasing gain with frequency. The shelf slope, in dB/octave, remains proportional to S for all other values for a fixed f0/Fs and dBgain. so there are a few questions for you, Prassi: 1. which type or types of filter uses Q as a specification? 2. which type(s) use BW? 3. which type(s) use S? 4. in what units is BW specified in? 5. how does an equation that has a dimensionful parameter (like frequency) work when there are an unlimited number of unit systems with which to measure and express that dimensionful parameter (resulting in different numerical values for that dimensionful parameter)? how does such an equation result in the same result even when different units to measure something are used? i realize i could just hand over the answer to you, but i was thinking of the proverb: "Give a man a fish and he eats for a day, teach a man to fish and he eats for life." r b-j
On 6 Mrz., 19:12, "robert bristow-johnson" <r...@audioimagination.com>
wrote:
> On Mar 6, 6:23 am, Martin Eisenberg <martin.eisenb...@udo.edu> wrote: > > > robert bristow-johnson wrote: > > >> Quidquid latine scriptum est, altum videtur. > > > > whomever writes this in Latin is profound. > > > I'm not sure whether you're trying to translate or pulling my leg, > > but either way -- not quite ;) > > it was the best a Neaderthal could do.
Them dudes had bigger brains than us!
Andor wrote:
> On 6 Mrz., 19:12, "robert bristow-johnson" <r...@audioimagination.com> > wrote: >> On Mar 6, 6:23 am, Martin Eisenberg <martin.eisenb...@udo.edu> wrote: >> >>> robert bristow-johnson wrote: >>>>> Quidquid latine scriptum est, altum videtur. >>>> whomever writes this in Latin is profound. >>> I'm not sure whether you're trying to translate or pulling my leg, >>> but either way -- not quite ;) >> it was the best a Neaderthal could do. > > Them dudes had bigger brains than us!
Probably bigger gonads too, but look who died out! Jerry -- Engineering is the art of making what you want from things you can get. &macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;