## Filters to Nyquist?

44 posts
• Page

**1**of**3**•**1**, 2, 3- KVRAF
- 2491 posts since 4 Sep, 2006, from 127.0.0.1

erm, not to "quarter sample rate" like some rule

but yes, lots of filters need oversampling to handle the full range

for example an SVF needs 4x

from the SE filters i think just the moog is oversampled, but IIRC it doesn't have good tuning (which means at a different sampling rate with the same cutoff the resonanse will be somewhere else, which is not good)

but yes, lots of filters need oversampling to handle the full range

for example an SVF needs 4x

from the SE filters i think just the moog is oversampled, but IIRC it doesn't have good tuning (which means at a different sampling rate with the same cutoff the resonanse will be somewhere else, which is not good)

It doesn't matter how it sounds..

..as long as it has BASS and it's LOUD!

irc.freenode.net >>> #kvr

..as long as it has BASS and it's LOUD!

irc.freenode.net >>> #kvr

- KVRAF
- 4715 posts since 11 Feb, 2006, from Helsinki, Finland

Any general digital IIR filter can go up to Nyquist quite happily, although the response near Nyquist tends to get a bit ugly at least when using bilinear transform.

The only structures that tend to have problems are those that have been converted from the analog domain by preserving the topology, yet are forced to add some extra delay to avoid delay-free feedback loops; SVF and Moog-ladders being the most famous. The reason these are still used in synths is that they happen to have some other nice properties, for example with regards to time variation and/or coefficient calculation... and it helps if you want to mimic analog non-linearities at which point you need some oversampling anyway.

Not sure what the Tarrabia filters would be specifically, but some structures (direct forms for example) are quite sensitive to numeric precision which only gets worse at low-frequencies and high-Q. Usually not an issue with 2nd order filters in audible range (even with single-precision) though.

The only structures that tend to have problems are those that have been converted from the analog domain by preserving the topology, yet are forced to add some extra delay to avoid delay-free feedback loops; SVF and Moog-ladders being the most famous. The reason these are still used in synths is that they happen to have some other nice properties, for example with regards to time variation and/or coefficient calculation... and it helps if you want to mimic analog non-linearities at which point you need some oversampling anyway.

Not sure what the Tarrabia filters would be specifically, but some structures (direct forms for example) are quite sensitive to numeric precision which only gets worse at low-frequencies and high-Q. Usually not an issue with 2nd order filters in audible range (even with single-precision) though.

<- plugins | forum

- KVRAF
- 11781 posts since 7 Dec, 2004

actually a svf dosn't require 4x, it requires 2x with feedback compensation. actually to make it go fully to nyquist with zero feedback would require infinite time-slices unless i'm mistaken. that's the thing to note - it's stability depends upon how much feedback is applied. with 100% feedback it becomes stable at nyquist.

xhip's filters go to nyquist using this method.

3x and 4x decrease the feedback required at high frequencies, but at the cost of increased computation.

non-linearity doesn't require oversampling if implemented correctly and if dropped off at higher frequencies. audibly the results are the same, but without considerable aliasing that leaving the shaping at full magnitude would result in. (when i say "correctly", i mean in the svf at least the shaping is not applied to the signal at the input, making it dependent only upon filter feedback/frequency)

a good example is a model of a diode and capacitor in parallel in a RC.D circuit.

[A] [resistor] [B] -> [C] [cap] + [D] [diode] -> [ground]

the RC circuit is a simple lossy integrator

B = (A - C) / resistor;

C += B;

the RD.C circuit is as follows:

B = inv_diode_function(A - C) / resistor;

C += B;

D = C;

inv_diode_function can be = max(0, n^2) for a very simple example. the actual inverse diode function would be required for accuracy.

i'll spell it out for you incase you're not catching on: to implement the non-linearity at the input of the OTA in a svf, we end up with the same circuit as outlined above. so to model that, apply the inverse diode function to the delta for input to the integrators in the svf.

considering ordinary unbiased OTAs, a very good approximation is inv_diode_function(n) = n * (0.9 + 0.1 * n*n)

xhip's filters go to nyquist using this method.

3x and 4x decrease the feedback required at high frequencies, but at the cost of increased computation.

non-linearity doesn't require oversampling if implemented correctly and if dropped off at higher frequencies. audibly the results are the same, but without considerable aliasing that leaving the shaping at full magnitude would result in. (when i say "correctly", i mean in the svf at least the shaping is not applied to the signal at the input, making it dependent only upon filter feedback/frequency)

a good example is a model of a diode and capacitor in parallel in a RC.D circuit.

[A] [resistor] [B] -> [C] [cap] + [D] [diode] -> [ground]

the RC circuit is a simple lossy integrator

B = (A - C) / resistor;

C += B;

the RD.C circuit is as follows:

