DSPRelated.com
Forums

Techniques behind arbitrary response or "drawable" equalizers?

Started by Unknown June 14, 2016
I need to design a filter that has arbitrary response. Basically, I want to be able to almost "draw" the equalizer curve.

What are the techniques behind (FFT-based) arbitrary response or "drawable" equalizers such as:

http://wiki.cockos.com/wiki/index.php/ReaFIR

or

http://www.elevayta.net/product4.htm
On Mon, 13 Jun 2016 21:32:12 -0700 (PDT), viljamaadsp@gmail.com wrote:

>I need to design a filter that has arbitrary response. Basically, I want to be able to almost "draw" the equalizer curve. > >What are the techniques behind (FFT-based) arbitrary response or "drawable" equalizers such as: > >http://wiki.cockos.com/wiki/index.php/ReaFIR > >or > >http://www.elevayta.net/product4.htm
Parks-McLellan/Remez Exchange, as well as other algorithms, allow the filter definition to be defined on a grid, and portions of the grid can be weighted or marked as "don't care" regions. Defining the response and the grid points can easily be done graphically, i.e., "drawn". That being said, there's no guarantee that the algorithms will converge to a solution for any arbitrary filter shape. Similarly, with FFT-based design methods a common problem is that the sampling in the frequency domain does not define the response in the regions between the samples, and undesirable effects can easily happen in the results. Constraining what can be "drawn" could go a long way toward increasing confidence in the results.
tiistai 14. kes=C3=A4kuuta 2016 8.24.40 UTC+3 Eric Jacobsen kirjoitti:
> On Mon, 13 Jun 2016 21:32:12 -0700 (PDT), viljamaadsp@gmail.com wrote: >=20 > >I need to design a filter that has arbitrary response. Basically, I want=
to be able to almost "draw" the equalizer curve.
> > > >What are the techniques behind (FFT-based) arbitrary response or "drawab=
le" equalizers such as:
> > > >http://wiki.cockos.com/wiki/index.php/ReaFIR > > > >or > > > >http://www.elevayta.net/product4.htm >=20 > Parks-McLellan/Remez Exchange, as well as other algorithms, allow the > filter definition to be defined on a grid, and portions of the grid > can be weighted or marked as "don't care" regions. Defining the > response and the grid points can easily be done graphically, i.e., > "drawn". >=20 > That being said, there's no guarantee that the algorithms will > converge to a solution for any arbitrary filter shape. Similarly, > with FFT-based design methods a common problem is that the sampling in > the frequency domain does not define the response in the regions > between the samples, and undesirable effects can easily happen in the > results. >=20 > Constraining what can be "drawn" could go a long way toward increasing > confidence in the results.
I found Parks-Mccellan with LPF, HPF, BPF and Notch implementations, http://www.iowahills.com/Example%20Code/NewParksMcClellan.txt however, my requirements would require also a "downward peak"/cut type, spe= cifically multiple such cuts in a group. Any idea whether this is something the Parks-Mccellan is suited for?
On 14.06.16 06.32, viljamaadsp@gmail.com wrote:
> I need to design a filter that has arbitrary response. Basically, I want to be able to almost "draw" the equalizer curve.
Well, if your FIR convolution filter is implemented by FFT convolution (with overlap add) the solution is quite straight forward. Just multiply each value in the frequency domain by the desired gain and maybe adjust the phase and you are done. Strictly speaking there is no need to know the FIR filter kernel at all. But the overlap add method requires the filter kernel to drop to zero at some point. So an appropriate window should be applied in the time domain. Furthermore you should be careful with jumps in the frequency response. They get very wide in the time domain and usually cause artifacts like pre echos. So you should keep your design function smooth. This is similar to a window function in the time domain. So having a smooth response might be sufficient. There is no need for an additional Hamming window or so. A rectangular window (to keep overlap add happy) usually gives the best results if dGain/dOmega and the group delay (dPhi/dOmega) are limited. The more interesting question is: where does your design function come from? And what are the requirements of this function to selectivity. The limiting factor for FIR filters is usually the latency. The typical latency of an overlap/add FIR filter is roughly in the order of the FFT length. While even general purpose CPUs can easily deal with 65k FFT, the resulting latency might be undesired. I implemented similar things several years ago for an 32 band audio equalizer plug-in with group delay equalization. http://maazl.de/project/pm123/manual/realeq/index.html The source code is still available as part of the PM123 package http://maazl.de/project/pm123/pm123-1.41b3-src.zip Well adjusted the result sounds rather impressive, quite close to digital room correction. Marcel
On Tuesday, June 14, 2016 at 3:49:16 PM UTC+3, Marcel Mueller wrote:
> On 14.06.16 06.32, viljamaadsp@gmail.com wrote: > > I need to design a filter that has arbitrary response. Basically, I want to be able to almost "draw" the equalizer curve. > > Well, if your FIR convolution filter is implemented by FFT convolution > (with overlap add) the solution is quite straight forward. Just multiply > each value in the frequency domain by the desired gain and maybe adjust > the phase and you are done. Strictly speaking there is no need to know > the FIR filter kernel at all. But the overlap add method requires the > filter kernel to drop to zero at some point. So an appropriate window > should be applied in the time domain. > Furthermore you should be careful with jumps in the frequency response. > They get very wide in the time domain and usually cause artifacts like > pre echos. So you should keep your design function smooth. This is > similar to a window function in the time domain. So having a smooth > response might be sufficient. There is no need for an additional Hamming > window or so. A rectangular window (to keep overlap add happy) usually > gives the best results if dGain/dOmega and the group delay (dPhi/dOmega) > are limited. > > The more interesting question is: where does your design function come > from? And what are the requirements of this function to selectivity.
What do you mean by design function? Also, I thought that manipulating FFT bins that way poses problems: https://groups.google.com/forum/#!topic/comp.dsp/ZRehYt2SlE0 What about window size? How large must it be?
On Tuesday, June 14, 2016 at 9:31:27 AM UTC-4, Matti Viljamaa wrote:
> On Tuesday, June 14, 2016 at 3:49:16 PM UTC+3, Marcel Mueller wrote: > > On 14.06.16 06.32, viljamaadsp@gmail.com wrote: > > > I need to design a filter that has arbitrary response. Basically, I want to be able to almost "draw" the equalizer curve. > >
N Track Studio audio editor has a very nice drawable EQ function that is overlayed on a spectrum analyzer. I don't know how it is implemented. M
On 14.06.16 15.31, Matti Viljamaa wrote:
> What do you mean by design function?
The desired filter response.
> Also, I thought that manipulating FFT bins that way poses problems: > https://groups.google.com/forum/#!topic/comp.dsp/ZRehYt2SlE0
Yes, that's why I recommended at least a rectangular window. But this only is reasonable if the target response is reasonable smooth. Jumps from 0 to 1 are /not/ smooth. Of course, you can use any fancy target response and turn it into a implementable filter kernel by a window function. But the window function will /somehow/ make the response smooth. But if you do not require impossible results, there is no need for further smoothing. This gives you more control than a window function. Window functions are fine to tune just the stop band attenuation. But if you want to get close to a desired response, they might not hit the nail on the head. Like a blur filter they smooth everything. Even the parts that do not cause much harm.
> What about window size? How large must it be?
Well, the window size should always match the FIR kernel length. ;-) And within the context of overlap add processing kernel length < FFT size. In other words, each iteration creates as many samples of output as the difference of the FFT size and the kernel length. And the FFT size mainly determines the latency. It could be decreased to some degree with a Block Convolver. Choosing an appropriate kernel length for a given response is a bit more complicated. This is mainly dominated by the maximum gain and phase change rate over frequency. A phase change rate is basically a group delay and just moves the filter kernel to one of the edges. While a gain change rate reduces the damping of sinc functions with neighbor frequencies. I.e. it raises the kernel values at the edges. Both makes the values far away from the center less negligible. But it is quite easy to get the real filter response. Just do an FFT of the filter kernel including the window function. And if you want to get the response at frequencies between the bins, just add zeros to the kernel an repeat with a larger FFT. Marcel
viljamaadsp@gmail.com writes:

