DSPRelated.com
Forums

Techniques behind arbitrary response or "drawable" equalizers?

Started by Unknown June 14, 2016
On Friday, June 17, 2016 at 5:45:21 PM UTC-7, robert bristow-johnson wrote:

(snip, I wrote)

> > As I noted, the problem sounds like the usual graphic equalizer used in stereo systems, > > but those have the bins usually octave spaced.
> i dunno, but i think the current "state-of-the-art" is a 31-band with > 3/octave. there's a list somewhere of the "standard" frequencies but i > think that 20 25 32 40 50 63 80 100 125 160 200 250 320 400 500 625 800 > 1000 1250 1600 2000 2500 3200 4000 5000 6250 8000 10000 12500 16000 > 20000 might be them.
Yes, I was thinking about the cheap ones for home use. That is, below audiophile grade, but for people who like more knobs. Personally, I was never interested. Mostly, I turn the tone controls to zero, and sometimes can hear the difference if someone changed them. (Usually all the way one way or the other.)
On Fri, 17 Jun 2016 10:47:43 -0700 (PDT), robert
bristow-johnson <rbj@audioimagination.com> wrote:

>On Thursday, June 16, 2016 at 3:37:13 PM UTC-4, Steve Pope wrote: >> Matti Viljamaa <viljamaadsp@gmail.com> wrote: >>=20 >> >On Thursday, June 16, 2016 at 8:54:42 AM UTC+3, robert bristow-johnson >>=20 >> >> On Tuesday, June 14, 2016 at 12:32:16 AM UTC-4, Matti Viljamaa wrote: >>=20 >> >>> What are the techniques behind (FFT-based) arbitrary response or >> >>> "drawable" equalizers such as: >>=20 >> >> how densely "sampled" must your frequency response be? if it can be >> >> more coarsely sampled, like 3 points per octave, then a graphic EQ mig= >ht >> >> be what you want. might have IIR filters in it. >>=20 >> > I prefer it to match the resolution of a FFT. At least of 1024 samples. >>=20 > >do you need the same resolution (in frequency "bin" width) at higher freque= >ncies as you do at lower frequencies? that is often not the case, which is= > why i ask. > >>=20 >> If you're constrained to use FFT's (why?) then you might want to use >> an overlap-add method. But, there will be artifacts, and if for >> example it is an audio application, those artifacts are not so great. >>=20 > >if the length of the frame hop added to the length of the FIR does not exce= >ed the FFT length there are no artifacts with overlap-add, unless you want = >to blame roundoff error in the FFT and iFFT as "artifacts".
If the OP has created an FIR that has the desired response, why would he need overlap-add at all? Am I missing something here? Best regards, Bob Masta DAQARTA v9.20 Data AcQuisition And Real-Time Analysis www.daqarta.com Scope, Spectrum, Spectrogram, Sound Level Meter Frequency Counter, Pitch Track, Pitch-to-MIDI FREE 8-channel Signal Generator, DaqMusiq generator Science with your sound card!
perjantai 17. kes&auml;kuuta 2016 20.47.46 UTC+3 robert bristow-johnson kirjoitti:
> On Thursday, June 16, 2016 at 3:37:13 PM UTC-4, Steve Pope wrote: > > Matti Viljamaa <viljamaadsp@gmail.com> wrote: > > > > >On Thursday, June 16, 2016 at 8:54:42 AM UTC+3, robert bristow-johnson > > > > >> On Tuesday, June 14, 2016 at 12:32:16 AM UTC-4, Matti Viljamaa wrote: > > > > >>> What are the techniques behind (FFT-based) arbitrary response or > > >>> "drawable" equalizers such as: > > > > >> how densely "sampled" must your frequency response be? if it can be > > >> more coarsely sampled, like 3 points per octave, then a graphic EQ might > > >> be what you want. might have IIR filters in it. > > > > > I prefer it to match the resolution of a FFT. At least of 1024 samples. > > > > do you need the same resolution (in frequency "bin" width) at higher frequencies as you do at lower frequencies? that is often not the case, which is why i ask. > > > > > If you're constrained to use FFT's (why?) then you might want to use > > an overlap-add method. But, there will be artifacts, and if for > > example it is an audio application, those artifacts are not so great. > > > > if the length of the frame hop added to the length of the FIR does not exceed the FFT length there are no artifacts with overlap-add, unless you want to blame roundoff error in the FFT and iFFT as "artifacts". > > but the OP has to "draw" his arbitrary frequency response. reflect that drawing for negative frequencies. send that to an iFFT that is much longer than the specified FIR length (the negative frequencies becomes the upper half of the data going in), and window the result to the specified length of the FIR (using a good window like the Kaiser), that will change the frequency response from his original drawing but he will be able to hit the original quite well. > > r b-j
So are you suggesting and does the following create filtering? windowing -> FFT per window -> manipulate bins (how?) -> iFFT with overlap-add
Matti Viljamaa  <matti.v.viljamaa@gmail.com> wrote:

