Since it seems @TheVinn is no longer active, I thought I’d try my luck and posting here since presumably many here have a lot of experience with DSPFilters.
I’m having some issues with implementing high pass and low pass filters into my most recent plugin.
The firs tissue is that it appears the High Pass Filters from Dsp::SimpleFilter appear to not work consistently across different sample rates. I have checked and double checked that every time the DAW’s samplerate changes, I call .setup() on the filter with the new sampleRate as a parameter. It still seems to be the case that the slope on the high pass filter becomes considerably less steep when you transition from say 48000 to 96000, letting probably far too much sound below the cutoff through on the higher sample rates (either that, or the cutoff frequency is being inexplicably lowered).
My second issue concerns changing the cutoff frequency for any of the main filter types (using butterworth currently) in real time. At the moment I’ve been having to call .setup() every process block while the cutoff frequency is changing to change the filter’s cutoff, but this introduces noise (not zipper noise exactly, but some kind of other distortion). Even if I interpolate the changes to the cutoff frequency variable (e.g. by using the LinearSmootherValue class) it still introduces noise, is there a better way to smoothly change the cutoff frequency?
My last issue is regarding latency. I think these filter can introduce a few samples of delay, is it possible to get an exact measure of how many samples the filter is delaying the audio by, so I can use setLatencySamples() with it to notify the host?
Any help on these issues would be greatly appreciated.
After peaking at the classes on github it looks like the author didn’t pre-warp the cutoff frequency in the coefficient calculations. wd = tan (pi * fc/fs) where wd is the pre-warped digital cutoff frequency that maps to the desired fc, analog cutoff frequency for a desired fs. Tangent calls are expensive, you can check out the musicdsp archive for some decent approximations.
With your second problem, try interpolating the filter coefficients and not the filter parameters.
For the third problem, as IIR filters are inherently non-linear phase, the group delay is not constant. So the “latency” of your plugin is going to vary with frequency. If you want an average measure of a given filter, you’ll need to calculate the group delay and find its average. Here’s a good walkthrough.
If you are worried about maintenance, use another library that is still maintained, like Audio ToolKit.
Also, on top of the prewarp (which which should probably be called unwrap), you have to remember that for a low pass, at Nyquist, you have infinite reduction, so the slope has to be stronger for 48kHz than for 96kHz for the same cut frequency.
It works fine from the start (I published my last plugins with it), it’s just that adding the libraries is cumbersome, as I didn’t create a dedicated JUCE module yet. I need to check how to do it and then make a tutorial to set up the folder hierarchy for them.