![]() |
|||||||||||||||||||
| Home Articles Tutorials BLAH! Links | |||||||||||||||||||
|
|
The process of waveshaping is applying a nonlinear function to an audio signal. This process creates extra harmonics. For instance, a waveshaper can be used to emulate guitar amplifier- or tube saturation. There are also special waveshapers like Chebychev polynomials. A waveshaping function An example of a waveshaping function is shown in the code below (by Laurent de Soras): const double x = input * 0.686306; const double a = 1 + exp (sqrt (fabs (x)) * -0.75); output = (exp (x) - exp (-x * a)) / (exp (x) + exp (-x)); The waveshaper’s transfer function is found by plotting ‘output’ as a function of ‘input’. The result is shown in the figure below:
I put an organ clip through the waveshaper. As you can hear, the waveshaper adds a distortion effect to the sound. Of course, the waveshaping function as shown is not suited for real-time implementation because it uses expensive math functions such as ‘sqrt’ and ‘exp’. I suggest using a lookup table and interpolation to recreate the transfer function shown in the figure above. Chebychev polynomials Chebychev polynomials are a special class of polynomial. When they are used as waveshaping functions, a single sine input changes to a sine output of a different frequency. The output frequency is an integer multiple of the input frequency. The exact multiple is determined by the order of the polynomial. The table below shows Chebychev polynomials of orders 2..8:
So, if you insert sin(x) into a second-order Chebychev polynomial, e.g. 2sin(x)2 - 1, you will get sin(2x)! Chebychev polynomials can thus be used to obtain harmonics easily. Happy waveshaping, shadowHugger. |
||||||||||||||||||
|
This site was made using Webhare Lite. |
|||||||||||||||||||