>So are you suggesting and does the following create filtering?
>windowing -> FFT per window -> manipulate bins (how?) -> iFFT with overlap-add
That's what I was suggesting, without recommending it. Steve
On 6/18/16 7:52 AM, Bob Masta wrote:
> On Fri, 17 Jun 2016 10:47:43 -0700 (PDT), robert > bristow-johnson<rbj@audioimagination.com> wrote: >> >> if the length of the frame hop added to the length of the FIR does not exce= >> ed the FFT length there are no artifacts with overlap-add, unless you want = >> to blame roundoff error in the FFT and iFFT as "artifacts". > > If the OP has created an FIR that has the desired response, > why would he need overlap-add at all? Am I missing > something here?
well, the OP can implement his/her FIR directly with the summation, or the OP can implement the FIR using overlap-add (OLA) or using overlap-save (OLS, sometimes called "overlap-scrap"). the latter two using the FFT, multiplication in the frequency domain, and iFFT. On 6/18/16 1:04 PM, Steve Pope wrote:
> Matti Viljamaa<matti.v.viljamaa@gmail.com> wrote: > >> So are you suggesting and does the following create filtering? >> >> windowing -> FFT per window -> manipulate bins (how?) -> iFFT with overlap-add > > That's what I was suggesting, without recommending it.
okay, this has been pointed out before (on some other thread), but deserves to be pointed out again. there are two different, but closely related, meanings of the term "Overlap-add" regarding processing of audio (or some other signal, doesn't have to be audio). 1. overlap-add as described in textbooks like Oppenheim and Schafer. i don't have the current edition, but in my book it's Ch 8.9 "Linear convolution using the Discrete Fourier Transform". it describes implementing a very long FIR filter using OLA or OLS and the FFT. this is a **linear** and **time-invariant** operation (LTI). 2. overlap-add in the sense of the Phase Vocoder or some other sophisticated audio modification scheme that will not be LTI. i dunno if this paper is good, but it came up on top of my Google search: http://tcts.fpms.ac.be/publications/papers/2011/dafx2011_pvsola_amtd.pdf each of these methods break the input up into segments or frames. both FFT the input frame. both modify the frequency-domain results of the FFT in some manner. and both iFFT back to the time domain. and both overlap the results of the frames and add. now the first use of OLA (1.) does not need to use overlapping windows of the input. (it may, but does not need to.) the input is normally thought of as rectangularly windowed and not overlapping. what *is* overlapping is the output of the circular convolution done. multiplying in the discrete-frequency domain (what comes outa the FFT) corresponds to *circular* convolution in the time domain, and all of this OLA or OLS business is about getting a tool that inherently does circular convolution to do linear convolution (which is what an FIR filter does). now, *any* modification of the bins in the frequency domain can be thought of as a multiplication (unless a bin with zero is turned into a bin with something nonzero). that frequency-response that you are multiplying by in the frequency domain corresponds to an impulse response in the time domain. but to keep from having artifacts, the length of that impulse response L must add to the frame hop length H to be no greater than the FFT length N (actually if they add to N+1, that's okay). if they do not satisfy that constraint, you will have circular aliasing in the time domain. so you may not adjust the bins in any manner you want, the adjustment of the bin values must be equivalent to multiplying by a frequency response that is the FFT of an impulse response that is short enough to be N-H+1 . if you don't do that, you will get glitches at each frame boundary. the second use of OLA (2.) *does* window the input, perhaps with complimentary windows (that is the fade-down half of the previous window add to the fade-up half of the current window and they add to 1). usually the operations done in the frequency domain do *not* correspond simply to multiplication. like you can do pitch shifting with a phase vocoder and that surely ain't LTI. sometimes there is windowing going into the FFT, and more windowing done on the output of the iFFT. if you do your housekeeping properly, for a "null process" your overlap-added output should be identical to the input, except maybe shifted in time. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
On Sat, 18 Jun 2016 19:14:04 -0400, robert bristow-johnson
<rbj@audioimagination.com> wrote:

