Hi, I'm wondering, if there is no problem in equalization with DFT. Simply window the source signal, DFT, mutliply each frequency bin by a real value defining it, and IDFT. This would even be zero-phase filtering wouldn't it? Or am I missing something? Thanks! dmnc

# Equalization using DFT

Started by ●November 12, 2008

Reply by ●November 12, 20082008-11-12

On Nov 12, 11:26�am, "jungledmnc" <jungled...@gmail.com> wrote:> Hi, > > I'm wondering, if there is no problem in equalization with DFT. Simply > window �the source signal, DFT, mutliply each frequency bin by a real value > defining it, and IDFT. This would even be zero-phase filtering wouldn't it? > Or am I missing something?what you're missing is the need to do overlap-adding or overlap-saving with this. and your "windowing" is really rectangular (i.e. no windowing at all). also, then the frequency response (what you use to multiply each DFT frequency bin) must be such that the impulse response corresponding to it is short enough, depending on the size of the FFT and the "frame hop" distance between adjacent frames. r b-j

Reply by ●November 12, 20082008-11-12

>Hi, > >I'm wondering, if there is no problem in equalization with DFT. Simply >window the source signal, DFT, mutliply each frequency bin by a realvalue>defining it, and IDFT. This would even be zero-phase filtering wouldn'tit?>Or am I missing something? > >Thanks! >dmnc >Basically correct, but there are a ton of details. Here's a link. Regards, Steve http://www.dspguide.com/ch18.htm

Reply by ●November 12, 20082008-11-12

On Nov 12, 8:26 am, "jungledmnc" <jungled...@gmail.com> wrote:> Hi, > > I'm wondering, if there is no problem in equalization with DFT. Simply > window the source signal, DFT, mutliply each frequency bin by a real value > defining it, and IDFT. This would even be zero-phase filtering wouldn't it? > Or am I missing something? > > Thanks! > dmncThere is a lot of relevant practical application literature in the computer music analysis/synthesis field and the audio compression field. In the audio compression literature, substitute your equalization process for the coding and decoding portions. Dale B. Dalrymple http://dbdimages.com

Reply by ●November 13, 20082008-11-13

Thanks guys. I forgot to mention the windowing and overlap-adding... but I mean when you perform FFT correctly with all it needs and the only modification is multiplying each frequency bin with desired frequency response, then there is no problem? If so, then why not to use it, since it is zero or linear phase (which one btw?). And what's the advantage of using standard filters instead (e.g. classical biquads) (speed of course, but that's all I can see)? What if I for example cascade a few biquad filters, get its frequency response for particular frequency bins, and use this FFT method instead? Wouldn't it be cool way to make it zero/linear phase filter? I can also use bidirectional filtering, but the requirements seem almost the same.>also, then the frequency response (what you use to >multiply each DFT frequency bin) must be such that the impulse >response corresponding to it is short enough, depending on the size of >the FFT and the "frame hop" distance between adjacent frames.What you mean by this exactly? I think this cannot happen when I use frequency response as described above, can it? Thanks again! dmnc

Reply by ●November 13, 20082008-11-13

> >Thanks guys. I forgot to mention the windowing and overlap-adding... butI>mean when you perform FFT correctly with all it needs and the only >modification is multiplying each frequency bin with desired frequency >response, then there is no problem? >If so, then why not to use it, since it is zero or linear phase (whichone>btw?). And what's the advantage of using standard filters instead (e.g. >classical biquads) (speed of course, but that's all I can see)? >What if I for example cascade a few biquad filters, get its frequency >response for particular frequency bins, and use this FFT method instead? >Wouldn't it be cool way to make it zero/linear phase filter? I can alsouse>bidirectional filtering, but the requirements seem almost the same. >FFT convolution (the technique you are describing) produces exactly the same filtering results as an FIR filter carried out by standard convolution. The advantage of FFT convolution is that it is very fast if the kernel is long, say, greater than 50 points. On the down side, the code to get FFT convolution going is quite involved. In comparision, convolution is only a few lines of code. So your first question reduces to: "What are the advantages and disadvantages of FIR (i.e., convolution) vs IIR (i.e., biquad or recursive) filters?" Here's a link. http://www.dspguide.com/ch21.htm A zero phase filter becomes a linear phase filter when the output is shifted relative to the input. For real time processing there is always a delay, so the filter will be linear phase. However, if the data are just stored in arrays in a computer, it simply depends of how you stuff the ouput data into the array, relative to the input array. Regards, Steve

