# [PD] distortion

Frank Barknecht barknech at ph-cip.uni-koeln.de
Sat May 11 09:09:18 CEST 2002

```David N G McCallum hat gesagt: // David N G McCallum wrote:

> 	Speaking of waveshaping, does anyone know how I'd go about getting
> a waveshaping equation into a table for tabread4~?
>
> 	For example, say I want to use the equation:
>
> f(x,a) = x*(abs(x) + a)/(x^2 + (a-1)*abs(x) + 1)
>
> that I got off musicdsp.org. Where a is a variable and x is the input
> sample value.
I wouldn't write this into a table but instead use the expr~ family.
Unless more 'GEN' functions besides "sinesums" get implemented widely,
expr~ is a better way for this kind of waveshaping. I tested some
waveshaping methods in my dirty waveshaper patch available at

ciao,
--
Frank Barknecht                                  _ _______footils__

-------------- next part --------------
#N canvas 0 0 865 473 10;
#X obj 197 160 expr~ \$v1*(abs(\$v1) + \$f2)/(pow(\$v1 \, 2) + (\$f2 - 1)*abs(\$v1)
+1);
#X obj 195 366 dac~;
#X obj 197 127 *~ 0.5;
#X obj 196 332 *~ 0.5;
#X obj 269 17 vsl 15 128 0 1 0 0 empty empty empty 0 -8 0 8 -262144
-1 -1 5600 1;
#X obj 265 207 vsl 15 128 0 1 0 0 empty empty empty 0 -8 0 8 -262144
-1 -1 3400 1;
#X floatatom 528 91 5 0 0;
#X connect 0 0 4 0;
#X connect 1 0 3 0;
#X connect 1 1 3 0;
#X connect 3 0 0 0;
#X connect 4 0 2 0;
#X connect 4 0 2 1;
#X connect 5 0 3 1;
#X connect 6 0 4 1;
#X connect 7 0 0 1;
```