DSPRelated.com
Forums

How are variable filters implemented?

Started by Matti Viljamaa June 24, 2016
On Tue, 28 Jun 2016 22:03:58 -0700, herrmannsfeldt 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. > > -- glen
I suspect that Steve's observation about caps and inductors applies to active circuits -- if you're going to change the frequency characteristics of a filter, you need to change the gain from an integrating element to the rest of the circuit. Instantaneous changes that don't involve switching things out of circuit mean adjusting the capacitance while keeping the charge constant, adjusting the inductance while keeping the flux constant, or in a synthesized filter, adjusting the gain from an integrator. In the digital world life is more complex. I kind of suspect that without super-fancy math and some strong assumptions about the environment you're adjusting the filter for that if you change the parameters quicker than the filter's settling time, you'll get significant transients. I'm not sure that _with_ super-fancy math you could come up with a quick adjustment that wouldn't create some sort of transient. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com I'm looking for work -- see my website!
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!
On Wednesday, June 29, 2016 at 9:15:53 AM UTC-7, Tim Wescott wrote:

(snip, I wrote)

> > 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.
(snip)
> I suspect that Steve's observation about caps and inductors applies to > active circuits -- if you're going to change the frequency > characteristics of a filter, you need to change the gain from an > integrating element to the rest of the circuit. Instantaneous changes > that don't involve switching things out of circuit mean adjusting the > capacitance while keeping the charge constant, adjusting the inductance > while keeping the flux constant, or in a synthesized filter, adjusting > the gain from an integrator.
OK, I understand variable transconductance amplifiers can be used for variable R in RLC filters. Maybe you only vary R. Say you want a 20Hz filter for audio, so about 8ms time constant. Varactor diodes might get to 500pF: https://en.wikipedia.org/wiki/Varicap so for RC of 8ms, you need about 16M ohms for R. A little big, but maybe not too big. OK, so no capacitor switching. (snip on digital filters) -- glen
On Wed, 29 Jun 2016 15:52:57 -0700, herrmannsfeldt wrote:

> On Wednesday, June 29, 2016 at 9:15:53 AM UTC-7, Tim Wescott wrote: > > (snip, I wrote) > >> > 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. > > (snip) > >> I suspect that Steve's observation about caps and inductors applies to >> active circuits -- if you're going to change the frequency >> characteristics of a filter, you need to change the gain from an >> integrating element to the rest of the circuit. Instantaneous changes >> that don't involve switching things out of circuit mean adjusting the >> capacitance while keeping the charge constant, adjusting the inductance >> while keeping the flux constant, or in a synthesized filter, adjusting >> the gain from an integrator. > > OK, I understand variable transconductance amplifiers can be used for > variable R in RLC filters. Maybe you only vary R. > > Say you want a 20Hz filter for audio, so about 8ms time constant. > > Varactor diodes might get to 500pF: > > https://en.wikipedia.org/wiki/Varicap > > so for RC of 8ms, you need about 16M ohms for R. > > A little big, but maybe not too big. > > OK, so no capacitor switching.
For most audio filtering applications you use active filters with fixed caps, and (if you want to vary stuff) change the gains. Basically, you make a direct-form filter with "1/s" in the blocks instead of "1/z", and you realize the gains with controlled-gain amplifiers. -- 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 Wednesday, June 29, 2016 at 9:55:26 PM UTC-7, Tim Wescott wrote:

(snip, I wrote)

> > OK, I understand variable transconductance amplifiers can be used for > > variable R in RLC filters. Maybe you only vary R.
> > Say you want a 20Hz filter for audio, so about 8ms time constant.
> > Varactor diodes might get to 500pF:
> > https://en.wikipedia.org/wiki/Varicap
> > so for RC of 8ms, you need about 16M ohms for R.
> > A little big, but maybe not too big.
> > OK, so no capacitor switching.
> For most audio filtering applications you use active filters with fixed > caps, and (if you want to vary stuff) change the gains.
For graphic equalizers, or ordinary bass/treble controls, the cutoff doesn't move. I have not looked at a schematic for a parametric equalizer, but have only seen one from the outside.
> Basically, you make a direct-form filter with "1/s" in the blocks instead > of "1/z", and you realize the gains with controlled-gain amplifiers.
-- glen
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?
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. The system that you are most familiar with that does rapid tuning changes is your voice. Vocal consonants are produced by rapid sweeps of formant frequencies acting on the input pulse train from your vocal cords. For example, the syllables 'ba' and 'da' differ only at the very start, when two main formants are changing. I forget the specifics, but I think in one case the formants are diverging and the other they are converging. (Or maybe in one they are tracking and the other diverging or converging... it's been a few years!) So whether the audible effects of a rapid tuning change are desired or an artifact is in the ears of the beholder. What is it that you are ultimately trying to do? As usual, that may have a huge bearing on the best approaches. 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 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 its continuously varied.
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.
Matti Viljamaa  <viljamaadsp@gmail.com> wrote:

>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.
One consideration that may not have surfaced yet in this discussion is that the filter topology can affect the behavior while slewing filter coefficients. Lattice and state-variable filters are considered a better choice. Steve