DSPRelated.com
Forums

Techniques behind arbitrary response or "drawable" equalizers?

Started by Unknown June 14, 2016
On Thursday, June 30, 2016 at 5:24:09 AM UTC+3, robert bristow-johnson wrote:
> On Wednesday, June 29, 2016 at 6:52:06 AM UTC-4, Matti Viljamaa wrote: > > How can the FIR be designed in OLA or OLS filtering method? > > the same you design an FIR that is not OLA or OLS. > > depends on what you're trying to do. are you trying to emulate the reverberation of a real room? then the FIR is measured as an impulse response of the room. (you might use maximum-length sequences or swept sinusoids as the driving signal, and you have to simultaneously be recording the sound in the reverberant room.) > > usually the other methods we use for designing FIRs, Parks-McClellan, Least-Square error, inverse DFT and windowing the result, these are often for shorter FIRs that are implemented more directly rather than OLS or OLA. > > r b-j
But I thought FIRs can be either time domain or frequency domain implementations. If one uses FFT (such as in OLA or OLS), then it would be reasonable, if the FIR design utilized FFT as well?
On Thu, 30 Jun 2016 09:36:57 -0700 (PDT), Matti Viljamaa
<viljamaadsp@gmail.com> wrote:

>On Thursday, June 30, 2016 at 5:24:09 AM UTC+3, robert bristow-johnson wrot= >e: >> On Wednesday, June 29, 2016 at 6:52:06 AM UTC-4, Matti Viljamaa wrote: >> > How can the FIR be designed in OLA or OLS filtering method? >>=20 >> the same you design an FIR that is not OLA or OLS. >>=20 >> depends on what you're trying to do. are you trying to emulate the rever= >beration of a real room? then the FIR is measured as an impulse response o= >f the room. (you might use maximum-length sequences or swept sinusoids as = >the driving signal, and you have to simultaneously be recording the sound i= >n the reverberant room.) >>=20 >> usually the other methods we use for designing FIRs, Parks-McClellan, Lea= >st-Square error, inverse DFT and windowing the result, these are often for = >shorter FIRs that are implemented more directly rather than OLS or OLA. >>=20 >> r b-j > >But I thought FIRs can be either time domain or frequency domain implementa= >tions. If one uses FFT (such as in OLA or OLS), then it would be reasonable= >, if the FIR design utilized FFT as well?
Either way you wind up with an impulse response in the time domain, and that impulse response *is* the FIR. That impulse response also defines the frequency response of the filter. Beyond that it is just implementation, and OLA/OLS are just implementation techniques for FIRs with long impulse responses that might otherwise be computationally too intensive.
On 6/30/16 5:37 PM, Eric Jacobsen wrote:
> On Thu, 30 Jun 2016 09:36:57 -0700 (PDT), Matti Viljamaa > <viljamaadsp@gmail.com> wrote: >> >> But I thought FIRs can be either time domain or frequency domain >> implementations. If one uses FFT (such as in OLA or OLS), then it >> would be reasonable, if the FIR design utilized FFT as well? > > Either way you wind up with an impulse response in the time domain, > and that impulse response *is* the FIR. That impulse response also > defines the frequency response of the filter. Beyond that it is just > implementation, and OLA/OLS are just implementation techniques for > FIRs with long impulse responses that might otherwise be > computationally too intensive. >
and the other issue that i have repeated to people in the past is that in using the frequency domain implementation such as OLA or OLS, then the length, L, of that FIR is an issue and you need to know about it and constrain it. because you will be zero-padding the FIR from length L to length N so that you can FFT that and do circular convolution. and the hop length for each frame is H and the following inequality must be satisfied to prevent time-aliasing in the circular convolution: L + H - 1 <= N so the longer your FIR is, the fewer output samples you get out of each frame and you must advance your frame pointer by fewer samples each frame time. so design your FIR however you want, but you can't just draw in any frequency response you want, inverse FFT, get an FIR of length N (not L and no zero-padding) and expect your FIR to follow precisely what you drew in. after the inverse FFT of what you drew in, you need to window the result with a good window (like a Kaiser), that shortens your impulse response to length L. then, to check, you need to zero-pad the FIR to length N and FFT it back to see if the frequency response sufficiently follows the original one that you drew in. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
What about the windowing design method?

