Hello !

I'm trying to make a bandpass filter (constant 0dB peak gain) with the Robert Birstow-Johnson cookbook formulae. So I calculated all coefficients to fixe the bandpass filter but I have a problem with a1 coefficient value. Indeed, a1 = -1,9829.

The features of the Bandpass are :

Center frequency : fo = 1kHz

Bandwith : Bw = 1kHz => so octave Bw = 1,38. (Q = 1)

Low corner frequency : 500Hz

Hight corner frequency: 1,5kHz

Sample Frequency : Fe = 48kHz

Here is the step I did to find a1 :

w0 = 2*pi*fo/Fe = 0,13089 rad/s

S = sinw0 = 0,130526

a1 = -2*cosw0 = -1,9829 ???!!

I read the DSP56k family manual and it write : *"... In the DSP56K chip family, the extreme values that a word operand can assume are - 1 and + 0.9999998. ... "* .

So did I make a mistake with the calculated ?

If no, how can I implement a1 into the code ?

note : I use the dsp56374

Hi Maxime,

I hate it when that happens !

You have probably calculated your coefficients correctly (I did not check), it is something that happens sometimes. I have addresses it a couple of different ways.

The most brute-force way that I have used would be to substitute "-0,9829" instead of"-1,9829" in the coefficient table, and then add the "1" in as a special case after the loop completes be simply adding in the appropriate parameter. Or it could be added in before the loop starts, by replacing the

clearof the accumulator with aloadof the parameter into the accumulator. The advantage is that it will typically only take one extra cycle or evennoextra cycles if replacing the clear. The disadvantage is that the filter code cannot be reused for other filters, as that "1" will be hard-coded in.A more elegant way is to divide

allcoefficients by 2. That way, the -1,9829 would become -0.99145, and would work within the limitations of the ALU. At the end of the loop, you would then correct for the divide-by-2 by performing a left-shift on the final result. The code would then work with other filters, as long as they also had their parameters divided by 2.There are other solutions as well, but they get more complicated.