By default (reset state), the biquad filters are
configured as all-pass filters. In this condition, the filter coefficients (as mentioned
in Equation 3) have the following values:
- N0 = 231 (b0= 1)
- N1, N2, D1, D2 = 0 (b1, b2, a1, a2 = 0)
When using a Digital Filter Design Package, such
as MATLAB®, to generate an IIR biquad coefficients follow these steps:
- Compute the coefficients [b0, b1, b2, a0, a1, a2]
with a filter design function, such as the MATLAB butter function to design a
Butterworth filter with cutoff at 1kHz of a system running at 48kHz. Note that
MATLAB coefficients are normalized with a0 =
1.
[b, a] = butter( 2, 1000 / (48000/2) )
- Convert these coefficients to [N0, N1, N2, D1, D2] as shown in the following:
- N0 = b0
- N1 = b1 / 2
- N2 = b2
- D1 = -a1 / 2
- D2 = -a2
- Convert the coefficients to Q31 by multiplying by 231 .
- Round to nearest integer and convert to a 32-bit two's complement hexadecimal format:
- For positive integers, convert to hexadecimal format
- For negative integers, take the absolute value
of the coefficient, convert it to binary, negate it, add one, and convert to
hex. For example, to represent -135 in 32-bit two's complement hexadecimal
format:
- Absolute value of -135 is 0000 0000 0000 0000 0000 0000 1000 0111 in
binary (or 0x00000087 in hex).
- Negating the binary results in 1111 1111 1111 1111 1111 1111 0111
1000 in binary (or 0xFFFFFF78 in hex).
- Adding one to the same gives 1111 1111 1111 1111 1111 1111 0111 1001
in binary (or 0xFFFFFF79 in hex). Hence, the 32-bit, 32-bit two's
complement hexadecimal representation of -135 is 0xFFFFFF79.