The one where the FIR coefficients are designed by taking iFFT of a "desired magnitude response".

Wouldn't this be fairly simple for this application, since then one could pretty much iFFT what the user has drawn into the GUI and there's your filter?
What about the windowing design method?

The one where the FIR coefficients are designed by taking iFFT of a "desired magnitude response".

Wouldn't this be fairly simple for this application, since then one could pretty much iFFT what has been drawn into the GUI and there's your filter?
On Sat, 2 Jul 2016 02:07:47 -0700 (PDT), Matti Viljamaa
<viljamaadsp@gmail.com> wrote:

>What about the windowing design method? > >The one where the FIR coefficients are designed by taking iFFT of a "desired magnitude response".
Usually the windowing method is illustrated by taking an ideal desired time-domain impulse response, like a sinx/x, and applying a windowing function to make it practical for digital application.
>Wouldn't this be fairly simple for this application, since then one could pretty much iFFT what the user has drawn into the GUI and there's your filter?
As has been mentioned a few times, this doesn't work well unless significant constraints are put on the frequency domain construction of the sampled frequency response. Sharp transitions in the frequency domain will lead to undesired effects, i.e., you can't draw an "arbitrary" filter response and expect it to be realized without a lot of caveats.
Eric Jacobsen <eric.jacobsen@ieee.org> wrote:

