[PD] distorsion

Frank Barknecht fbar at footils.org
Tue Nov 15 18:38:14 CET 2005

Hallo,
Thomas Ouellet Fredericks hat gesagt: // Thomas Ouellet Fredericks wrote:

> "remapping the signalvalues according to a stored table" Remapping?
> Like ring modulation but with a different wave than a sine?

No, it's not ring modulation. With wave shaping, you use the incoming
signal to look up values in a (function) table. See attached patch for
a basic example. If the shaper table would contain a plot of the
function "f(x) = x", then the incoming signal would pass unchanged.
However any deviation from f(x) = x will change the signal and distort
it. Because just a table lookup is involved, this technique is very
cheap on CPU and thus is very popular, wherever CPU power is limited
(as was the case through the whole 1970s).

Also see the Chebyshev-example in the Pd docs:
3.audio.examples/E05.chebychev.pd

Ciao
--
Frank Barknecht                 _ ______footils.org_ __goto10.org__
-------------- next part --------------
#N canvas 398 299 636 392 10;
#N canvas 0 0 450 300 graph1 0;
#X array shaper 515 float 3;
#A 0 -0.890474 -0.890474 -0.919046 -0.919046 -0.90476 -0.90476 -0.90476
-0.90476 -0.899998 -0.895236 -0.890474 -0.883331 -0.876189 -0.876189
-0.876189 -0.876189 -0.861903 -0.847617 -0.842855 -0.838093 -0.833332
-0.830474 -0.827617 -0.82476 -0.821903 -0.819046 -0.816189 -0.813332
-0.810474 -0.807617 -0.80476 -0.799046 -0.793332 -0.787617 -0.781903
-0.776189 -0.773332 -0.770474 -0.767617 -0.76476 -0.761903 -0.759522
-0.757141 -0.75476 -0.752379 -0.749998 -0.747617 -0.733332 -0.719046
-0.716189 -0.713332 -0.710475 -0.707617 -0.70476 -0.70476 -0.70476
-0.70476 -0.690475 -0.676189 -0.671427 -0.666665 -0.661903 -0.661903
-0.661903 -0.661903 -0.659046 -0.656189 -0.653332 -0.650475 -0.647618
-0.640475 -0.633332 -0.62857 -0.623808 -0.619046 -0.614284 -0.609522
-0.604761 -0.601903 -0.599046 -0.596189 -0.593332 -0.590475 -0.583332
-0.576189 -0.571427 -0.566665 -0.561904 -0.559046 -0.556189 -0.553332
-0.550475 -0.547618 -0.542856 -0.538094 -0.533332 -0.530475 -0.527618
-0.524761 -0.521904 -0.519046 -0.511904 -0.504761 -0.499999 -0.495237
-0.490475 -0.483332 -0.476189 -0.473808 -0.471427 -0.469047 -0.466666
-0.464285 -0.461904 -0.454761 -0.447618 -0.447618 -0.447618 -0.447618
-0.433332 -0.419047 -0.419047 -0.419047 -0.419047 -0.411904 -0.404761
-0.404761 -0.404761 -0.404761 -0.399999 -0.395237 -0.37619 -0.37619
-0.37619 -0.37619 -0.37619 -0.37619 -0.369047 -0.361904 -0.357142 -0.35238
-0.347618 -0.340475 -0.333333 -0.333333 -0.333333 -0.333333 -0.328571
-0.323809 -0.319047 -0.319047 -0.319047 -0.31619 -0.313333 -0.310475
-0.307618 -0.290475 -0.290475 -0.290475 -0.290475 -0.290475 -0.290476
-0.285714 -0.280952 -0.27619 -0.27619 -0.27619 -0.27619 -0.269047 -0.261904
-0.261904 -0.261904 -0.261904 -0.254761 -0.247618 -0.247618 -0.247618
-0.247618 -0.247618 -0.247618 -0.247618 -0.247618 -0.247618 -0.242857
-0.238095 -0.233333 -0.233333 -0.233333 -0.228571 -0.223809 -0.219047
-0.219047 -0.219047 -0.214285 -0.209523 -0.204761 -0.204761 -0.204761
-0.204761 -0.197619 -0.190476 -0.190476 -0.190476 -0.190476 -0.190476
-0.190476 -0.190476 -0.190476 -0.190476 -0.183333 -0.17619 -0.171428
-0.166666 -0.161904 -0.161904 -0.161904 -0.161904 -0.161904 -0.161904
-0.159047 -0.15619 -0.153333 -0.150476 -0.147619 -0.147619 -0.147619
-0.147619 -0.140476 -0.133333 -0.133333 -0.133333 -0.133333 -0.130476
-0.127619 -0.124762 -0.121904 -0.119047 -0.114285 -0.109523 -0.104762
-0.104762 -0.104762 -0.101904 -0.0990473 -0.0961902 -0.0933331 -0.0904759
-0.0904759 -0.0904759 -0.0904759 -0.0904759 -0.0904759 -0.0761902 -0.0761902
-0.0761902 -0.0761902 -0.0761902 -0.0761902 -0.0690474 -0.0619045 -0.0619045
-0.0619045 -0.0619045 -0.0619045 -0.0619045 -0.0571427 -0.0523808 -0.0476189
-0.042857 -0.0380951 -0.0333332 -0.0261903 -0.0190475 -0.0142856 -0.00952371
-0.00476182 -0.00190468 0.000952459 0.0038096 0.00666673 0.00952387
0.0142858 0.0190477 0.0238096 0.0309524 0.0380952 0.0428571 0.047619
0.0523809 0.0552381 0.0580952 0.0609523 0.0638095 0.0809523 0.0880951
0.095238 0.095238 0.095238 0.095238 0.095238 0.095238 0.095238 0.102381
0.109524 0.109524 0.109524 0.109524 0.116666 0.138095 0.138095 0.138095
0.138095 0.145238 0.152381 0.152381 0.152381 0.166666 0.166666 0.166666
0.166666 0.169524 0.172381 0.175238 0.178095 0.195238 0.202381 0.209523
0.214285 0.219047 0.223809 0.226666 0.229523 0.232381 0.235238 0.238095
0.242857 0.247619 0.25238 0.259523 0.266666 0.271428 0.27619 0.280952
0.283809 0.286666 0.289523 0.29238 0.295238 0.30238 0.309523 0.314285
0.319047 0.323809 0.328571 0.333333 0.338095 0.345237 0.35238 0.355237
0.358095 0.360952 0.363809 0.366666 0.369523 0.37238 0.375237 0.378094
0.380952 0.385714 0.390475 0.395237 0.400952 0.406666 0.41238 0.418094
0.423809 0.423809 0.423809 0.438094 0.445237 0.45238 0.457142 0.461904
0.466666 0.466666 0.466666 0.466666 0.473809 0.480951 0.480951 0.480951
0.495237 0.495237 0.495237 0.499999 0.504761 0.509523 0.509523 0.523808
0.523808 0.523808 0.538094 0.538094 0.538094 0.538094 0.545237 0.55238
0.55238 0.55238 0.566666 0.566666 0.580951 0.580951 0.580951 0.580951
0.588094 0.595237 0.599999 0.604761 0.609523 0.609523 0.609523 0.609523
0.616665 0.623808 0.62857 0.633332 0.638094 0.645237 0.65238 0.65238
0.65238 0.65238 0.659522 0.666665 0.671427 0.676189 0.680951 0.683808
0.686665 0.689522 0.69238 0.695237 0.700951 0.706665 0.712379 0.718094
0.723808 0.723808 0.723808 0.723808 0.730951 0.738094 0.742856 0.747618
0.752379 0.757141 0.761903 0.766665 0.766665 0.780951 0.780951 0.780951
0.780951 0.788094 0.795236 0.795236 0.795236 0.809522 0.816665 0.823808
0.823808 0.823808 0.838094 0.838094 0.838094 0.852379 0.852379 0.852379
0.857141 0.861903 0.866665 0.873808 0.852379 0.857141 0.861903 0.866665
0.880951 0.880951 0.880951 0.895236 0.895236 0.909522 0.909522 0.909522
0.93095 0.938093 0.952379 0.952379 0.952379 0.966665 0.966665 0.995236
0.995236 0.995236 0.995236 0.995236 0.995236 0.995236 0.995236 0.98095
0.98095 0.98095 0.966665 0.966665;
#X coords 0 1 515 -1 200 140 1;
#X restore 354 50 graph;
#X obj 92 114 *~ 512;
#X obj 92 186 tabread4~ shaper;
#X obj 92 275 dac~;
#X obj 91 252 *~ 0;
#X obj 117 226 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -262144
-1 -1 5200 1;
#X obj 93 35 mtof;
#X floatatom 93 15 5 0 0 0 - - -;
#X text 147 123 make it go from 0-512;
#X obj 225 281 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1
1;
#X msg 225 307 \; pd dsp \\$1;
#X obj 93 56 osc~ 110;
#X text 262 64 Paint here:;
#X obj 93 137 +~ 513;
#X connect 1 0 13 0;
#X connect 2 0 4 0;
#X connect 4 0 3 0;
#X connect 4 0 3 1;
#X connect 5 0 4 1;
#X connect 6 0 11 0;
#X connect 7 0 6 0;
#X connect 9 0 10 0;
#X connect 11 0 1 0;
#X connect 13 0 2 0;