To get good performance on older Teensy's, most of the audio code uses fixed-point instead of floating-point math.

In this case, biquad coefs are converted to fixed-point with sign bit, one integer bit, and 30 fraction bits. This effectively represents [-2.0, +2.0] with enough fraction bits to handle low-cutoff high-Q filters where coefs are very sensitive to quantization. DSP people usually call this Q30.

You can see how it works by following the scaling of the biquad loop:

Code:

in2 = *data;
sum = signed_multiply_accumulate_32x16b(sum, b0, in2);
sum = signed_multiply_accumulate_32x16t(sum, b1, bprev);
sum = signed_multiply_accumulate_32x16b(sum, b2, bprev);
sum = signed_multiply_accumulate_32x16t(sum, a1, aprev);
sum = signed_multiply_accumulate_32x16b(sum, a2, aprev);
out2 = signed_saturate_rshift(sum, 16, 14);
sum &= 0x3FFF;

You can consider the input samples to be Q0 (no fraction bits).

Each multiply-add does sum += (a * b) >> 16, so the scaling is (Q30 * Q0) >> 16 = Q14 and sum keeps 14 fraction bits.

The final shift discards the 14 fraction bits and saturates the output to 16 integer bits.

A problem with just throwing away the fraction bits, is output is reused by the feedback path (aprev in the code above). A low-freq high-Q filter recirculates for a long time, and the accumulated quantization noise ruins the SNR. One solution is to keep fraction bits in the feedback path, but that requires a 32x32 multiply instead of 32x16 SIMD multiply which requires fewer loads.

You get almost as good result by using first-order quantization-error feedback. The above code implements this via "fraction saving." It is important to note how a signed fixed-point shift (sum >> 14) implements "truncation towards -infinity". That is, 1.xxx truncates to 1 and -1.xxx truncates to -2 so quantization error is guaranteed to be a positive fraction. The (sum &= 0x3FFF) extracts this fraction and saves it for the next iteration. Then by replacing the first multiply with a multiply-add, it feeds back into the next sum essentially for free.

Hope this helps.