Efficient antialiasing for distortion of any input

DSP, Plugin and Host development discussion.
RELATED
PRODUCTS

Post

I think he means the differential is descriptive of your task, not sure what he means TBH :hihi:

Post

Obviously, one should at first manage to produce a good anti-aliased result with x*x, then one can talk about higher-order distortion.
Image

Post

Aleksey Vaneev wrote:Obviously, one should at first manage to produce a good anti-aliased result with x*x, then one can talk about higher-order distortion.
I'm not completely convinced this is a good way to approach the problem, since anti-aliasing polynomials of order N is a simple matter of oversampling to 1+(N-1)/2 to keep the aliasing from folding to the base-band. So as far as I can see it's a solved problem for any polynomial order low enough to make oversampling practical.

If you can solve the problem for hard-clipping, then you can glue low-order polynomial segments into splines and do a little bit of oversampling to solve the polynomial part of the problem.. but without being able to clip in an alias-free way, the polynomials are only useful for generating a few harmonic products for a signal with known bounds, right?

ps. I actually suspect one should be able to convert the aliasing (some of it? most of it?) into some wide-band noise instead, but I won't go into details until I've tried it in practice. :)

Post

mystran wrote:
Aleksey Vaneev wrote:Obviously, one should at first manage to produce a good anti-aliased result with x*x, then one can talk about higher-order distortion.
I'm not completely convinced this is a good way to approach the problem, since anti-aliasing polynomials of order N is a simple matter of oversampling to 1+(N-1)/2 to keep the aliasing from folding to the base-band. So as far as I can see it's a solved problem for any polynomial order low enough to make oversampling practical.
You are talking about an obvious way to solve this x*x problem. I was suggesting to solve it differently, in a more efficient way, and then you may probably find an approach to solve higher-order distortion problem as well.
Image

Post

It's natural to look for specific solutions when you have a specific problem.
  • Hard clipping is special because it presents derivatives discontinuities at very located positions. Thus, the specific solution implies "edge corrective grains" of some sort (as some called them at Canam Computers back in the late 90s).
  • Polynomials are special, because the spectral extension they imply is limited by their order. "Just oversample !" is the easy answer.
To me, a nice/practical problem is a distortion defined by values in a table.
The table size being 128 and the values being linearly interpolated.
Something like:

Code: Select all

f(x) = table[intPart(x)] + floatPart(x) * (table[intPart(x)+1] - table[intPart(x)]
With no other assumptions regarding the values it may contain.
See you here and there... Youtube, Google Play, SoundCloud...

Post

Such a table breaks down to a series of limit functions summed together. This is a "peicewise linear" table.

The derivative of such a table is a series of "stair-case" steps or a "step function".

The integral of such a table is a 2nd order parabolic 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

You're right,

that's a particular problem that leads to particular solutions.
As they are segments, the source of the aliasing is the change of slope when the signal goes through the boundaries of segments.

Hence my tendency to solve this problem with edge corrective grains (blamps blumps...).

Maybe, an Hermite interpolated table could be a better / more general model ?
See you here and there... Youtube, Google Play, SoundCloud...

Post

There is no better or more general way to handle this problem because you can't break it down any further.

There may be very good approximate interpolators which remain undiscovered. There may be algorithms to more efficiently identify where discontinuities are crossed.

I believe it is impossible to find a solution where you haven't solved the basic problem of filtering discontinuities. There isn't anything else.
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

It is the main problem. I ve got some ideas i ll experiment next week end or the weekend after... some sort of multiscale edge corrective grains and merging corrective grains : at a certain scale a saturation is more like a sign detector (strong drive), the two second order edge grains can be merged as a single first order grain...
See you here and there... Youtube, Google Play, SoundCloud...

Post

What do you mean two?
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

The left One and The right one. The middle segment is so steep at,a,certain scale (HIGH DRIVE) that it transforms into a step. Steep segments could be merged based on the skew rate of the input.
See you here and there... Youtube, Google Play, SoundCloud...

Post

It can't be "transformed", you're merely choosing to ignore it.

You might also choose to ignore discontinuities where the input delta is below some threshold (low frequency) as the harmonics generated will be limited in amplitude at nyquist.

For example say you are willing to accept -80 dB or 0.0001 (100u).

Given 1/N harmonic amplitude for a zero-order impulse or "step edge" this requires a ratio of 1/10000.

If the delta scaled by the delta on both sides of any discontinuities is then less than this threshold you could simply ignore the crossing of these discontinuities and the harmonics you would introduce should be less than your limit.

This saves you the convolution of those impulses but does not save the computation of the derivatives required to decide whether to handle the convolution step.
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

I'm not interested in the low frequency stuff, it's not a problem.

I'm dealing with what happens with steep slopes : at high frequency or when the input signal has some steep slopes like a square wave or the transient of a sawtooth.

As a limit, with steep slopes, two second order discontinuities merge into one discontinuity of the first order. It can be the key to a sort of mipmaping.

I'll try that soon and maybe upload something on soundcloud so that we can hear if it works.
See you here and there... Youtube, Google Play, SoundCloud...

Post

It doesn't, you're just ignoring the discontinuities.

Very close discontinuities are what you're discussing. Don't explain it as "at very high depth", consider a unity signal and modify the table of discontinuities instead to simplify things.

At very close ranges to other discontinuities we get a sum of impulses. If the impulses are of the same or near in phase they may combine to produce an impulse at higher amplitude. They may also have components in opposing phase which cancel.

If the discontinuities are near enough and if the input delta is high enough the resulting output will only contain harmonics of considerable amplitude above the nyquist frequency.

Given synthesis of a waveform as an example it is possible to mip-map the tables to remove discontinuities as the harmonics produced pass above the nyquist frequency. This is only possible because we have a known single delta "1 / cycle length" for the input. For example given a combination of two ramps one an octave above the other, with a delta greater or equal to 1/4 the components resulting from the transposed ramp not due solely to error will not contribute any audible frequency components and could then be dropped.

With an unknown input signal however we have no way to assign a single delta value to the signal.

The only possibility I can see is via multi-band processing of the input where you could divide the signal by octave and then guarantee within certain bounds of amplitude the minimum and maximum delta components present in the signal.

Unfortunately due to the fact we are dealing with non-linear processing the result of handling these bands individually will not match the result of having handled them together.
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

Just a quick idea. When you do a plain oversampling, distortion produces oscillation at discontinuity points. So, maybe a sort of oscillator which works at discontinuity points may help. With distortion, we have input and output signal values, the difference between them gives a hint on the severity of discontinuity. If you consider several previous inputs and outputs you may probably build some sort of a filter. You may even try to create an optimization problem: e.g. try to build a filter which produces the same output as a highly oversampled case.
Image

Post Reply

Return to “DSP and Plugin Development”