DSPRelated.com
Forums

How are variable filters implemented?

Started by Matti Viljamaa June 24, 2016
On Thu, 30 Jun 2016 06:31:00 -0700 (PDT), Matti Viljamaa
<viljamaadsp@gmail.com> wrote:

>On Thursday, June 30, 2016 at 4:17:14 PM UTC+3, Bob Masta wrote: >> On Wed, 29 Jun 2016 03:33:18 -0700 (PDT), Matti Viljamaa >> <viljamaadsp@gmail.com> wrote: >> >> >On Tuesday, June 28, 2016 at 11:46:59 PM UTC+3, herrman...@gmail.com wrote: >> >> On Monday, June 27, 2016 at 9:13:48 PM UTC-7, robert bristow-johnson wrote: >> >> > if you have infinite computational power, you can slew the user >> >> > parameter each and every sample and recalculate all of the coefficients >> >> > each sample. >> >> >> >> Having not actually tried it, if you have a ROM look-up table with filters of >> >> various center frequencies and Qs, does that help? >> >> >> >> Changing the center frequency is like changing the sampling rate. >> >> >> >> With the size of ROMs today, you could put a really large table of >> >> precomputed coefficients in, and just look one up when needed. >> >> >> >> Maybe 1024 center frequencies, equally distributed in log frequency >> >> space, and 1024 Qs. Choose the closest one. >> > >> >Does this kind of "quantization" of the frequencies lead to the stepping being heard when the parameters are changed? I.e. that the auditory response sounds "stepped"? Or is there a way, e.g. dense enough table, so that the response still sounds smooth? >> >> The quantization of frequencies is just the equivalent of >> lots of bands on a multi-band graphic equalizer... the >> number of bands would have no "stepping" effect on the sound >> when they are being changed. The size of the change would >> of course affect the sound, but I'm not sure how to decide >> what is an artifact and what is a desired effect. > >But when you sweep the parametric equalizer over the bands? Generally in parametric equalizers you don't hear it jumping from band to another, but rather changing the cutoff sounds like it's continuously varied.
You won't hear a jumping effect in any case... the bands are way too close together for that, and there are no gaps between them. Remember that the actual filter response will always be spread over multiple bands, so what happens when you move the "nominal" cutoff from band F to band F+1 is that many adjacent bands are all changing slightly. And as others have pointed out, there is no reason the cutoff has to fall on a band edge. This is the same issue as spectral leakage in an FFT of a pure sine wave whose frequency falls between bins. The filter cutoff (or any other features) can fall whererever you want, just as in an analog filter. That feature placement determines the impulse reponse, which becomes the FIR tap weights. If you look at the impulse response of a typical filter, you'll see it looks sorta like a decaying sine wave burst, spread over many samples. If you changed the frequency of the decaying sine wave slightly, there would be no "step" in the waveform... it would still look like a decaying sine wave, just with slightly different alignment of which sample points fell on peaks, valleys, zero crossings, etc. Just as in digitizing sound in general, the fact that we use discrete steps (in time and amplitude) doesn't mean the audible result exhibits any discrete steps. (Despite the fears of audiophiles back in the early days.) 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 Thu, 30 Jun 2016 01:02:50 -0700, Matti Viljamaa wrote:

