Efficient antialiasing for distortion of any input

DSP, Plugin and Host development discussion.
RELATED
PRODUCTS

Post

What this looks like to me is lim() compared to a function which is not lim().

Simple as that.

That would be my guess.
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

aciddose wrote:What this looks like to me is lim() compared to a function which is not lim().
Sorry but no way I can understand that :) Mind explaining ?

Post

Mokafix wrote:
aciddose wrote:What this looks like to me is lim() compared to a function which is not lim().
Sorry but no way I can understand that :) Mind explaining ?
Well, the problem is that the result as in "custom x2" plot can be achieved by infinite number of ways (I can get the same plot with plain 3-order polynomial waveshaper w/o any oversampling at all, thus with ~zero CPU load ;). So w/o knowing what you're doing (or at least w/o seeing more deep test results beside just 10kHz sine -> 10kHz square plot) it would be nothing but pretty useless guesswork comments.

(As for Reaktor examples, I'm afraid the chances you'll get such here are not so great. I don't remember too many people here relying on Reaktor as a prototyping system. At least when it comes to almost purely analytical stuff like anti-aliasing and oversampling are).

Post

Max M. wrote:
Mokafix wrote:
aciddose wrote:What this looks like to me is lim() compared to a function which is not lim().
Sorry but no way I can understand that :) Mind explaining ?
Well, the problem is that the result as in "custom x2" plot can be achieved by infinite number of ways (I can get the same plot with plain 3-order polynomial waveshaper w/o any oversampling at all, thus with ~zero CPU load ;). So w/o knowing what you're doing (or at least w/o seeing more deep test results beside just 10kHz-sine -> 10kHz square plot) it would be nothing but pretty useless guesswork comments.
Not sure if the polynomials implementation you suggest would be dependent on any specs of the input.
Mine is not frequency nor waveform dependent just straight clipper with one input and one output, not smart analysis inside, no frequency tracking or anything.
I captured 10Khz (ish) result but any frequency and any waveform I tried performs the same.
Not sure if that answers your comment though.

Post

Sweeps from 500Hz up to 20k or so, still -40/+40 amplitude sine against -0.5/+0.5 clipper.
sweeps.jpg
If the x4 and x8 i use for reference are really good then I guess there is not much room for misinterpretation.
You do not have the required permissions to view the files attached to this post.

Post

aciddose wrote:What this looks like to me is lim() compared to a function which is not lim().

Simple as that.

That would be my guess.
+1, but the simple fact is that any antialiasing for hard clipping would result in something that is NOT the limit function.

Post

That doesn't matter much, what matters is that the functions are the same.

Actually though if you're using a FIR filter the function remains identical, only you've applied the filter to the x/f(x) as I gave earlier. Since it is a FIR filter, after the filter length in samples the signals will match exactly.

If you're changing the function, you've merely changed the function. That throws out any chance of making a valid comparison between the two.

Part of learning about DSP or any technical field is learning how to make valid measurements. I don't think this person understands what a valid measurement is, how to use measurement tools or which numbers are important (I.E. what should be measured) in the first place. In setting up an experiment to demonstrate something the key is to provide absolutely all the information required to reproduce the test conditions.

A simple definition such as: "1k reference sine (clib sin() function) with lim(x, -1/10, 1/10)*10 applied" would satisfy this.
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

aciddose wrote:Since it is a FIR filter, after the filter length in samples the signals will match exactly.
That doesn't make much sense. There's no way to bandlimit without changing the output, and even if the underlying function is the same, the output is not, hence it does not equal the same function.

Post

So you're saying that:

(x^2 + 1) is not the same function as (x^2 + 2) ?

They're both (x^2) with some value added, which is exactly the same as the FIR filter.

Algebra and calculus require abstract thinking.

(x^2) is not the same as (x * (1 + x^2)), although the second function does contain the first.

They are in that sense "the same", they break down to the same thing.

The limit() function is a piecewise linear function and so can be broken down in that way, to simply "a piecewise linear function".

When you replace this with something completely different is when you can no longer compare the results.

What is really different is (x^n) vs. "a piecewise linear function" in that (x^2) "a power function" is not "a piecewise linear function".
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

aciddose wrote:A simple definition such as: "1k reference sine (clib sin() function) with lim(x, -1/10, 1/10)*10 applied" would satisfy this.
Sorry i cannot write in code :(
I said 10k sine, or sweep from 500hz to 20kHz is maybe more interesting, amplitude*40, clipper with min/max set to -0.5/+0.5.
Not sure what is missing in there to be able to reproduce the setup really. I call it clipper because that is how it is called for me as I do not c++. It simply chops all above the max and below the min, one way ticket to aliasing.
Anyway : next week I will show it to my DSP engineer friends and probably get debunked severely.
here is the audio of the sweep test

Post

I've been investigating antialiasing methods those days.
Antialiasing of distortion has always been an interesting problem.

At the moment, my main method consists in 8x interpolation/decimation, which is quite cpu intensive.

I've tried "blamps" :idea: as described in this thread, but i had to go up to the third order. Even if the distortion was simply defined by line segments (no first order discontinuities, no bleps)... I had to detect the precise subsample positions and amplitudes for the "blamps" and the "blumps". That was a pain in the back of the head. :ud:
At the end it was more cpu intensive than 8x oversampling. :evil:

So, here is my question:
:?: If we define the distortion as a set of line segments, is it possible to use a sort of MIPMAP method ?

PS: Sorry for digging this thread up but i didn't want to create another one on the same topic.
See you here and there... Youtube, Google Play, SoundCloud...

Post

What I described is possible although not likely very efficient.

Yes, computing the point at which the continuous signal crosses each threshold requires computing not just the continuous signal but derivatives up to a significant order. This requires settling on an approximate interpolation function such as a cubic Hermite with well known derivatives and accepting the resulting error that brings.

Even the best possible implementation would be more expensive or equal to over-sampling because that is in fact what it is! It's "infinite" over-sampling (using whatever sort of interpolation to compute the continuous signal) combined with a root-finding algorithm to locate the crossing of the threshold and a FIR filter to remove content outside the band at that discontinuity.

Before executing the root-finding algorithm you could execute a far more simple test to identify whether the threshold is crossed between any two samples and do no further processing in those cases where it is not.

Even in the ideal implementation (free) the cost would still break down to computing the interpolating filters themselves.
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

Unlike the saturation case, in the case of a distortion defined by segments, many "segments" can be crossed in one sample (for a finely defined distortion), and as many corrective grains must be inserted.

That's why i'm investigating other solutions such as variants of MIPMAPing, maybe other people have already investigated this kind of solution ?
See you here and there... Youtube, Google Play, SoundCloud...

Post

You mean many convolutions must occur.

That should be obvious.

Keep in mind if you wanted to produce 2nd order curves for example you could differentiate the input, process the linear segments and integrate the output.
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

You mean distort the differential of the input and integrate the output ? :?:
See you here and there... Youtube, Google Play, SoundCloud...

Post Reply

Return to “DSP and Plugin Development”