Here is an ugly little audioUnit tool that I made to simplify my life in calculating filter coefficients to feed into OSX’s vdsp_biquad. I’m posting it here because I have not seen anything similar, and I figured someone would find it to be helpful.
It’s purpose is to be able to listen to the effects of a filter while twiddling the parameters in real-time, and then printing out the coefficients in the format that vdsp_biquad uses for the purpose of copy/pasting into a fixed filter in an audiounit (i.e 5 normalized coefficients). It is more about listening and getting the coefficients based on what you are HEARING, as opposed to getting the coefficients based on the input values, so I have not tweaked the controls to match other plugins or hardware… they are more for reference than rule. If you want more precision or different forms/formats, there are plenty of other coefficient calculators out there.
A few notes on functionality:
The five modes are the most typical: resonant high pass, resonant low shelf, peaking, resonant high shelf, and resonant low pass.
The code is not optimized, is written very plainly, and no stripping was done on the final build (which is the debug version): this is all so that if desired, the process can be attached to one of XCode’s instruments and examined. As a result, it is not efficient, but it is more useful.
The coefficients are calculated via a modified version of Nigel Redmon’s code at: http://www.earlevel.com/main/2012/11/26/biquad-c-source-code/ . There are many many ways to calculate these… this is just the version that I use most often.
The “Q” control double as a resonance control for the relevant modes. When Q is functioning as a bandwidth control, the parameter uses the reversed-style (as opposed to Q representing a percentage of octaves), which means that 0.707 is the center point and lower settings equal a wider bandwidth while higher settings equal a narrower bandwidth.
The calculations are done as doubles for stability, but for my purposes are sent as an AudioUnitParameterValue, which is a Float32 typedef.
Since vdsp_biquad was introduced in 10.9, the plugin will not run on earlier OS versions. I DID include the carbon resource file and 32 bit code in the build so that it will function on older hosts though.
Here is the component: