That anti-alias tanh is interesting... Here is another version of it I came up while playing around with it:

Code:

function tanh_aa(x)
instance(y)
local(old_x, old_y, dx)
(
old_x = this.x;
old_y = y;
abs(x) > log(2^511) ? (
x = sign(x);
this.x = x * log(2^511);
y = log(2^511) - log(2);
x;
) : (
this.x = x;
y = x - log(2 / (exp(x * -2) + 1));
dx = x - old_x;
abs(dx) > 0.0000000001 ? (y - old_y) / dx : 2 / (exp(-(x + old_x)) + 1) - 1;
);
);

It should be a bit faster than sai'ke's original version (although you will likely not notice, unless you use it many times per sample), and it has ErBird's abs(x)>354 inside the function.

BTW, it seems that this tanh doesn't like sudden large changes in gain, I guess because then the difference between the current and the previous sample becomes too large. A smoother could probably fix this though.