> I need to design a filter that has arbitrary response. Basically, I want to be able to almost "draw" the equalizer curve. > > What are the techniques behind (FFT-based) arbitrary response or "drawable" equalizers such as: > > http://wiki.cockos.com/wiki/index.php/ReaFIR > > or > > http://www.elevayta.net/product4.htm
This sounds like a good fit (no pun intended) for FDLS (Frequency Domain Least Squares). You could compute the phase from the magnitude: the input to FDLS requires both (complex). -- Randy Yates, DSP/Embedded Firmware Developer Digital Signal Labs http://www.digitalsignallabs.com
viljamaadsp@gmail.com wrote:
> I need to design a filter that has arbitrary response. Basically, I want to be able to almost "draw" the equalizer curve. > > What are the techniques behind (FFT-based) arbitrary response or "drawable" equalizers such as: > > http://wiki.cockos.com/wiki/index.php/ReaFIR > > or > > http://www.elevayta.net/product4.htm >
I could easily be wrong, but many of those plugins are just four, five, six filters in series. Each is simply an IIR with gain/cut, Q or low shelf/high shelf, possibly with order for shelving filters. I can't speak exactly to ReaFIR. This is a blog from Justin Frankel and he calls ReaFIR "FFT EQ", as if he were simply "stomping buckets" in the FFT. http://www.blorp.com/index.php?viewstart=320 It is from ten years ago. Perhaps you can contact him? If I read that right, he's the author. And perhaps a question the the REAPER forum is in order. -- Les Cargill
On Tuesday, June 14, 2016 at 4:59:24 PM UTC-5, Randy Yates wrote:

> This sounds like a good fit (no pun intended) for FDLS (Frequency Domain > Least Squares). You could compute the phase from the magnitude: the > input to FDLS requires both (complex).
VLV apparently did a lot of experimentation applying FDLS to arbitrary frequency responses, creating the phase response from the log of the magnitude response. He reported that minimum-phase was, in general, not sufficient to guarantee a good fit. I don't know what the criterion for a good fit is, or even if such a criterion exists, but in my experience FDLS works best approximating LTI frequency responses known to have originated in digital or analog rational transfer functions. I wish that Vladimir were here to elaborate. Greg Berchin