Main Archive Specials Wiki | FAQ Links Submit Forum


Waveshaper (simple description)

Type : Polynomial; Distortion
References : Posted by Jon Watte

Notes :
> The other question; what's a 'waveshaper' algorithm. Is it simply another
> word for distortion?

A typical "waveshaper" is some function which takes an input sample value
X and transforms it to an output sample X'. A typical implementation would
be a look-up table of some number of points, and some level of interpolation
between those points (say, cubic). When people talk about a wave shaper,
this is most often what they mean. Note that a wave shaper, as opposed to a
filter, does not have any state. The mapping from X -> X' is stateless.

Some wave shapers are implemented as polynomials, or using other math
functions. Hard clipping is a wave shaper implemented using the min() and
max() functions (or the three-argument clamp() function, which is the same
thing). A very mellow and musical-sounding distortion is implemented using
a third-degree polynomial; something like X' = (3/2)X - (1/2)X^3. The nice
thing with polynomial wave shapers is that you know that the maximum they
will expand bandwidth is their order. Thus, you need to oversample 3x to
make sure that a third-degree polynomial is aliasing free. With a lookup
table based wave shaper, you don't know this (unless you treat an N-point
table as an N-point polynomial :-)


Code :
float waveshape_distort( float in ) {
return 1.5f * in - 0.5f * in *in * in;
}



Comments


Added on : 30/06/05 by dspgoes[ AT ]hotmail[ DOT ]com
Comment :
Has anyone tried implementing this distortion effect?  All I get on the output is static... thanks



Added on : 30/06/05 by Christian[ AT ]savioursofsoul[ DOT ]de
Comment :
Yes! It's one of the most simple waveshaper and you know the amount of oversampling! Works very nice (and fast).



Added on : 23/08/06 by kibibu[ AT ]gmail[ DOT ]com
Comment :
If you are getting static, make sure your input is scaled to between -1 and +1.



Added on : 13/01/17 by contact[ AT ]sasa[ DOT ]com
Comment :
This formula do not modify the wave, only increase the sound.



Add your own comment
Comments are displayed in fixed width, no HTML code allowed!
Email:

Comment:

Are you human?



Site created and maintained by Bram
Graphic design by line.out | Server sponsered by fxpansion