A Wave-Shaper distorts or modifies the input voltage depending on the transfer function that you specify. They can be used as a distortion unit, soft clipper, waveform modifier or control voltage transfer function (e.g. velocity response curve), they are to say the least, versatile.
Waveshaping is also a popular synthesis technique that turns simple sounds such as a sine wave into more harmonically complex sounds.
A guitar fuzz box is an example of a very basic waveshaper. The unamplified electric guitar sound is fairly close to a sine wave. But the fuzz box works by amplifying it to the point where the input clips the peaks of the signal in an amplifier designed to clip at moderate signal levels. A signal that is clipped has many more high frequency harmonics added to its spectrum. Sounds that have passed through any type of waveshaper will have a lot more high frequency harmonics, which gives them a “richer” sound.
Table based Waveshaping.
As you can probably imagine doing all these calculations in real time at audio frequencies is going to be a lot of work for the computer. So we generally pre-calculate these polynomials and put the results in a table. Then when we are Waveshaping sounds, we just take the value of the audio input and use it to look up the answer in the table. In the world of computer programming this is called optimization, and it greatly reduces the load on your CPU.
One big advantage of using a table is that regardless of how complex the original equations were, it always takes the same amount of time to look up the answer. You can even draw a function by hand without using an equation and use that hand-drawn function as your transfer function.
The SynthEdit Waveshaper2 module.
The Waveshaper 2 module is just an in-out module, where you specify the transfer function either in the text box on the module, or in the module’s properties panel. Changing the formula will also change the curve in display that represents the transfer function
Note:
Input Levels: The input voltage is internally clipped at +/- 5 Volts, while it won’t do any harm to exceed these values, the results won’t bear any relation to the expected results from the formula.
Output Levels: These may be higher or lower than the default SynthEdit level of +/- 5 Volts depending on the transfer function specified. We can adjust the formula to compensate for this, we just change the multiplier at the beginning of the transfer function (shown in bold): Output = 5*sin(x/PI)
A simple Waveshaping Formula.
A waveshaper in DSP form can be described as a function that takes the original input signal x, and applies a mathematical formula to the input thus producing a new output signal y. This function is called the transfer function. A simple example in SynthEdit is shown below:
Here we use a simple equation: Output = 5*sin(x/PI), the important part (the transfer function) is shown in bold. we merely multiply the results of the transfer function by 5 to restore the output to its normal SynthEdit +/- 5 volts peak to peak audio level.
In order to change the shape of the function (and not just make it bigger or smaller), the function must be nonlinear, which means it has exponents greater than 1, or functions (this is where we use sines, cosines, exponentials, logarithms, etc.). You can use almost any function you want as a waveshaper. But the most useful ones output zero when the input is zero (that’s because you usually don’t want any output when there is no input-this will result in unwanted clicking noises).
If we change the equation slightly to: 5 * sin((x*1.2)/PI) the bold section is the change we insert, then the output goes from having the peaks flattened out, to a small amount of foldback, the greater the number we use to multiply x, the greater the waveform is folded back on itself- see below where it’s increased to x*1.8
Increasing the Input voltage:
What happens if we exceed the usual SynthEdit audio levels? Well with the most basic function we used in the first example you might possibly think you’ll get a result like we had in the last example where it starts to fold back, but it doesn’t it just goes into “hard clipping”. To demonstrate I put an amplifier between the signal source and the waveshaper with a gain of *3- you can see the result below.
And if we take the function that gave us the foldback:- 5 * sin((x*1.8)/PI),
and increase the input above the default level, then the following happens:
The reason for this is that the input of the Waveshaper modules in SynthEdit is internally limited to the default of 10 volts peak to peak, so when we reach the clipping voltage the waveform loses its sine wave like shape and is clipped. So to ensure correct operation we need to ensure that the input never exceeds +/-5 Volts (especially when using external audio sources). Likewise the result of the function must be scaled correctly to restore the default output of+/- 5 Volts audio that SynthEdit uses.
Need to convert a Sine wave to a Square wave?
Then this formula will do the job for you: 5*sgn(x/pi)
If we want to “pull” a sine wave into more pronounced peaks the following formula works well: 0.15 * sinh(x/1.2)
Which also has a useful effect on Sawtooth and Triangle waves, so you can see how this can also be useful for manipulating envelopes and control voltages provided we pay close attention to the input and output voltage swings.
Leave a Reply