> On Wednesday, June 29, 2016 at 7:58:56 PM UTC+3, Tim Wescott wrote: >> On Wed, 29 Jun 2016 03:33:18 -0700, Matti Viljamaa wrote: >> >> > On Tuesday, June 28, 2016 at 11:46:59 PM UTC+3, herrman...@gmail.com >> > wrote: >> >> On Monday, June 27, 2016 at 9:13:48 PM UTC-7, robert bristow-johnson >> >> wrote: >> >> > if you have infinite computational power, you can slew the user >> >> > parameter each and every sample and recalculate all of the >> >> > coefficients each sample. >> >> >> >> Having not actually tried it, if you have a ROM look-up table with >> >> filters of various center frequencies and Qs, does that help? >> >> >> >> Changing the center frequency is like changing the sampling rate. >> >> >> >> With the size of ROMs today, you could put a really large table of >> >> precomputed coefficients in, and just look one up when needed. >> >> >> >> Maybe 1024 center frequencies, equally distributed in log frequency >> >> space, and 1024 Qs. Choose the closest one. >> > >> > Does this kind of "quantization" of the frequencies lead to the >> > stepping being heard when the parameters are changed? I.e. that the >> > auditory response sounds "stepped"? Or is there a way, e.g. dense >> > enough table, so that the response still sounds smooth? >> >> Once the table is dense enough, and assuming enough processing power, >> you could do a linear interpolation between steps. >> >> -- >> >> Tim Wescott Wescott Design Services http://www.wescottdesign.com >> >> I'm looking for work -- see my website! > > So by adding yet more table values, between the table values? How then > is this different from computing the coefficients on a per sample basis?
Possibly not much -- I wasn't thinking hard when I made that comment. -- Tim Wescott Control systems, embedded software and circuit design I'm looking for work! See my website if you're interested http://www.wescottdesign.com
On Friday, July 1, 2016 at 3:25:00 PM UTC+3, Bob Masta wrote:
> On Thu, 30 Jun 2016 06:31:00 -0700 (PDT), Matti Viljamaa > <viljamaadsp@gmail.com> wrote: > > >On Thursday, June 30, 2016 at 4:17:14 PM UTC+3, Bob Masta wrote: > >> On Wed, 29 Jun 2016 03:33:18 -0700 (PDT), Matti Viljamaa > >> <viljamaadsp@gmail.com> wrote: > >> > >> >On Tuesday, June 28, 2016 at 11:46:59 PM UTC+3, herrman...@gmail.com wrote: > >> >> On Monday, June 27, 2016 at 9:13:48 PM UTC-7, robert bristow-johnson wrote: > >> >> > if you have infinite computational power, you can slew the user > >> >> > parameter each and every sample and recalculate all of the coefficients > >> >> > each sample. > >> >> > >> >> Having not actually tried it, if you have a ROM look-up table with filters of > >> >> various center frequencies and Qs, does that help? > >> >> > >> >> Changing the center frequency is like changing the sampling rate. > >> >> > >> >> With the size of ROMs today, you could put a really large table of > >> >> precomputed coefficients in, and just look one up when needed. > >> >> > >> >> Maybe 1024 center frequencies, equally distributed in log frequency > >> >> space, and 1024 Qs. Choose the closest one. > >> > > >> >Does this kind of "quantization" of the frequencies lead to the stepping being heard when the parameters are changed? I.e. that the auditory response sounds "stepped"? Or is there a way, e.g. dense enough table, so that the response still sounds smooth? > >> > >> The quantization of frequencies is just the equivalent of > >> lots of bands on a multi-band graphic equalizer... the > >> number of bands would have no "stepping" effect on the sound > >> when they are being changed. The size of the change would > >> of course affect the sound, but I'm not sure how to decide > >> what is an artifact and what is a desired effect. > > > >But when you sweep the parametric equalizer over the bands? Generally in parametric equalizers you don't hear it jumping from band to another, but rather changing the cutoff sounds like it's continuously varied. > > You won't hear a jumping effect in any case... the bands are > way too close together for that, and there are no gaps > between them. Remember that the actual filter response will > always be spread over multiple bands, so what happens when > you move the "nominal" cutoff from band F to band F+1 is > that many adjacent bands are all changing slightly. >
So judging by this, is it possible to create smooth parameter variation by making a table of e.g. 1024 values for each parameters (cutoff, Q etc.) and then changing between them when the user modifies the parameters? Is this how they do it in parametric equalizers?
On Friday, July 1, 2016 at 3:25:00 PM UTC+3, Bob Masta wrote:
> On Thu, 30 Jun 2016 06:31:00 -0700 (PDT), Matti Viljamaa > <viljamaadsp@gmail.com> wrote: > > >On Thursday, June 30, 2016 at 4:17:14 PM UTC+3, Bob Masta wrote: > >> On Wed, 29 Jun 2016 03:33:18 -0700 (PDT), Matti Viljamaa > >> <viljamaadsp@gmail.com> wrote: > >> > >> >On Tuesday, June 28, 2016 at 11:46:59 PM UTC+3, herrman...@gmail.com wrote: > >> >> On Monday, June 27, 2016 at 9:13:48 PM UTC-7, robert bristow-johnson wrote: > >> >> > if you have infinite computational power, you can slew the user > >> >> > parameter each and every sample and recalculate all of the coefficients > >> >> > each sample. > >> >> > >> >> Having not actually tried it, if you have a ROM look-up table with filters of > >> >> various center frequencies and Qs, does that help? > >> >> > >> >> Changing the center frequency is like changing the sampling rate. > >> >> > >> >> With the size of ROMs today, you could put a really large table of > >> >> precomputed coefficients in, and just look one up when needed. > >> >> > >> >> Maybe 1024 center frequencies, equally distributed in log frequency > >> >> space, and 1024 Qs. Choose the closest one. > >> > > >> >Does this kind of "quantization" of the frequencies lead to the stepping being heard when the parameters are changed? I.e. that the auditory response sounds "stepped"? Or is there a way, e.g. dense enough table, so that the response still sounds smooth? > >> > >> The quantization of frequencies is just the equivalent of > >> lots of bands on a multi-band graphic equalizer... the > >> number of bands would have no "stepping" effect on the sound > >> when they are being changed. The size of the change would > >> of course affect the sound, but I'm not sure how to decide > >> what is an artifact and what is a desired effect. > > > >But when you sweep the parametric equalizer over the bands? Generally in parametric equalizers you don't hear it jumping from band to another, but rather changing the cutoff sounds like it's continuously varied. > > You won't hear a jumping effect in any case... the bands are > way too close together for that, and there are no gaps > between them. Remember that the actual filter response will > always be spread over multiple bands, so what happens when > you move the "nominal" cutoff from band F to band F+1 is > that many adjacent bands are all changing slightly. >
So judging by this, is it possible to create smooth parameter variation by making a table of e.g. 1024 values for each parameter (cutoff, Q etc.) and then changing between them when the user modifies the parameters? Is this how they do it in parametric equalizers?
> > > > So judging by this, is it possible to create smooth parameter variation by making a table of e.g. 1024 values for each parameter (cutoff, Q etc.) and then changing between them when the user modifies the parameters? Is this how they do it in parametric equalizers?
if there are say 5 parameters, the table gets very large? no? you need a set of coef for each __combination__ of the 5 parameters. M
Matti Viljamaa  <viljamaadsp@gmail.com> wrote:

