ik ·
Hi! This is another (better) saturator using y=tanh(x). Get the file here: http://www.mindspring.com/~ikaldor/tanh(x)saturator.osm
For e^x approximation see: http://curta.org/wiki/LnAndE
and then: tanh(x)=(e^2x-1)/(e^2x+1)
The code: -------------------------------------------------------------------------- polyin in; polyin level; polyout out; float eexpx; float x;
x=2*level*in; x=x>=0&x+x<0&-1*x; eexpx=0.1*((10+10*x)+(x*x)*(5+2*x));//approx for e^x out=(eexpx-1)/(eexpx+1);//tanh(x) out=in>=0&out+in<0&-1*out;
//simple tanh(x) saturator
---------------------------------------------------------------------------
Enjoy, ik.