>On Sat, 2 Jul 2016 02:07:47 -0700 (PDT), Matti Viljamaa
>>Wouldn't this be fairly simple for this application, since then one >>could pretty much iFFT what the user has drawn into the GUI and there's >>your filter?
>As has been mentioned a few times, this doesn't work well unless >significant constraints are put on the frequency domain construction >of the sampled frequency response. Sharp transitions in the frequency >domain will lead to undesired effects, i.e., you can't draw an >"arbitrary" filter response and expect it to be realized without a lot >of caveats.
I've never tried it, but I have thought the following might work: First select a small integer value N and perform Nth order linear prediction to approximate the desired frequency response with Nth order linear prediction. From this derive an all-pole filter with this approximate response by one of the usual methods. Then, in the frequency domain, subtract this all-pole response from the desired response, leaving a residual response that is (given some assumptions) absent most such sharp-transitions in the frequency response. Use an inverse-transform [*] method to derive an FIR filter (probably order M > N) that approximates this residual response. The all-pole filter followed by (or otherwise combined with) the FIR filter is your resulting filter design. Steve [*] I'm not going to say "iFFT" because that implies more design decisions than have been analyzed.
On Saturday, July 2, 2016 at 12:43:09 PM UTC-4, Eric Jacobsen wrote:
> On Sat, 2 Jul 2016 02:07:47 -0700 (PDT), Matti Viljamaa > <viljamaadsp@gmail.com> wrote: > > >What about the windowing design method? > > > >The one where the FIR coefficients are designed by taking iFFT of a "desired magnitude response". > > Usually the windowing method is illustrated by taking an ideal desired > time-domain impulse response,
which can be just as well defined as the iDFT of the desired frequency response.
> like a sinx/x, and applying a windowing > function to make it practical for digital application. > > >Wouldn't this be fairly simple for this application, since then one could pretty much iFFT what the user has drawn into the GUI and there's your filter? >
not quite: 1. user draws desired magnitude frequency response into GUI. 2. do inverse DFT with very large DFT size. 3. assuming zero-delay (which gives us a symmetrical acausal impulse response, we'll fix that later with a delay), apply a good Kaiser window to the middle of the symmetrical impulse response, which *shortens* the impulse response significantly (and makes it a plausible FIR). 4. now you need to zero-pad the shortened, windowed FIR back to the original length and DFT that back to frequency domain for the user tocompare the resulting magnitude response with what was originally drawn. 5. user gets to decide if it's good enough, and if not, the length of the FIR (and of the Kaiser window) must be increased.
> As has been mentioned a few times, this doesn't work well unless > significant constraints are put on the frequency domain construction > of the sampled frequency response. Sharp transitions in the frequency > domain will lead to undesired effects,
well, they'll get smoothed, so the transition band won't be as good as drawn.
> i.e., you can't draw an > "arbitrary" filter response and expect it to be realized without a lot > of caveats.
not realized *exactly*. but that is a very true statement. however, you can do *pretty* good with the windowing design method. especially with a Kaiser window. r b-j
Eric Jacobsen wrote:
> On Sat, 2 Jul 2016 02:07:47 -0700 (PDT), Matti Viljamaa > <viljamaadsp@gmail.com> wrote: > >> What about the windowing design method? >> >> The one where the FIR coefficients are designed by taking iFFT of a "desired magnitude response". > > Usually the windowing method is illustrated by taking an ideal desired > time-domain impulse response, like a sinx/x, and applying a windowing > function to make it practical for digital application. > >> Wouldn't this be fairly simple for this application, since then one could pretty much iFFT what the user has drawn into the GUI and there's your filter? > > As has been mentioned a few times, this doesn't work well unless > significant constraints are put on the frequency domain construction > of the sampled frequency response. Sharp transitions in the frequency > domain will lead to undesired effects, i.e., you can't draw an > "arbitrary" filter response and expect it to be realized without a lot > of caveats. > > > >
A deeply ignernt question might be: Why is this framed in terms of FIR? Wouldn't it be "easier" to compose multiple IIR? There are lots of VST plugins which do this not by allowing an arbitrary EQ "shape" but rather by allowing a small number of "points" to be placed and "splining" those into a "shape". Each point may have a Q setting as desired At least for audio, these tend to fit the use cases of EQ better - you want a cut @ 4k, a shelf boost @ 100Hz, that sort of thing. An EQ I now use just has knobs like it was a piece of equipment. Perhaps I am answering the question I want to be asked rather than the question actually asked, but that's because the question I want asked makes more sense to me. As a general biased observation, I don't see things that do what the OP wants much in the wild. And indeed, a FIR of a composed-IIR filter would be easy enough to make, but my general observation is that convolution is uglier than direct IIR filtering for realtime processing. -- Les Cargill
On Saturday, July 2, 2016 at 3:16:08 PM UTC-4, Les Cargill wrote:
> > A deeply ignernt question might be:
no, it's not and earlier in the thread others were alluding to it.
> > Why is this framed in terms of FIR? Wouldn't it be "easier" to > compose multiple IIR? > > There are lots of VST plugins which do this not by allowing an > arbitrary EQ "shape" but rather by allowing a small number of > "points" to be placed and "splining" those into a "shape". Each > point may have a Q setting as desired
is the graphic EQ implemented as cascaded parametric EQs. Jot and Oliver have recently published or presented regarding this and earlier Abel and Berners had. and i had this idea too, but never published it. (it's a good reason to choose the Cookbook definition of Q or BW over the EE definition for peaking EQ filters.)
> > At least for audio, these tend to fit the use cases of EQ better - you > want a cut @ 4k, a shelf boost @ 100Hz, that sort of thing. An EQ I > now use just has knobs like it was a piece of equipment. > > Perhaps I am answering the question I want to be asked rather > than the question actually asked, but that's because the > question I want asked makes more sense to me.
yeah, but it seems that the OP wanted to do something with the FFT. and then that points, sorta, to "fast-convolution" and then designing the filter is like designing any other FIR filter.
> As a general biased observation, I don't see things that do > what the OP wants much in the wild.
well there *are* convolutional reverbs out there in the world. even though they are trying to implement a specific detailed impulse response, you can think of them as trying to implement a specific detailed frequency response. with a very long FIR you can get a lotta detail in the frequency response.
> And indeed, a FIR of a > composed-IIR filter would be easy enough to make, but my > general observation is that convolution is uglier than direct IIR > filtering for realtime processing.
totally agree. why bother implementing an IIR as an FIR? unless you are implementing it as a Truncated IIR (TIIR) which is really an FIR implemented with internal recursion. (a moving-sum or moving-average is the simplest example.) r b-j