Reply by ●November 13, 20082008-11-13

jungledmnc wrote:> Thanks guys. I forgot to mention the windowing and overlap-adding... but I > mean when you perform FFT correctly with all it needs and the only > modification is multiplying each frequency bin with desired frequency > response, then there is no problem? > If so, then why not to use it, since it is zero or linear phase (which one > btw?). And what's the advantage of using standard filters instead (e.g. > classical biquads) (speed of course, but that's all I can see)? > What if I for example cascade a few biquad filters, get its frequency > response for particular frequency bins, and use this FFT method instead? > Wouldn't it be cool way to make it zero/linear phase filter? I can also use > bidirectional filtering, but the requirements seem almost the same.Phase is part of a filter's effect. It is not generally possible to combine one filter's amplitude response with another's phase response.>> also, then the frequency response (what you use to >> multiply each DFT frequency bin) must be such that the impulse >> response corresponding to it is short enough, depending on the size of >> the FFT and the "frame hop" distance between adjacent frames. > > What you mean by this exactly? I think this cannot happen when I use > frequency response as described above, can it?You need to get a few things straight: Every filter has an impulse response. The overlap-add method using Fourier transforms performs exactly the same convolution as the traditional transversal method of doing FIRs. The coefficients (tap weights, if you prefer) of a transversal FIR _are_ its impulse response. The impulse response of an overlap-add filter is the IFFT of the frequency-response shaping mask. Arbitrary masks can produce very long impulse responses, and the FFT has to be long enough to accommodate it. A tapered window is a sometimes useful adjunct to an FFT for frequency analysis. It is never needed and actually harmful when used in OL-A filtering. You can't make a brick-wall filter simply by zeroing out the bins you don't want. The implied impulse response is far too long. Besides, you don't really control the response _between_ the bin centers, and they will bite you if the transitions are too abrupt. Moreover, the time response will ring like a fire bell. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������

Reply by ●November 13, 20082008-11-13

>jungledmnc wrote: >> Thanks guys. I forgot to mention the windowing and overlap-adding...but I>> mean when you perform FFT correctly with all it needs and the only >> modification is multiplying each frequency bin with desired frequency >> response, then there is no problem? >> If so, then why not to use it, since it is zero or linear phase (whichone>> btw?). And what's the advantage of using standard filters instead(e.g.>> classical biquads) (speed of course, but that's all I can see)? >> What if I for example cascade a few biquad filters, get its frequency >> response for particular frequency bins, and use this FFT methodinstead?>> Wouldn't it be cool way to make it zero/linear phase filter? I can alsouse>> bidirectional filtering, but the requirements seem almost the same. > >Phase is part of a filter's effect. It is not generally possible to >combine one filter's amplitude response with another's phase response. > >>> also, then the frequency response (what you use to >>> multiply each DFT frequency bin) must be such that the impulse >>> response corresponding to it is short enough, depending on the sizeof>>> the FFT and the "frame hop" distance between adjacent frames. >> >> What you mean by this exactly? I think this cannot happen when I use >> frequency response as described above, can it? > >You need to get a few things straight: > > Every filter has an impulse response. > > The overlap-add method using Fourier transforms performs exactly the > same convolution as the traditional transversal method of doingFIRs.> > The coefficients (tap weights, if you prefer) of a transversal FIR > _are_ its impulse response. The impulse response of an overlap-add > filter is the IFFT of the frequency-response shaping mask. Arbitrary > masks can produce very long impulse responses, and the FFT has to be > long enough to accommodate it. > > A tapered window is a sometimes useful adjunct to an FFT for > frequency analysis. It is never needed and actually harmful whenused> in OL-A filtering. > >You can't make a brick-wall filter simply by zeroing out the bins you >don't want. The implied impulse response is far too long. Besides, you >don't really control the response _between_ the bin centers, and they >will bite you if the transitions are too abrupt. Moreover, the time >response will ring like a fire bell. > >Jerry >-- >Engineering is the art of making what you want from things you can get. >����������������������������������������������������������������������� >Isn't using a not rectangular window the same as using the window method of FIR design? Along those lines, having a brick wall filter would result in a windowed sinc type filter correct?

