exp(-2 * PI * X) approx

DSP, Plugin and Host development discussion.
RELATED
PRODUCTS

Post

nollock wrote: You just split 'x' into integer and fractional components, IE..

x^(a+b) = x^a * x^b

So for 2^x you do this.

i = Floor(x);
f = x-i;
result = 2^i * 2^f;

where 2^i can be done with bitmasking or bit shifting.

2^f can be done with a polynomial fitted only over the range 0..1
Thank you for that excellent explanation. That seems so simple I almost feel stupid for not knowing it ... until now. :)

Post

Hi,

I finally found some time to build a small plugin that uses all different approximations for at least the tanh(). The guiless demo plugin can be found here: http://www.savioursofsoul.de/Christian/ ... eshaper.7z (for those who can't wait...)

I'll prepare some results with timings and quality comparisons. So far I can tell the best choice strongly depends on the usage.

E.g. a rational polynomial approximation will generate a lot of extra harmonics not available in the original tanh() function. These do lead to aliasing. If you are running this approximation on an oversampled path anyway, this possible aliasing doesn't hurt anymore.

The exp() based approximation generates completely different harmonics and will lead to alias as well. Though it can be seen, that the 4th order polynomial for the error correction is working best. In combination with light oversampling, which might be there anyway, you are very close to the original tanh() in the end.

I'll prepare some plots later tonight,

Christian

Post

Christian Budde wrote:Hi,

I finally found some time to build a small plugin that uses all different approximations for at least the tanh(). The guiless demo plugin can be found here: http://www.savioursofsoul.de/Christian/ ... eshaper.7z (for those who can't wait...)

I'll prepare some results with timings and quality comparisons. So far I can tell the best choice strongly depends on the usage.

E.g. a rational polynomial approximation will generate a lot of extra harmonics not available in the original tanh() function. These do lead to aliasing. If you are running this approximation on an oversampled path anyway, this possible aliasing doesn't hurt anymore.

The exp() based approximation generates completely different harmonics and will lead to alias as well. Though it can be seen, that the 4th order polynomial for the error correction is working best. In combination with light oversampling, which might be there anyway, you are very close to the original tanh() in the end.

I'll prepare some plots later tonight,

Christian

Hey Christian, if I want to come up with an approximation that would work in your test bed, what domain (inputs) should I support (or assume that you're using)?
Swing is the difference between a drum machine and a sex machine.

Post

Is there such a tool, that I can draw a transfer curve, similar to a tube and have it give me the formula and coeffs ?? Kinda in reverse..

I'd like to make a transfer curve somewhat like this, but am TOTALLY lost at how to mimic this behavior with an algo:

Image

~Rob.

Post

my suggestion: draw it again, this time make it look better
also, draw a grid before that, and the curve over the grid
then measure a lot of sample points from the grid (where i suppose X would be the input amplitude, and Y would be the output amplitude)
write these pairs of X Y values you measured in a text file
grab some curve fitting application (i use CurveExpert) and it'll hopefuly do the hard job

btw, this curve looks complicated, i think the only thing that'll work in practice would be a high-ordered polynomial :shrug:
It doesn't matter how it sounds..
..as long as it has BASS and it's LOUD!

irc.libera.chat >>> #kvr

Post

antto Thank you for your suggestion that CurveExpert is exactly what I was looking for!

~Rob.

Post Reply

Return to “DSP and Plugin Development”