B = inv_diode_function(A - C) / resistor;

C += B;

D = C;

inv_diode_function can be = max(0, n^2) for a very simple example. the actual inverse diode function would be required for accuracy.

i'll spell it out for you incase you're not catching on: to implement the non-linearity at the input of the OTA in a svf, we end up with the same circuit as outlined above. so to model that, apply the inverse diode function to the delta for input to the integrators in the svf.

considering ordinary unbiased OTAs, a very good approximation is inv_diode_function(n) = n * (0.9 + 0.1 * n*n)

Last edited by aciddose on Mon Sep 13, 2010 3:27 am, edited 1 time in total.

Free plug-ins for Windows, MacOS and Linux. Xhip Synthesizer v8.0 and Xhip Effects Bundle v6.7.

- KVRian
- 877 posts since 11 Apr, 2002

Not really: http://www.native-instruments.com/en/products/producer/reaktor-5/overview/core-technology/dsp-articles (the first and the third articles are of interest).aciddose wrote:actually a svf dosn't require 4x, it requires 2x with feedback compensation. actually to make it go fully to nyquist with zero feedback would require infinite time-slices unless i'm mistaken.

Regards,

{Z}

- KVRAF
- 11781 posts since 7 Dec, 2004

Z1202 wrote:Not really

those articles just outline some of the stuff i've already posted. nothing there suggests any way to eliminate the need for feedback - also i said "zero feedback", i meant "zero oscillation" meaning "full feedback".

while it's possible to add all kinds of computation to stabilize a svf, i'm talking about using only the basic svf and adjusting the coefficients to stabilize it.

(when it comes to musical applications, the very simple 2x oversample and feedback adjustments perform better making them more practical with limited cpu power)

what were you referring to when you say "not really" ?

Free plug-ins for Windows, MacOS and Linux. Xhip Synthesizer v8.0 and Xhip Effects Bundle v6.7.

- KVRian
- 877 posts since 11 Apr, 2002

Maybe I misunderstood your reference to the feedback, I thought you refer to feedback prewarping to compensate the frequency response distortion. I don't understand how can one eliminate feedback in the SVF, it's a part of the SVF design by definition. When I said not really, I meant you can build an SVF which works up to Nyquist cutoff without zero-length time slices. No prewarping is needed either, except for the usual cutoff prewarping for the BLT.aciddose wrote:Z1202 wrote:Not really

those articles just outline some of the stuff i've already posted. nothing there suggests any way to eliminate the need for feedback - also i said "zero feedback", i meant "zero oscillation" meaning "full feedback".

while it's possible to add all kinds of computation to stabilize a svf, i'm talking about using only the basic svf and adjusting the coefficients to stabilize it.

(when it comes to musical applications, the very simple 2x oversample and feedback adjustments perform better making them more practical with limited cpu power)

what were you referring to when you say "not really" ?

Regards,

{Z}

- KVRAF
- 11781 posts since 7 Dec, 2004

yeah.. there is a way, there are multiple ways with various trade-offs. all of them require modification of the code of the svf though by adding additional elements and thus computation - which is what i don't like about them.

i was just talking about the minimum requirements to make the filter stable without modifying it.

edit: i should clarify also, my definition of stable is as posted below - obviously using the minimum possible method results in the resonance of the filter being higher than it should be. in most cases it isn't a problem, but if it is for you the solution is to either use more timeslices or a more complex method of stabilization which doesn't introduce such issues.

i was just talking about the minimum requirements to make the filter stable without modifying it.

edit: i should clarify also, my definition of stable is as posted below - obviously using the minimum possible method results in the resonance of the filter being higher than it should be. in most cases it isn't a problem, but if it is for you the solution is to either use more timeslices or a more complex method of stabilization which doesn't introduce such issues.

Last edited by aciddose on Mon Sep 13, 2010 1:56 am, edited 1 time in total.

Free plug-ins for Windows, MacOS and Linux. Xhip Synthesizer v8.0 and Xhip Effects Bundle v6.7.

- KVRAF
- 4715 posts since 11 Feb, 2006, from Helsinki, Finland

guitarbro wrote:Like i said stable meaning relatively constant response throughout.

"Stable" has a well-defined meaning when it comes to filters, and it means the impulse response has bounded in amplitude, which translates to all the system poles being inside the unit circle on z-plane (with the usual convention of z^-1 to signify a unit delay).

edit: my point is, if you say "unstable" everyone is going to assume it blows up. If you mean "relatively constant response" say "relatively constant response"

<- plugins | forum

- KVRian
- 877 posts since 11 Apr, 2002