>On 6/18/16 7:52 AM, Bob Masta wrote: >> On Fri, 17 Jun 2016 10:47:43 -0700 (PDT), robert >> bristow-johnson<rbj@audioimagination.com> wrote: >>> >>> if the length of the frame hop added to the length of the FIR does not exce= >>> ed the FFT length there are no artifacts with overlap-add, unless you want = >>> to blame roundoff error in the FFT and iFFT as "artifacts". >> >> If the OP has created an FIR that has the desired response, >> why would he need overlap-add at all? Am I missing >> something here? > >well, the OP can implement his/her FIR directly with the summation, or >the OP can implement the FIR using overlap-add (OLA) or using >overlap-save (OLS, sometimes called "overlap-scrap"). the latter two >using the FFT, multiplication in the frequency domain, and iFFT. > >On 6/18/16 1:04 PM, Steve Pope wrote: >> Matti Viljamaa<matti.v.viljamaa@gmail.com> wrote: >> >>> So are you suggesting and does the following create filtering? >>> >>> windowing -> FFT per window -> manipulate bins (how?) -> iFFT with overlap-add >> >> That's what I was suggesting, without recommending it. > >okay, this has been pointed out before (on some other thread), but >deserves to be pointed out again. > >there are two different, but closely related, meanings of the term >"Overlap-add" regarding processing of audio (or some other signal, >doesn't have to be audio). > >1. overlap-add as described in textbooks like Oppenheim and Schafer. i >don't have the current edition, but in my book it's Ch 8.9 "Linear >convolution using the Discrete Fourier Transform". it describes >implementing a very long FIR filter using OLA or OLS and the FFT. this >is a **linear** and **time-invariant** operation (LTI). > >2. overlap-add in the sense of the Phase Vocoder or some other >sophisticated audio modification scheme that will not be LTI. i dunno >if this paper is good, but it came up on top of my Google search: >http://tcts.fpms.ac.be/publications/papers/2011/dafx2011_pvsola_amtd.pdf > >each of these methods break the input up into segments or frames. both >FFT the input frame. both modify the frequency-domain results of the >FFT in some manner. and both iFFT back to the time domain. and both >overlap the results of the frames and add. > > >now the first use of OLA (1.) does not need to use overlapping windows >of the input. (it may, but does not need to.) the input is normally >thought of as rectangularly windowed and not overlapping. what *is* >overlapping is the output of the circular convolution done. multiplying >in the discrete-frequency domain (what comes outa the FFT) corresponds >to *circular* convolution in the time domain, and all of this OLA or OLS >business is about getting a tool that inherently does circular >convolution to do linear convolution (which is what an FIR filter does). > >now, *any* modification of the bins in the frequency domain can be >thought of as a multiplication (unless a bin with zero is turned into a >bin with something nonzero). that frequency-response that you are >multiplying by in the frequency domain corresponds to an impulse >response in the time domain. but to keep from having artifacts, the >length of that impulse response L must add to the frame hop length H to >be no greater than the FFT length N (actually if they add to N+1, that's >okay). if they do not satisfy that constraint, you will have circular >aliasing in the time domain. so you may not adjust the bins in any >manner you want, the adjustment of the bin values must be equivalent to >multiplying by a frequency response that is the FFT of an impulse >response that is short enough to be N-H+1 . if you don't do that, you >will get glitches at each frame boundary. > > > >the second use of OLA (2.) *does* window the input, perhaps with >complimentary windows (that is the fade-down half of the previous window >add to the fade-up half of the current window and they add to 1). >usually the operations done in the frequency domain do *not* correspond >simply to multiplication. like you can do pitch shifting with a phase >vocoder and that surely ain't LTI. sometimes there is windowing going >into the FFT, and more windowing done on the output of the iFFT. if you >do your housekeeping properly, for a "null process" your overlap-added >output should be identical to the input, except maybe shifted in time.
Sorry, I'm still groping here. Maybe my problem is that I am thinking of a plain vanilla FIR: Just a tapped delay line, with the (weighted) taps summed together to form the output. It's a purely time-domain device once it's up and running, with each sample in producing one sample out. No frames or windowing. The only place for FFT or IFFT would be in the design of the tap weights, which are then unchanged (for as long as you want to keep a given filter response). So I guess you are talking about some more-advanced FIR implementation that uses FFT / IFFT methods with frames and OLA(1)? Maybe to improve computational efficiency over the N multiplies per sample of my simple(-minded) FIR? Thanks, and best regards, Bob Masta DAQARTA v9.20 Data AcQuisition And Real-Time Analysis www.daqarta.com Scope, Spectrum, Spectrogram, Sound Level Meter Frequency Counter, Pitch Track, Pitch-to-MIDI FREE 8-channel Signal Generator, DaqMusiq generator Science with your sound card!
On Sunday, June 19, 2016 at 8:57:41 AM UTC-4, Bob Masta wrote:
> On Sat, 18 Jun 2016 19:14:04 -0400, robert bristow-johnson > <rbj@audioimagination.com> wrote: >
...
> > Sorry, I'm still groping here. Maybe my problem is that I > am thinking of a plain vanilla FIR: Just a tapped delay > line, with the (weighted) taps summed together to form the > output.
sometimes we call that the "Transversal FIR filter" https://ccrma.stanford.edu/~jos/filters/FIR_Digital_Filters.html it is, of course, the most straight-forward implementation.
> It's a purely time-domain device once it's up and > running, with each sample in producing one sample out. No > frames or windowing. The only place for FFT or IFFT would > be in the design of the tap weights, which are then > unchanged (for as long as you want to keep a given filter > response). >
there are three other methods of implementing an FIR filter that i know of. one is the Overlap-Add or Overlap-Save method with the FFT and framing. http://www.vocal.com/wp-content/uploads/2014/03/OverlapAdd.png another is an FIR Lattice. https://cnx.org/resources/2a806ab9a0cb4f4a9d5f1fa102c0057771ded1d9/fig8FIRFilterStruct.png and there is a less-general FIR implemented as a truncated IIR (TIIR). https://ccrma.stanford.edu/~jos/HornModeling/img70.png
> So I guess you are talking about some more-advanced FIR > implementation that uses FFT / IFFT methods with frames and > OLA(1)? Maybe to improve computational efficiency over the > N multiplies per sample of my simple(-minded) FIR?
yup. (the cost, besides squirrelier code, is the delay of two frames.)
> Thanks, and best regards,
same to you, buddy. r b-j
On Sun, 19 Jun 2016 22:30:10 -0700 (PDT), robert
bristow-johnson <rbj@audioimagination.com> wrote:

>On Sunday, June 19, 2016 at 8:57:41 AM UTC-4, Bob Masta wrote: >> On Sat, 18 Jun 2016 19:14:04 -0400, robert bristow-johnson >> <rbj@audioimagination.com> wrote: >> >... >> >> Sorry, I'm still groping here. Maybe my problem is that I >> am thinking of a plain vanilla FIR: Just a tapped delay >> line, with the (weighted) taps summed together to form the >> output. > >sometimes we call that the "Transversal FIR filter" https://ccrma.stanford.edu/~jos/filters/FIR_Digital_Filters.html > >it is, of course, the most straight-forward implementation. > > >> It's a purely time-domain device once it's up and >> running, with each sample in producing one sample out. No >> frames or windowing. The only place for FFT or IFFT would >> be in the design of the tap weights, which are then >> unchanged (for as long as you want to keep a given filter >> response). >> > >there are three other methods of implementing an FIR filter that i know of. > >one is the Overlap-Add or Overlap-Save method with the FFT and framing. http://www.vocal.com/wp-content/uploads/2014/03/OverlapAdd.png > >another is an FIR Lattice. https://cnx.org/resources/2a806ab9a0cb4f4a9d5f1fa102c0057771ded1d9/fig8FIRFilterStruct.png > >and there is a less-general FIR implemented as a truncated IIR (TIIR). https://ccrma.stanford.edu/~jos/HornModeling/img70.png > >> So I guess you are talking about some more-advanced FIR >> implementation that uses FFT / IFFT methods with frames and >> OLA(1)? Maybe to improve computational efficiency over the >> N multiplies per sample of my simple(-minded) FIR? > >yup. (the cost, besides squirrelier code, is the delay of two frames.) > >> Thanks, and best regards, > >same to you, buddy. > >r b-j
I'm embarrassed to say that all I had to do was open my copy of Rick Lyon's "Understanding Digital Signal Processing" to the marvelous Chapter 13 - "Digital Signal Processing Tricks" to find nice explanations of the OLA and OLS methods, with practical implementation advice. The OP may want to check that out. I don't think the OP has mentioned the context for which this is needed (designing a commercial DAW, personal use, etc), but after looking at all the options I think I'd stick with the simple transversal model to get started. That may be too slow for a commercial product, but implementation is *way* simpler than the more advanced designs. A working system is pretty much assured as long as he has a way to get the target filter's impulse response, to be used as the FIR tap weights. He'd need that with any approach, so there will be no waste if he later wants to use that as a front end for one of the advanced FIR methods. Best regards, Bob Masta DAQARTA v9.20 Data AcQuisition And Real-Time Analysis www.daqarta.com Scope, Spectrum, Spectrogram, Sound Level Meter Frequency Counter, Pitch Track, Pitch-to-MIDI FREE 8-channel Signal Generator, DaqMusiq generator Science with your sound card!
On Monday, June 20, 2016 at 9:05:44 AM UTC-4, Bob Masta wrote:
> > I'm embarrassed to say that all I had to do was open my copy > of Rick Lyon's "Understanding Digital Signal Processing" to > the marvelous Chapter 13 - "Digital Signal Processing > Tricks" to find nice explanations of the OLA and OLS > methods, with practical implementation advice. The OP may > want to check that out.
i like Rick's book. my 2nd edition of it has a brief 4-paragraph description on p. 515. don't wanna pick on Rick, but i think the explanation was a bit anorexic. one equation (13-67) which is nothing different than a regular FIR. a technical proof-reader should have spotted the use of two different variables "M" and "P" for precisely the same quantity: the FIR length. and no mention of OLA vs OLS. like how are they the same and how do they differ? so you must have a newer edition. r b-j
On Mon, 20 Jun 2016 19:18:29 -0700 (PDT), robert
bristow-johnson <rbj@audioimagination.com> wrote:

