1
$\begingroup$

I'm trying to figure out how to implement a continuous EQ filter. I have in the past built a parametric EQ and then built a 10 channel EQ using 10 of these parametric filters. This gave nice results.

However I'm now trying to create a continuous EQ filter. Is this possible with a parametric EQ? By selecting the Q factor, perhaps? If so how would I fit the Q factors to the curve?

Failing that is there another better way to implement continuous EQ? Could it be implemented from an FFT by extending the magnitude of each r,i bin based on the curve? Or would this produce rather nasty EQ'ing?

Any thoughts appreciated.

Edit: To answer the comment and add a bit more.

I've been experimenting with trying to define an FFT filter. Basically I define an arbitrary curve. The curve defines dB increase or decrease.

I'm currently building my own FFT by looking up the y intercept on the curve for each frequency bin. (Well i'm converting from dB to a multiplicative factor).

Then, later, I'm FFT'ing a block of audio and then I'm multiplying it by the values in the "filter" FFT. When the multiplicative factor is purely 1 then I get the audio passing through fine. As I increase the multiplicative factor for a given bin I get a nasty crackling (though I do hear the correct frequency boosted).

Surely there must be a way of doing this in the fourier domain.

Btw, please don't give me matlab functions unless you can explain how they work because I'm trying to implement this on a mobile device so I can't use matlab.

$\endgroup$
  • 3
    $\begingroup$ What do you mean by "continuous EQ"? $\endgroup$ – endolith Jul 5 '13 at 1:35
  • $\begingroup$ @endolith: Edited my question with more info on one of my experiments $\endgroup$ – Goz Jul 6 '13 at 9:04
  • $\begingroup$ ah now it makes sense. $\endgroup$ – endolith Jul 7 '13 at 13:46
3
$\begingroup$

This is a very complicated topic. A good overview on how to do this in MATLAB is here: https://ccrma.stanford.edu/~jos/vguitar/Fitting_Filters_Matlab.html

An FIR fit can typically done by interpolating up to a full FFT grid and adding either a minimum or a zero phase and then doing an inverse FFT to get the impulse response. You can then try different filter lengths to determine which lengths is required to create an acceptable fit.

IIR fitting is much more tricky. The above example uses MATLAB's invfreqz() which in some cases gives good results and in other only works very poorly. In general the methods are iterative, i.e. there are many design cycles and there are small modifications between design steps that are supposed to "improve" things. These often use "gradient" methods, i.e. you need to evaluate the derivatives of the error function with respect to zeros and poles (or whatever other representation you may choose). They also involve least square error methods. A lot of care has to be taken to correctly formulate the error criteria in terms of frequency spacing, weight functions, relative vs. absolute error etc. The formulation of the error function is a direct representation of what the specific application can tolerate (or not).

EDIT based on OPs question edit: If you want to do frequency domain filtering, (i.e. FFT->mpy with Filter->inverse FFT) then you need to get all the framing, zero-padding and overlap handling correct. This due to the difference of circular vs. linear convolution and that the FFT "as is" assumes by definition periodic signals. Google "overlap-add" for more info.

You still need to decide on the phase for your filter. Leaving the phase zero creates a non-causal filter that will create lots of wrap-around problem. At the very minimum you need to shift the impulse response so it's causal.

$\endgroup$
  • $\begingroup$ Edited my question $\endgroup$ – Goz Jul 6 '13 at 9:03
  • $\begingroup$ The overlap-add method is definitely interesting. I tried a naive implementation and i have a totally uncrackly filter now ... alas I've got a weird echo getting added in :( $\endgroup$ – Goz Jul 7 '13 at 22:58
  • $\begingroup$ Ok the overlap-add method was, eventually, my saviour (I needed to perform some fft filter reordering too) so I'm marking this as the answer :) $\endgroup$ – Goz Jul 8 '13 at 19:04
1
$\begingroup$
  1. Remember that FFT always adds delay of the window size, while parametric EQ only adds delay of the number of poles. FFT filtering is like an N-sized graphic EQ, but with poor resolution at low frequencies and excessive resolution at high frequencies. (FFT is linear spacing while real graphic EQ is log spacing.) Are you sure you really need that? Parametric or graphic EQ is usually better.
  2. Your problem is most likely due to breaking the signal into blocks and doing FFT filter on each one, which causes the ends of each block to not line up with each other. Diagnosing problems like this requires plotting the waveform and looking at it. You'll see glitches at every frame boundary. To fix it, you need to learn about windowing functions, overlapping neighboring windows, etc
$\endgroup$
  • $\begingroup$ How do i fine a totally arbitrary log spaced time domain filter? $\endgroup$ – Goz Jul 7 '13 at 22:55
  • $\begingroup$ I think this is a different questions. If yo are really interested post it as a separate one with some more details on what exactly you are trying to do (e.g. graphic EQ with octaves, etc.) $\endgroup$ – Hilmar Jul 8 '13 at 7:31
  • $\begingroup$ @Goz: In the same sense as an FFT filter? Probably one of these: dsp.stackexchange.com/q/6266/29 But a traditional IIR parametric or graphic EQ as you've already done is probably better. $\endgroup$ – endolith Jul 8 '13 at 16:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.