Forums

How are variable filters implemented?

Started by Matti Viljamaa June 24, 2016
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?)?
On 6/24/16 8:44 AM, Matti Viljamaa wrote:
> 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?)?
it all depends on how often or how fast the user parameters are changed. often the coefficients are calculated (like a1, a2, b0, b1, b2) from the parameters whenever a parameter (like Q or omega_0) is changed. but they could, instead, be calculated periodically. like every 512 samples or every 64 samples. often the coefficients are slewed from their previous value to their new value every sample instance. either linear slewing or decaying exponential slewing (like 1st-order LPF filtering). if you have infinite computational power, you can slew the user parameter each and every sample and recalculate all of the coefficients each sample. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
On Monday, June 27, 2016 at 9:13:48 PM UTC-7, robert bristow-johnson wrote:
> On 6/24/16 8:44 AM, Matti Viljamaa wrote: > > 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?)?
> it all depends on how often or how fast the user parameters are changed.
Well, they probably shouldn't change faster than the filter frequency. For band pass filters, I believe it is usual center frequency, and not cut-off, and maybe in log frequency space.
> often the coefficients are calculated (like a1, a2, b0, b1, b2) from the > parameters whenever a parameter (like Q or omega_0) is changed. but > they could, instead, be calculated periodically. like every 512 samples > or every 64 samples.
If you have a box with slide pots, or a graphical display with up/down keys, it only needs to be as fast as the human I/O system, which might be slow.
> often the coefficients are slewed from their previous value to their new > value every sample instance. either linear slewing or decaying > exponential slewing (like 1st-order LPF filtering).
Along with the values in the filter pipeline while the coefficients are changing. Seems to me that if you change the coefficients slowly enough, the values in the pipeline should be close, and the results not so bad.
> 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.
On Tue, 28 Jun 2016 13:46:54 -0700, herrmannsfeldt wrote:

> On Monday, June 27, 2016 at 9:13:48 PM UTC-7, robert bristow-johnson > wrote: >> On 6/24/16 8:44 AM, Matti Viljamaa wrote: >> > 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?)? > >> it all depends on how often or how fast the user parameters are >> changed. > > Well, they probably shouldn't change faster than the filter frequency. > > For band pass filters, I believe it is usual center frequency, and not > cut-off, and maybe in log frequency space.
I'm pretty sure that you would want to change significantly slower than the slowest exponential decay in the filter. But I don't know if "significant" means merely strictly less than, or ten times slower, or what.
>> often the coefficients are calculated (like a1, a2, b0, b1, b2) from >> the parameters whenever a parameter (like Q or omega_0) is changed. >> but they could, instead, be calculated periodically. like every 512 >> samples or every 64 samples. > > If you have a box with slide pots, or a graphical display with up/down > keys, > it only needs to be as fast as the human I/O system, which might be > slow.
OTOH, if you let someone type in a number, or click on a target point...
>> often the coefficients are slewed from their previous value to their >> new value every sample instance. either linear slewing or decaying >> exponential slewing (like 1st-order LPF filtering). > > Along with the values in the filter pipeline while the coefficients are > changing. > > Seems to me that if you change the coefficients slowly enough, the > values in the pipeline should be close, and the results not so bad. > >> 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.
-- Tim Wescott Wescott Design Services http://www.wescottdesign.com I'm looking for work -- see my website!
On Tuesday, June 28, 2016 at 1:54:11 PM UTC-7, Tim Wescott wrote:

(snip)

> >> On 6/24/16 8:44 AM, Matti Viljamaa wrote: > >> > How are filters that have their cutoff and e.g. Q variable > >> > (such as in a typical parametric equalizer) done?
(snip, I wrote)
> > Well, they probably shouldn't change faster than the filter frequency.
> > For band pass filters, I believe it is usual center frequency, and not > > cut-off, and maybe in log frequency space.
> I'm pretty sure that you would want to change significantly slower than > the slowest exponential decay in the filter. But I don't know if > "significant" means merely strictly less than, or ten times slower, or > what.
Yes. I was using the filter frequency to approximate that. Seems to me that how fast you can change it depends on how much of the transient you can stand in the output. Interesting question, what happens with an RLC filter if you change R, L, and C while signals are going through? If, for example, you switch in a new capacitor, it likely has 0V across it. -- glen
On Tue, 28 Jun 2016 15:59:21 -0700, herrmannsfeldt wrote:

> On Tuesday, June 28, 2016 at 1:54:11 PM UTC-7, Tim Wescott wrote: > > (snip) > >> >> On 6/24/16 8:44 AM, Matti Viljamaa wrote: >> >> > How are filters that have their cutoff and e.g. Q variable >> >> > (such as in a typical parametric equalizer) done? > > (snip, I wrote) > >> > Well, they probably shouldn't change faster than the filter >> > frequency. > >> > For band pass filters, I believe it is usual center frequency, and >> > not cut-off, and maybe in log frequency space. > >> I'm pretty sure that you would want to change significantly slower than >> the slowest exponential decay in the filter. But I don't know if >> "significant" means merely strictly less than, or ten times slower, or >> what. > > Yes. I was using the filter frequency to approximate that. > > Seems to me that how fast you can change it depends on how much of the > transient you can stand in the output. > > Interesting question, what happens with an RLC filter if you change R, > L, and C while signals are going through? If, for example, you switch > in a new capacitor, it likely has 0V across it.
For adjustments to the inductor and cap, I think it would depend on the construction of the device -- i.e., two popular methods of mechanically changing capacitance are to move plates transversely or to change the gap between the plates. I'm pretty sure that these would have different results if you make the change on the same time scale as the resonant frequency of the circuit. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com I'm looking for work -- see my website!
On Tuesday, June 28, 2016 at 4:54:20 PM UTC-7, Tim Wescott wrote:

> > On Tuesday, June 28, 2016 at 1:54:11 PM UTC-7, Tim Wescott wrote:
(snip, I wrote)
> >> I'm pretty sure that you would want to change significantly slower than > >> the slowest exponential decay in the filter. But I don't know if > >> "significant" means merely strictly less than, or ten times slower, or > >> what.
> > Yes. I was using the filter frequency to approximate that.
> > Seems to me that how fast you can change it depends on how much of the > > transient you can stand in the output.
> > Interesting question, what happens with an RLC filter if you change R, > > L, and C while signals are going through? If, for example, you switch > > in a new capacitor, it likely has 0V across it.
> For adjustments to the inductor and cap, I think it would depend on the > construction of the device -- i.e., two popular methods of mechanically > changing capacitance are to move plates transversely or to change the gap > between the plates. I'm pretty sure that these would have different > results if you make the change on the same time scale as the resonant > frequency of the circuit.
I was assuming we were talking about audio frequencies, but maybe not. Moving plate air dielectric, or even plastic dielectric, capacitors are fine for RF systems, but usually too low capacitance for audio. Thinking more about it, though, is there an active circuit which has its center frequency far from sqrt(1/LC)? That is, amplify the L and C with op-amps? Maybe then you can do it with air dielectric capacitors. -- glen
On Tue, 28 Jun 2016 15:59:21 -0700, herrmannsfeldt wrote:

> Interesting question, what happens with an RLC filter if you change R, > L, and C while signals are going through? If, for example, you switch > in a new capacitor, it likely has 0V across it.
Generally the control signal leaks into the main signal path when the control signal changes, usually in a multiplicative fashion with respect to the signal of interest (the error caused by such leakage is proportional to the main signal amplitude). If the variable component is a capacitor or inductor then, depending on topology, what leaks through is proportional to either the derivative or the integral of the control signal. But for almost any topology that make sense, it ends up being proportional to the derivative, so for slowly-varying control signals the leakage is small. If the variable component is a resistor, then you get straight multiplication. Steve
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?
On Tue, 28 Jun 2016 22:03:58 -0700 (PDT),
herrmannsfeldt@gmail.com wrote:

>On Tuesday, June 28, 2016 at 4:54:20 PM UTC-7, Tim Wescott wrote: > >> > On Tuesday, June 28, 2016 at 1:54:11 PM UTC-7, Tim Wescott wrote: > > (snip, I wrote) > >> >> I'm pretty sure that you would want to change significantly slower than >> >> the slowest exponential decay in the filter. But I don't know if >> >> "significant" means merely strictly less than, or ten times slower, or >> >> what. > >> > Yes. I was using the filter frequency to approximate that. > >> > Seems to me that how fast you can change it depends on how much of the >> > transient you can stand in the output. > >> > Interesting question, what happens with an RLC filter if you change R, >> > L, and C while signals are going through? If, for example, you switch >> > in a new capacitor, it likely has 0V across it. > >> For adjustments to the inductor and cap, I think it would depend on the >> construction of the device -- i.e., two popular methods of mechanically >> changing capacitance are to move plates transversely or to change the gap >> between the plates. I'm pretty sure that these would have different >> results if you make the change on the same time scale as the resonant >> frequency of the circuit. > >I was assuming we were talking about audio frequencies, but maybe not. > >Moving plate air dielectric, or even plastic dielectric, capacitors are fine >for RF systems, but usually too low capacitance for audio. > >Thinking more about it, though, is there an active circuit which has its >center frequency far from sqrt(1/LC)? That is, amplify the L and C with >op-amps? Maybe then you can do it with air dielectric capacitors.
Voltage-Controlled Filters (VCFs) were the mainstray of analog music synths. The VCFs were important because in the early days almost all synths used subtractive synthesis. You started with a waveform that had lots of harmonics (typically a sawtooth) and dynamically filtered it to get the desired sound. The most common implementations used active filters with variable transconductance.op-amps like the CA3080, essentially equivalent to changing the Rs in the circuit. When the musician pressed a key on the keyboard, it triggered an envelope generator that controlled the tuning of the VCF, and also a separate envelope for the output amplitude shape. 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!