Main Archive Specials Wiki | FAQ Links Submit Forum


Type : waveshaper
References : Posted by Jon Watte

Notes :
A favourite of mine is using a sin() function instead.
This will have the "unfortunate" side effect of removing
odd harmonics if you take it to the extreme: a triangle
wave gets mapped to a pure sine wave.
This will work with a going from .1 or so to a= 5 and bigger!
The mathematical limits for a = 0 actually turns it into a linear
function at that point, but unfortunately FPUs aren't that good
with calculus :-) Once a goes above 1, you start getting clipping
in addition to the "soft" wave shaping. It starts getting into
more of an effect and less of a mastering tool, though :-)

Seeing as this is just various forms of wave shaping, you
could do it all with a look-up table, too. In my version, that would
get rid of the somewhat-expensive sin() function.

Code :
(input: a == "overdrive amount")

z = M_PI * a;
s = 1/sin(z)
b = 1/a

if (x > b)
f(x) = 1
f(x) = sin(z*x)*s


Added on : 25/05/05 by Christian[ AT ]savioursofsoul[ DOT ]de
Comment :
This one doesn't work for me. What have i done wrong? On positive inputs, the output get messed up (usually one constant instead of a sine-like function)              

Added on : 30/10/06 by nobody[ AT ]nowhere[ DOT ]com
Comment :
>>This one doesn't work for me.

I haven't tried it yet, but it's always possible your compiler decided the constants are ints instead of floats. Try "1.0f" everywhere you see "1". May not be it, but you never know.

Anyone have any luck with this one?

Added on : 30/05/14 by luketre[ AT ]hotmail[ DOT ]com
Comment :
It works fine for me..thank you!

Added on : 05/04/17 by liamfloaudio[ AT ]gmail[ DOT ]com
Comment :
              Hello, Getting an error as 'f' is an undeclared function- any idea of why this is happening?

Add your own comment
Comments are displayed in fixed width, no HTML code allowed!


Are you human?

Site created and maintained by Bram
Graphic design by line.out | Server sponsered by fxpansion