>On Monday, June 20, 2016 at 9:05:44 AM UTC-4, Bob Masta wrote: >>=20 >> I'm embarrassed to say that all I had to do was open my copy >> of Rick Lyon's "Understanding Digital Signal Processing" to >> the marvelous Chapter 13 - "Digital Signal Processing >> Tricks" to find nice explanations of the OLA and OLS >> methods, with practical implementation advice. The OP may >> want to check that out. =20 > >i like Rick's book. my 2nd edition of it has a brief 4-paragraph descripti= >on on p. 515. don't wanna pick on Rick, but i think the explanation was a = >bit anorexic. one equation (13-67) which is nothing different than a regul= >ar FIR. a technical proof-reader should have spotted the use of two differ= >ent variables "M" and "P" for precisely the same quantity: the FIR length. = > and no mention of OLA vs OLS. like how are they the same and how do they = >differ? > >so you must have a newer edition. > >r b-j >
Yes, mine is the 3rd edition. Section 13.10 is "Fast FIR Filtering Using The FFT", pages 688 to 694. OLA and OLS each have separate descriptions, with half-page block diagrams and a full page of detailed step-by-step instructions for each. For both methods, variable N is the FFT length, P is the filter input sequence length, Q is the impulse response length, and M is the unpadded part of N, equal to N-(Q-1) since the input block is padded with Q-1 zeroes. Best regards, Bob Masta DAQARTA v9.20 Data AcQuisition And Real-Time Analysis www.daqarta.com Scope, Spectrum, Spectrogram, Sound Level Meter Frequency Counter, Pitch Track, Pitch-to-MIDI FREE 8-channel Signal Generator, DaqMusiq generator Science with your sound card!