Cheap non-linear zero-delay filters

DSP, Plugin and Host development discussion.
Post Reply New Topic
RELATED
PRODUCTS

Post

Ichad.c wrote:I read somewhere that sallen-key filters use positive feedback, is that true?
Kind of. But it goes into the other end of the first integrator of a two pole cascade...

Post

sallen-key is similar to this:

Code: Select all

f_c = not sure, i'd have to check
fb_c = fb + fb / (1.0 - f_c);
a += (in - a + (a - saturate(b)) * fb_c) * f_c
b += (a - b) * f_c
that's pretty much exactly the structure, should work just fine using the method in this thread.

to get bandpass you insert the input where the saturate(b) is, so saturate(b) + input.

highpass you do the same only insert into the b integrator, so b += (a - b + b - input), i think. i'd have to test it. it's quite useless and sounds like crap with a naive implementation. it's also more expensive than a "state-variable" so i've never really bothered that much with it.
Free plug-ins for Windows, MacOS and Linux. Xhip Synthesizer v8.0 and Xhip Effects Bundle v6.7.
The coder's credo: We believe our work is neither clever nor difficult; it is done because we thought it would be easy.
Work less; get more done.

Post

camsr wrote:I have a question about delayless filters:
Is there some advantage to them as opposed to oversampling the same thing? Can oversampling work as well or does it have different problems? I could see the non-linearity working just as well, but what about the tuning and modulation?
What do you mean with oversampling "the same thing"? If you mean oversampling a slightly more classic design, it's going to be slower than the code posted here, as you'll have twice the nonlinearities to solve plus the up- and downsampling. You can only gain CPU by using the same rate.

Richard
Synapse Audio Software - www.synapse-audio.com

Post

Richard_Synapse wrote:
camsr wrote:I have a question about delayless filters:
Is there some advantage to them as opposed to oversampling the same thing? Can oversampling work as well or does it have different problems? I could see the non-linearity working just as well, but what about the tuning and modulation?
What do you mean with oversampling "the same thing"? If you mean oversampling a slightly more classic design, it's going to be slower than the code posted here, as you'll have twice the nonlinearities to solve plus the up- and downsampling. You can only gain CPU by using the same rate.
Yeah. What I find interesting is that when the "circuits" get more complex and have more "feedback" paths, the "zero-delay" solutions get somewhat more complex, but the oversampling and fine-tuning that you would need for a traditional filter just skyrockets.

Eg diode ladder is already complex enough that it's just cheaper to calculate "zero-delay" solution even if the solution is horrible and costs almost as much as evaluating a naive filter twice (with non-linearities and all).

In fact, I think "zero-delay" is misleading, because it's not so much about "eliminating delays" as it is about obsoleting the whole directional signal flow of traditional DSP: you just solve a system of equations and you can rely on instant signal propagation just like in analog (or rather unlike in analog where you're limited to a factor of the speed of light).

ps: no worries though, once we run out of everything else to model (and still have enough computer power to oversample until the naive solution works), we can always model the copper "transmission lines" on circuit boards; apparently at sufficiently high frequencies there's some interesting stuff going on there depending on the layout of the board
Last edited by mystran on Mon May 21, 2012 12:25 am, edited 1 time in total.

Post

mystran wrote: ps: no worries though, once we run out of everything else to model, we can always model the copper "transmission lines" on circuit boards; apparently at sufficiently high frequencies there's some interesting stuff going on there depending on the layout of the board
Or start programming to do things only possible digitally? :lol:

Post

KBSoundSmith wrote:
mystran wrote: ps: no worries though, once we run out of everything else to model, we can always model the copper "transmission lines" on circuit boards; apparently at sufficiently high frequencies there's some interesting stuff going on there depending on the layout of the board
Or start programming to do things only possible digitally? :lol:
Haha, but I already suggested some of that in this thread, when I told I'm ruthlessly abandoning the analog concept of dual mono and treating stereo as vectors (too bad that only works with symmetric non-linearities).

Post

