I'm working on a (very simple) EQ-matching plugin and wanted to check my
understanding/approach and I also have a question. Here's what I do:
1. Analyze spectrum 1 using 50% overlapping blocks each windowed with a
Hann window followed by an FFT and then using the absolute value to get
the magnitude response of each block. Then finally I calculate the
average of all those magnitude responses.
2. Analyze spectrum 2 using the same approach as for spectrum 1
3. Calculate the bin-wise ratio of spectrum 2 / spectrum 1
4. Calculate a linear phase filter response by using the IFFT of the
aforementioned magnitude response ratio and then doing the ifftshift dance
5. Calculate a minimum phase filter response from the magnitude response
taking the complex log followed by an IFFT, then folding the negative
time components onto the positive ones, followed by an FFT, complex
eponentiation and a final IFFT. In code:
f = IFFT(exp(FFT(fold(IFFT(log(s))))))
where s is the magnitude response ratio.
The code implementing this is found here:
The plugin using it is not done yet.
So here are my questions:
1. Are there any glaring oversights with this approach?
2. What is a sensible approach to regularize this approach. If spectrum
1 has any components near zero magnitude then the division is ill
suited. It works fine for my experiments with distorted guitars, but I
wonder whether I should e.g. just clamp the values of spectrum 1 to
something like -70 dB?
3. If the user wants to smooth the spectrum before calculating the
responses what would be sensible approaches? I thought about smoothing s
with a filter that has a varying bandwidth when expressed in FFT bins or
Hz, but constant, when expressed in e.g. octaves or decades. I'm not
sure how to do that though. Any thoughts?
To finish this email, here is one example (you can play them e.g. by
using mplayer on the console):
1. A guitar recording played through some distortion:
2. The same guitar recording played through some distortion and then a
3. The same guitar played through the recovered filter after matching 1