Digital Distortion effect algorithm I read the DAFX book by Udo Zölzer about the distortion effect at pages 124-125
and it says that suitable simulation of the distortion is given by the function:

$$f(x)=\frac{x}{|x|}\left(1-e^{x^2/|x|}\right)$$

Can someone explain this formula and what kind of signal we get? 

From what I understand 'x' is the sampled signal, so this is a sequence of numbers. What does |x| mean? Does it refer to the absolute value of x for each sampled value? 

So if I want to implement this simulation of the distortion effect, 


I need to know the length of x (It's given by the number of samples)
In a loop, I need to calculate this formula for each sample value
after the loop ends, I get the distorted signal (in a digital form)


After that, I need to convert it to an analog signal so I can hear it.
Thanks to the plot in Olli Niemitalo's answer I got convinced that the formula given in the book has a sign error. The non-linearity used for fuzz or distortion is always some type of smoothed clipping function, which compresses the input signal. So small input amplitudes experience little change whereas high input amplitudes are (more or less) softly clipped. And the figure shown in Olli's answer does exactly the opposite.

So I'm convinced that the correct formula should be

$$f(x)=\frac{x}{|x|}\left(1-e^{-x^2/|x|}\right)=
\text{sgn}(x)\left(1-e^{-|x|}\right)\tag{1}$$

For small values of $x$ we have $f(x)\approx\text{sgn}(x)|x|=x$, and for large (magnitude) values we get $f(x)\approx\text{sgn}(x)$, i.e., clipping.

This is a plot of the corrected non-linearity $f(x)$ (WolframAlpha):



The formula should also be simplified like the right-most expression in $(1)$, because a beginner might be inclined to literally implement the other formula and try to evaluate the terms $x/|x|$ and $x^2/|x|$, which is unnecessarily complex and also gives trouble when $x$ is close to zero. A typical implementation would look like this:


if (x > 0)
   y = 1 - exp(-x);
else
   y = -1 + exp(x);
end