# [PD] types of distortion

pix pix at test.at
Tue Jul 20 19:48:00 CEST 2004

```linear remapping is not so hard if you can define your remapping
mathematically.  i'm a bit of a fan of this function (which i'll write
as an expr for handy use).

[expr~ 2/(1+pow(\$f2,-\$f1))-1]

your input goes in the left, the signal on the right is a control
(sensible values >1).

in theory this maps input values between +/- infinity into +/- 1. but
because of the limited precision of floating point math, they eventually
just end up being exactly equal to +/- 1 at some range. for a control of
2 this is about +/- 80. for 1.01 this is about +/- 1500.

this function is normally called the sigmoid function and is used in
neural networks.. the control is normally 'e', which probably gives the
resulting curve a perfect quality that my primitive mathematical
understanding can not appreciate.

also, foldover distortion is the effect you get when frequencies higher
than 0.5*samplerate (nyquist frequency) are produced. so-called because
they are 'folded' back in frequency space, so a frequency at
nyquist+100hz creates a kind of ghost frequency lurking around
nyquist-100hz.

the kind of distortion you are referring to is the kind of god-awful
clipping that old soundblaster cards (and surely other hardware) did.
where values where wrapped around the +/- boundaries instead of
clipping. you can recreate it (why!?) using wrap~ (after some massaging
of the signal) like this,

[+~ 1]
|
[/~ 2] //get the unclipped signal into [0,1]
|
[wrap~]
|
[*~ 2]
|
[-~ 1] //shift it back to [-1,1]

(you could do the massaging using scale, but i'm never sure what library it's in)

... if anyone knows of a good description of all of the different
distortions that come into play when an FM or AM radio signal is poorly

pix.

On Mon, Jul 19, 2004 at 09:22:34AM -0700, Lex Ein wrote:
> Add linear remapping, where the instantaneous signal is used as an index
> to a table.
> Easy for 8,12,  and 16-bit audio.  Not so easy for 20-bit or 24-bit, heh.
> This can be used to create compression, expansion, clipping, dynamics
> inversion, etc.
> L
> ba wrote:
>
> >what kinds of distortion are there other than clipping and foldover?  I
> >figure fold over is where the signal is flipped back instead of clipping.
> >what are some other common waveshaping effects?
> >
> >
>
> _______________________________________________
> PD-list mailing list
> PD-list at iem.at
> to manage your subscription (including un-subscription) see
> http://iem.at/cgi-bin/mailman/listinfo/pd-list

```