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?
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?
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?
decimation and bitshifting (think [<<~ ] ) can produce nice distortion effects.
blip, ub
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 recieved, please fill me in.
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@iem.at to manage your subscription (including un-subscription) see http://iem.at/cgi-bin/mailman/listinfo/pd-list
For different kinds of soft clipping, also try:
[expr~ 1.5 * $v1 - 0.5 * pow($v1, 3)] [expr~ tanh($v1)] [expr~ $v1 / (abs($v1) + 1)]
I wrote the zhzxh~ external (in CVS), which produces very noisy distortion using a very simple algorithm which isn't waveshaping; I'm not sure how you'd classify it:
while (n--) { f = *(in++); if (lastval < f) *out = lastval + delta; else *out = lastval - delta; lastval = *(out++); }
Changing delta alters the character of the distortion.
Ben
On Tuesday 20 July 2004 05:48 pm, pix wrote:
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).
pix wrote:
... 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 recieved, please fill me in.
In AM the radio-frequency sine wave is Amplitude Modulated by the signal. In the receiver if the local oscillator is not running at the same frequency as the transmitter sine wave, you get sidebands in the signal whose frequency is the difference between the remote and local oscillators plus the frequency of the signal. This can be simulated in pd by multiplying [*~] two signals together, one of which is a sine wave [osc~], and the other is up to you. All the other distortions in radio are mostly noise, a constant background with bursts from lightning and motors. Whistlers are caused by lightning impulses bouncing around in the earth's magnetic field: different frequencies travel at different speeds, so the original click is smeared into a descending chirp of noise. . Martin.
ah i had the feeling when i mentioned AM that it would be a very uninsteresting case. FM seems to generate all sorts of odd distortions when you are off signal though. i figure it would be hard to model exactly in realtime since the carrier signals are so high, but a similar summary of the audible effects would be useful.
pix.
On Tue, Jul 20, 2004 at 02:25:05PM -0400, Martin Peach wrote:
pix wrote:
... 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 recieved, please fill me in.
In AM the radio-frequency sine wave is Amplitude Modulated by the signal. In the receiver if the local oscillator is not running at the same frequency as the transmitter sine wave, you get sidebands in the signal whose frequency is the difference between the remote and local oscillators plus the frequency of the signal. This can be simulated in pd by multiplying [*~] two signals together, one of which is a sine wave [osc~], and the other is up to you. All the other distortions in radio are mostly noise, a constant background with bursts from lightning and motors. Whistlers are caused by lightning impulses bouncing around in the earth's magnetic field: different frequencies travel at different speeds, so the original click is smeared into a descending chirp of noise. . Martin.