I'd say, the above statement makes an assumption about the existence of the discrete implementation of the SVF. The fact that the Chamberlin implementation is the most known one doesn't mean it's the only one. OTOH, if you're talking about optimizing the computations, then I'd agree that it's probably the cheapest one, however if you modulate the parameters at audio rate, then the prewarping computation costs will/may outweigh the benefits of the cheap base implementation. Personally I find the imperfections of Chamberlin implementation (even with prewarping) high enough to justify the usage of a more CPU-intensive implementation, however that's of course a matter of taste.aciddose wrote:i was just talking about the minimum requirements to make the filter stable without modifying it.

Edit: BTW we were talking about 2x to 4x oversampling needed with the Chamberlin implementation, which is another factor in CPU usage comparison.

Regards,

{Z}

- KVRAF
- 11781 posts since 7 Dec, 2004

there is actually no warping preformed.

you just need to limit maximum feedback value dependent upon frequency:

feedback = 3*min(1-q, 1 - 2 * c * (1 - c*0.5))

that's no more expensive that other implementations of the filter, for sure.

edit: sorry, that was wrong, since the coefficient was internally multiplied by two, it needs to be cut in half here. i hadn't realized that optimization was there.

the correct one is:

feedback = 3*min(1-q, 1 - c * (1 - c*0.25))

you just need to limit maximum feedback value dependent upon frequency:

feedback = 3*min(1-q, 1 - 2 * c * (1 - c*0.5))

that's no more expensive that other implementations of the filter, for sure.

edit: sorry, that was wrong, since the coefficient was internally multiplied by two, it needs to be cut in half here. i hadn't realized that optimization was there.

the correct one is:

feedback = 3*min(1-q, 1 - c * (1 - c*0.25))

Free plug-ins for Windows, MacOS and Linux. Xhip Synthesizer v8.0 and Xhip Effects Bundle v6.7.

- KVRist
- 358 posts since 3 Dec, 2009, from muskegon MI

mystran wrote:guitarbro wrote:Like i said stable meaning relatively constant response throughout.

"Stable" has a well-defined meaning when it comes to filters, and it means the impulse response has bounded in amplitude, which translates to all the system poles being inside the unit circle on z-plane (with the usual convention of z^-1 to signify a unit delay).

edit: my point is, if you say "unstable" everyone is going to assume it blows up. If you mean "relatively constant response" say "relatively constant response"

sorry i actually just started getting in deep with filters, and it does "blow up".

thanks aciddose but what does Resistor mean in that code? is it an separate

equation or a comment?

- KVRAF
- 11781 posts since 7 Dec, 2004

well if we were dealing with the electronic circuit, the voltage presented at B would be equal to the difference between A, B, divided by the resistance, then that voltage would become a current via the diode equation and capacitor charge, draining the voltage into C and D, followed by recomputing the A,B divided by resistance on and on in circles. there are various ways to get better approximations and several are implemented in spice.

for us however - since we're not interested in currents or exact voltages and times, and we're also working in a discrete time situation (sampled signals) we only need to care that the resistor is some fraction between 0 and 1, that the diode applies a non-linear shape to that result, and that the capacitor acts to integrate the shaped result from the diode.

there are errors here because of sample delay which can be corrected for by oversampling, or by prewarping coefficients if we are willing to give up other accuracies.

for most musical applications however that just doesn't matter and the simplified model is just to assume that a resistor is a scaling/biasing element, a diode is a shaping element and a capacitor is an integrator.

there are cases where a diode can act as an integrator or scaling/biasing element, a resistor can act as a noise source and all sorts of other interesting properties - however unless you're trying to do a circuit model that doesn't matter.

for us however - since we're not interested in currents or exact voltages and times, and we're also working in a discrete time situation (sampled signals) we only need to care that the resistor is some fraction between 0 and 1, that the diode applies a non-linear shape to that result, and that the capacitor acts to integrate the shaped result from the diode.

there are errors here because of sample delay which can be corrected for by oversampling, or by prewarping coefficients if we are willing to give up other accuracies.

for most musical applications however that just doesn't matter and the simplified model is just to assume that a resistor is a scaling/biasing element, a diode is a shaping element and a capacitor is an integrator.

there are cases where a diode can act as an integrator or scaling/biasing element, a resistor can act as a noise source and all sorts of other interesting properties - however unless you're trying to do a circuit model that doesn't matter.

Free plug-ins for Windows, MacOS and Linux. Xhip Synthesizer v8.0 and Xhip Effects Bundle v6.7.

- KVRian
- 877 posts since 11 Apr, 2002

IMHO quite often the best method to correct the sample delay is to eliminate the problem altogether by using an integration technique corresponding to the bilinear transform, such as trapezoid integration used in http://www.simulanalog.org/statevariable.pdf or (which is more or less equivalent) the method described in the articles I posted a link to earlier. This way you get BLT frequency responses.aciddose wrote:there are errors here because of sample delay which can be corrected for by oversampling, or by prewarping coefficients if we are willing to give up other accuracies.

Regards,

{Z}