Reply by ●November 13, 20082008-11-13

SteveSmith wrote: ...> FFT convolution (the technique you are describing) produces exactly the > same filtering results as an FIR filter carried out by standard > convolution. The advantage of FFT convolution is that it is very fast if > the kernel is long, say, greater than 50 points. On the down side, the > code to get FFT convolution going is quite involved. In comparision, > convolution is only a few lines of code.dmnc's puzzlement stems from the equivalent FIR not being the one he imagines it to be. I'd like to think up an imaginative way to illustrate the difference. ... Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������

Reply by ●November 13, 20082008-11-13

jungledmnc wrote:> Thanks guys. I forgot to mention the windowing and overlap-adding... but I > mean when you perform FFT correctly with all it needs and the only > modification is multiplying each frequency bin with desired frequency > response, then there is no problem? > If so, then why not to use it, since it is zero or linear phase (which one > btw?). And what's the advantage of using standard filters instead (e.g. > classical biquads) (speed of course, but that's all I can see)? > What if I for example cascade a few biquad filters, get its frequency > response for particular frequency bins, and use this FFT method instead? > Wouldn't it be cool way to make it zero/linear phase filter? I can also use > bidirectional filtering, but the requirements seem almost the same. >Linear-phase EQ is widely used for audio mastering (see e.g. Waves, Algorithmix, even the L-PP EQ in Apple's Logic Pro etc). Possibly all of them use FFTs, but I suspect Algorithmix at least is doing some thing very esoteric as their EQ, while praised to the skies (used at astronomical sample rates for such things as SACD mastering), is vveerryy slow, and uses huge impulse responses of over a second. Basically, FFT-based EQ and convolution reverb use exactly the same algorithm, except for the length of the impulse responses. Reverb responses can be extremely long, and "partitioned convolution" of one form or another is used to get the latency low enough for real-time use. The "trick" is simply to ensure the FFT is used to perform ~linear~ convolution of the source and the IR, which means a combination of zero-padding and plain 50% frame overlap (where the frame length is typically twice the raw length of the IR, usually rounded up to a power-of-two size for FFT purposes). The other tricks are in designing the IR, which may be done in all manner of ways, from drawing of arbitrary shapes (with all the usual caveats) to use of standard FIR filter design tools such as Remez etc. The dspguide links posted earlier in this thread illustrate all that in detail. The Voxengo Spline EQ is an example of a L-P EQ using almost-arbitrary drawing, showing how closely the generated response matches the requested one: http://www.voxengo.com/product/curveeq/ The reason audio people actually use IIR filters in audio most of the time is only partly because they are computationally cheap compared to FIRs (and easy to vary dynamically). Some analogue-modelled EQs are anything but cheap; but they endow the sound with that mythical "character" (no doubt thanks to the non-linear phase, and the odd sprinkle of dsp snake-oil) that recording and mixing engineers will get paid lots of money to impart to a track. Bob Katz's mastering book is well worth a read on this topic (as on many others). Richard Dobson