I would like to create a kind of frequency variable linear phase (low-pass or high-pass) filter and I am trying to find some best-approach to do this.
In general, I find the frequency-dependent coefficients of my IIR (first or second order) filter and then I apply some kind of all-pass filter to compensate for the linearity of the phase.
Might I ask if this is a correct approach? How can I find the coefficients of the all-pass filter?
IIUC, this solution does not introduce latency, but could highly affect the computational load.
In this case, I can find the N coefficients of my FIR filter with some pre-processing calculation (I could use some built-in MATLAB function to find the coefficients by specifying the cutoff, the sampling frequency, roll-off attenuation, etc… ). Since FIR coefficients are usually symmetric, the filter is usually linear-phase by design, even if it introduces some delay which depends on its length.
But how could I find a relation between the coefficients and the cutoff frequency in order to make it frequency variable in real-time?
I hope I was clear and please correct me if I wrote something wrong.
Thank you very much for your help