Okay I took a look using my DAW and set up a sample based delay and compared delays to the bandwidth of interest. If our bandwidth of interest was 24khz (48khz sampling rate), 4x oversampling would be required to feedback a signal 1 time with a 1 sample delay between feedback. The passband had a -3dbFS rolloff at nyquist with a two sample delay. Any more than 1 sample would result in comb filtering of the passband.

It seems the solution is based on the amount of feedback required. If it is treated as a unit with respect to time, oversampling looks plausible for some applications, where solving analytically might be more expensive.

Post

It appears using delayed feedback, the amount of oversampling required is the number of loops of the feedback times 4. I can't think of many uses for this, so I graciously step aside. 8)

Post

Now, what I would personally want to know, is how to do Accurate Discretization of Analog Audio Filters with Application to Parametric Equalizer Design efficiently with non-linearities. :P

Post

aciddose wrote:could you replace the averaging "half sample delay" with lerp() so it's clear to anyone reading the code what is happening?

have you tried more advanced interpolations?
I would say don't waste your time on this (well, you already did ... :) ). I found one can safely omit the 1/2 sample delay in practice without any impact on tuning/sound. The filter code for which I posted sound samples above (with 2x oversampling) doesn't have it.

Post

I would be very interested if there are developers of guitar amp sims/distortion circuit emulations reading this thread who could try out if mystran's method can improve accuracy/efficiency of their code and share their experience.

Post

karrikuh wrote:
aciddose wrote:could you replace the averaging "half sample delay" with lerp() so it's clear to anyone reading the code what is happening?

have you tried more advanced interpolations?
I would say don't waste your time on this (well, you already did ... :) ). I found one can safely omit the 1/2 sample delay in practice without any impact on tuning/sound. The filter code for which I posted sound samples above (with 2x oversampling) doesn't have it.
it should definitely make a difference. not a very big difference, but it should be audible in certain configurations. mystran already noted that aliasing may be reduced due to the filtering of the input. there are various ways to produce more accurate delays as well, although i don't think the phase accuracy should be very important.

what would be an improvement would be the sharper cut of more advanced interpolations.

it might actually not be a bad idea to convolve with an impulse designed specifically to shape the frequency response of the non-linear calculation. i haven't done any experimentation so i couldn't say what would work. such an impulse could be designed to control phase and frequency response with very high accuracy.
Free plug-ins for Windows, MacOS and Linux. Xhip Synthesizer v8.0 and Xhip Effects Bundle v6.7.
The coder's credo: We believe our work is neither clever nor difficult; it is done because we thought it would be easy.
Work less; get more done.

Post

karrikuh wrote:I would be very interested if there are developers of guitar amp sims/distortion circuit emulations reading this thread who could try out if mystran's method can improve accuracy/efficiency of their code and share their experience.
There isn't a lot of feedback in those circuits. Except for the Presence control. Oh, hmmmmmmm!

Post

karrikuh wrote:I would be very interested if there are developers of guitar amp sims/distortion circuit emulations reading this thread who could try out if mystran's method can improve accuracy/efficiency of their code and share their experience.
I'm not totally sure what you're getting at, perhaps...

There are a number of filters involved, of course, but recognize that most amps being emulated have passive, filter-order filters. And even when they're higher order, they're not a highly resonant. And they aren't moving much to speak of. And the core of the amp-sim/distortion is oversampled anyway...

In general, the filters are the easy part—there's some interaction (because the passive circuits interact)...

Did you have something that you were getting at that I'm missing? Were you thinking about the filters and tone controls, or mainly thinking of the oversampling nature of amp sims?
My audio DSP blog: earlevel.com

Post

karrikuh wrote:I would be very interested if there are developers of guitar amp sims/distortion circuit emulations reading this thread who could try out if mystran's method can improve accuracy/efficiency of their code and share their experience.
As far as I can guess, the SimulAnalog guys were using the trapezoidal integration back in the beginning of this century.

Post Reply

Return to “DSP and Plugin Development”