Reply by Carlos Moreno May 27, 20052005-05-27
robert bristow-johnson wrote:

>>>BTW, the following is the code that audacity uses for bass boosting. > > where do they say that? just a curiousity.
In the source code, I presume... (Audacity is open source, if I'm not mistaken) Carlos --
Reply by robert bristow-johnson May 27, 20052005-05-27
in article 119el3mh79qcaef@corp.supernews.com, Jon Harris at
jon_harrisTIGER@hotmail.com wrote on 05/27/2005 13:11:

> It looks like they are using the low shelving biquad filter (IIR) from RB-J's > Audio EQ Cookbook: > http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt
i dunno whether or not Audacity uses the cookbook or not, but the equations below look a lot like the cookbook.
>> BTW, the following is the code that audacity uses for bass boosting.
where do they say that? just a curiousity.
>> My question is: what criteria brings us to this calculation of >> coefficients? >> >> /* Compute coefficents of the biquand IIR filter */ >> omega = 2 * 3.141592653589 * frequency / mCurRate; >> sn = sin(omega); >> cs = cos(omega); >> a = exp(log(10.0) * dB_boost / 40); >> shape = float(1.0); /*Low Shelf filter's shape, if this is >> too large >> or too small it will result an unstable >> filter */ >> beta = sqrt((a * a + 1) / shape - (pow((a - 1), 2))); >> /* Coefficients */ >> b0 = a * ((a + 1) - (a - 1) * cs + beta * sn); >> b1 = 2 * a * ((a - 1) - (a + 1) * cs); >> b2 = a * ((a + 1) - (a - 1) * cs - beta * sn); >> a0 = ((a + 1) + (a - 1) * cs + beta * sn); >> a1 = -2 * ((a - 1) + (a + 1) * cs); >> a2 = (a + 1) + (a - 1) * cs - beta * sn; >> >> Then these coefficients are used in recursion equation:- >> (b0 * in + b1 * xn1 + b2 * xn2 - a1 * yn1 - a2 * yn2) / a0; >>
-- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
Reply by Jon Harris May 27, 20052005-05-27
It looks like they are using the low shelving biquad filter (IIR) from RB-J's
Audio EQ Cookbook:
http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt

RB-J can jump in if I get it wrong, but those equations were created by starting
with the basic analog filter equations, transforming using the bi-linear Z
transform, and then doing a whole bunch of algebraic manipulation/trig
substitutions to get the relatively simple forms shown.  The link above has some
additional explanations of this, so try reading through that and see if that
answers your questions.  The section at the end talks about derivation.

-- 
Jon Harris
SPAM blocked e-mail address in use.  Replace the ANIMAL with 7 to reply.

"Himanshu Chauhan" <hs.chauhan@gmail.com> wrote in message
news:1117207908.649533.253610@f14g2000cwb.googlegroups.com...
> Hello! > > I am learning about iir filters. For this I was going through the bass > boost effect of audacity. Can anybody please tell me how exactly the > filter coefficients are being calculated? I wonder how do we come to a > point of understanding that "this" algorithm for calculating the > coefficients is the one for bass boost or any other effect. I tried > applying the same effect with FIR filter. I passed the original signal > through a low-pass filter, amplified it and added it again to the > original one. Bass was boosted no probs in that but there are clicks. I > think its again the same problem of taking the input signal as chunks > instead of a continuous stream. Am I right or is there something else > that I cannot see? > BTW, the following is the code that audacity uses for bass boosting. > > My question is: what criteria brings us to this calculation of > coefficients? > > /* Compute coefficents of the biquand IIR filter */ > omega = 2 * 3.141592653589 * frequency / mCurRate; > sn = sin(omega); > cs = cos(omega); > a = exp(log(10.0) * dB_boost / 40); > shape = float(1.0); /*Low Shelf filter's shape, if this is > too large > or too small it will result an unstable > filter */ > beta = sqrt((a * a + 1) / shape - (pow((a - 1), 2))); > /* Coefficients */ > b0 = a * ((a + 1) - (a - 1) * cs + beta * sn); > b1 = 2 * a * ((a - 1) - (a + 1) * cs); > b2 = a * ((a + 1) - (a - 1) * cs - beta * sn); > a0 = ((a + 1) + (a - 1) * cs + beta * sn); > a1 = -2 * ((a - 1) + (a + 1) * cs); > a2 = (a + 1) + (a - 1) * cs - beta * sn; > > Then these coefficients are used in recursion equation:- > (b0 * in + b1 * xn1 + b2 * xn2 - a1 * yn1 - a2 * yn2) / a0; > > (xn and yn are previous inputs and outputs respectively) > > Thanks and regards > --Himanshu >
Reply by Himanshu Chauhan May 27, 20052005-05-27
Hello!

I am learning about iir filters. For this I was going through the bass
boost effect of audacity. Can anybody please tell me how exactly the
filter coefficients are being calculated? I wonder how do we come to a
point of understanding that "this" algorithm for calculating the
coefficients is the one for bass boost  or any other effect. I tried
applying the same effect with FIR filter. I passed the original signal
through a low-pass filter, amplified it and added it again to the
original one. Bass was boosted no probs in that but there are clicks. I
think its again the same problem of taking the input signal as chunks
instead of a continuous stream. Am I right or is there something else
that I cannot see?
BTW, the following is the code that audacity uses for bass boosting.

My question is: what criteria brings us to this calculation of
coefficients?

 /* Compute coefficents of the biquand IIR filter */
omega = 2 * 3.141592653589 * frequency / mCurRate;
sn = sin(omega);
cs = cos(omega);
 a = exp(log(10.0) * dB_boost / 40);
shape = float(1.0);           /*Low Shelf filter's shape, if this is
too large
                            or too small it will result an unstable
filter */
beta = sqrt((a * a + 1) / shape - (pow((a - 1), 2)));
/*  Coefficients  */
b0 = a * ((a + 1) - (a - 1) * cs + beta * sn);
b1 = 2 * a * ((a - 1) - (a + 1) * cs);
b2 = a * ((a + 1) - (a - 1) * cs - beta * sn);
a0 = ((a + 1) + (a - 1) * cs + beta * sn);
a1 = -2 * ((a - 1) + (a + 1) * cs);
a2 = (a + 1) + (a - 1) * cs - beta * sn;

Then these coefficients are used in recursion equation:-
(b0 * in + b1 * xn1 + b2 * xn2 - a1 * yn1 - a2 * yn2) / a0;

(xn and yn are previous inputs and outputs respectively)

Thanks and regards
--Himanshu