Kind of. But it goes into the other end of the first integrator of a two pole cascade...Ichad.c wrote:I read somewhere that sallen-key filters use positive feedback, is that true?
Cheap non-linear zero-delay filters
- u-he
- 28063 posts since 8 Aug, 2002 from Berlin
- KVRAF
- 12555 posts since 7 Dec, 2004
sallen-key is similar to this:
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.
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
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.
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.
-
Richard_Synapse Richard_Synapse https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=245936
- KVRian
- 1136 posts since 20 Dec, 2010
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.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?
Richard
Synapse Audio Software - www.synapse-audio.com
- KVRAF
- Topic Starter
- 7890 posts since 12 Feb, 2006 from Helsinki, Finland
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.Richard_Synapse wrote: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.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?
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.
-
- KVRian
- 969 posts since 6 Jul, 2009
Or start programming to do things only possible digitally?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
- KVRAF
- Topic Starter
- 7890 posts since 12 Feb, 2006 from Helsinki, Finland
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).KBSoundSmith wrote:Or start programming to do things only possible digitally?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
-
- KVRAF
- 7400 posts since 17 Feb, 2005
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.
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.
-
- KVRAF
- 7400 posts since 17 Feb, 2005
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.
- KVRAF
- Topic Starter
- 7890 posts since 12 Feb, 2006 from Helsinki, Finland
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.
- KVRist
- 406 posts since 6 Apr, 2008
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.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?
- KVRist
- 406 posts since 6 Apr, 2008
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.
- KVRAF
- 12555 posts since 7 Dec, 2004
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.karrikuh wrote: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.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?
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.
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.
-
AdmiralQuality AdmiralQuality https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=83902
- Banned
- 6657 posts since 10 Oct, 2005 from Toronto, Canada
There isn't a lot of feedback in those circuits. Except for the Presence control. Oh, hmmmmmmm!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.
-
- KVRian
- 653 posts since 4 Apr, 2010
I'm not totally sure what you're getting at, perhaps...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 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
-
- KVRAF
- 1607 posts since 12 Apr, 2002
As far as I can guess, the SimulAnalog guys were using the trapezoidal integration back in the beginning of this century.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.