>So judging by this, is it possible to create smooth parameter variation >by making a table of e.g. 1024 values for each parameters (cutoff, Q >etc.) and then changing between them when the user modifies the >parameters? Is this how they do it in parametric equalizers?
Maybe. Were it to be a digital audio equalizer, when using a given set of parameters, one could pre-compute the coefficients for only the nearest neighbor parameter sets. Then if it is commanded to slew in a given direction, you could start computing the next nearest neighbors in that direction, and so on. Steve
<makolber@yahoo.com> wrote:

>if there are say 5 parameters, the table gets very large? no? >you need a set of coef for each __combination__ of the 5 parameters.
Yes it looks to be maybe 10 megabytes of table (1024 x 1024 x 80 bits). Steve
>How are filters that have their cutoff and e.g. Q variable (such as in a >typical parametric equalizer) done? >Does this mean that the filter coefficients are recalculated (i.e. the >filter is redesigned) every time the parameters are changed? >What kind of other design considerations are involved (such as
computational
>efficiency)? What about "smooth parameter changes", is it interpolation
(and
>how is this adapted to recalculating the filter coefficients?)?
Based on my EqualizerAPO GUI software project (mostly biquad filters but filters are written to file as well in realtime process), if you re-calculate only the filter which was changed then normally there shouldn't be issues in realtime calculation of coefficients (other but maybe a bit highger CPU usage). If you want to replace the realtime operation by stepping the calculation then remember keep the steps low enough (probably you would need different size steps for variuous parameter changes). If you think there could be issue in realtime working then try putting coefficient calculation into its own thread and calculate new coefficients after the previous calculation thread is finished (still realtime but stepped a bit). --------------------------------------- Posted through http://www.DSPRelated.com
On Friday, July 1, 2016 at 12:31:05 PM UTC-7, mako...@yahoo.com wrote:
> > > > > > > So judging by this, is it possible to create smooth parameter variation by > > making a table of e.g. 1024 values for each parameter (cutoff, Q etc.) and > > then changing between them when the user modifies the parameters? > > Is this how they do it in parametric equalizers?
> if there are say 5 parameters, the table gets very large? no? > you need a set of coef for each __combination__ of the 5 parameters.
Well, it is easy to multiply the coefficients by a constant, so you don't have to store all the different amplitudes. Which 5 parameters? Parametric equalizers that I know have center frequency, Q, and amplitude (boost/cut) for three or four bands. Traditionally, that is in terms of RC filters, which you could transfer to digital. Mathematically, the next moment is skew, which shouldn't be hard to do digitally.
(snip)

> I have not looked at a schematic for a parametric equalizer, but have only seen > one from the outside.
I now have a schematic for an analog four band parametric equalizer, and it is somewhat simpler than I was expecting. It seems to be mono, so I suppose you buy two of them. It allows for either differential or RCA plug input, so first a differential amplifier, then a high pass (16 to 500Hz) filter, another amplifier, and then where things get interesting. There is a differential amplifier with four potentiometers connected across its inputs, the four cut/boost controls. The wipers then each go to a filter circuit made from a dual op-amp, capacitors, resistors, and two potentiometers. Single gang for Q, dual for the frequency. The filter circuits then need to have a low impedance to ground outside the pass band, and higher impedance inside. That is, there is only one wire to/from each filter section. The four filter sections have frequency ranges 70 to 1500Hz, 150 to 3000Hz, 300 to 10000Hz, and 600 to 20000Hz. Width for each is 0.3 to 3 octaves, and -15dB to +15dB for each. Next, a low pass filter, 1kHz to 30kHz, and then amplifiers to generate the differential output, if used. There is also a bypass switch which is supposed to bypass the four parametric filters, but not the low and high pass filter, but from the diagram it does bypass them, too. The specific model is RPQ160.