steph_tsf ·
Hello,
This is about Audio IIRs (Biquads) written in SynthMaker CodeModule.
It is about calculating the coefficients "by hand" using Excel, providing :
- Fs (sampling frequency) - F0 (filter frequency) - Q (call it resonance if you want)
I don't want to waste your time. There are already excellent CodeModules from Shifrin, calculating the coefficients from Fs, F0 and Q without needing Excel. If you are looking for this, go straight to : RBJ Filters ported UPDATED... Three pages. Read carefully. You will be able to download RBJ-Filters.osm One million thanks to Shifrin !
But there are special cases, special requirements, and relaxed requirements also.
Like calculating more outputs from one input like in universal complementary filters. What I have done is to put the resonating cell at the beginning, so one reuses their values (z0,z1,z2) when calculating the various summation outputs (named "combiners" in Excel spreadsheet).
Like not needing fast updates of the IIR coefficients. Watch out zipping however : strong noise when you make big changes on IIR coefficients. This is the reason why Shifrin is always re-calculating the IIR coefficients inside the IIR CodeModule : usually you would put an external de-zipper that smooths the IIR coefficients variations even if from the application you make a fast big change. The external de-zipper smooths and damps the IIR coefficients variations over hundreds of milliseconds in order to keep the artifact below the noise floor. So, here, in this special case, with the IIR coefficients being not calculated inside the DSP loop, one may save lots of CPU cycles.
Like centralizing the calculation of the IIR coefficients. As an example, if you need variations on the IIR coefficients, you may centralize the de-zipper using a dedicated DSP CodeModule. So, if you see what I mean, you'll realize that if you are in stereo, with both channels driven the same, again, you will save CPU cycles. I agree the Schematic will be conveying many parallel lines (all the coefficients) but one should see this as a control bus. Do we have busses in SynthMaker ?
Please note also this is a "true" universal scheme, when d0 can be different than one. Using RBJ GeenMath on Excel, this d0 coefficient is of course always equal to 1.
If you want to save more CPU cycles, go into the CodeModule, delete the calculations of the outputs you don't need (as you can see there are four outputs here), and if you are always using RBJ GreenMaths, ignore the d0 coefficient at the input (delete that input) and make the corresponding simplification in the resonating cell calculation. After having done that you'll be proud : no mysteries anymore about Audio Biquads and no mysteries anymore about 2nd-order IIRs in general !
Here are the links : http://shup.com/Shup/30155/RBJ-Filters- ... okbook.osm http://shup.com/Shup/30156/RBJ-Filters- ... okbook.mht http://shup.com/Shup/30157/RBJ-Filters- ... -Excel.xls
Surely you will ask about the infamous de-normalization issue and associated trick. More info about here : DSP, MMX registers and floating point de-normalization
Now if we open the Excel spreadsheet, if we look to the BPF combiner (Band Pass Filter), we can see that the mid coefficient (n1) is always equal to zero. Does it mean that we are now systematically generating the infamous de-normalization exception within that DSP code ? Should we rewrite (simplify) the BPF combiner, avoiding referring to the variable (n1) that we have set to zero ?
Enjoy !
Steph