Spread the love

In electronic music, waveshaping is a type of distortion synthesis in which complex spectra are produced from simple tones by altering the shape of the waveforms.

Uses

Waveshapers are used mainly by electronic musicians to achieve an extra-abrasive sound. This effect is most used to enhance the sound of a music synthesizer by altering the waveform.
The simplest form of Waveshaper could be considered to be the Rock guitarist’s faithful effects pedal, the “Fuzz box”. Some synthesizers or virtual software instruments have built-in Waveshapers. The effect can range from subtle “warmer” sounds through added harmonics, overdriven “Fuzz” sounds, and metallic inharmonic sounds. The end result can bear no resemblance to the original sound fed into the shaper

How it works

A waveshaper is an audio effect that changes an audio signal by mapping an input signal to the output signal by applying a fixed mathematical function, called the shaping function. The Harmonic or Inharmonic content of the signal is entirely dependent of the shaping function. In SynthEdit we can’t control any of the parameters by voltage control, it’s all done by a fixed formula supplied as a text string.
Consider the diagram below.
In the top example, we have a function where the output is identical to the input. This is due to the fact that our function x results in -1=-1 and +1 =+1, so the transfer is not altering the signal.
In the bottom example our function of -x results in -1=+1 and +1=-1 so we have inverted the sine wave input. There will be no noticeable harmonic change, just a polarity inversion.

Changing the formula from x to -x

Soft clipping example using 5*tanh(x)

Our next example below is entirely different. As you can see changing the transfer “curve” results in an entirely different output. Here we have used the function of 5*tanh(x), which “soft” clips the sine wave input.
There is one important point to note here when using the waveshaper: that is that it has a maximum input of +/- 5 volts if we exceed this it will clip the input regardless of what formula you are using.

By changing our formula from 5*tanh(x), to 5*tanh(x/2), we don’t affect the level of the signal, but we do soften the clipping effect even more. (Try 5*tanh(x*2) if you want slightly harsher clipping.

In general the steeper the transfer curve the more harmonics you will generate.

Note: All the examples shown below have a pure sine wave input.

5*tanh(x)

Formula: 5*sin(x+2/PI)

5*sin(x+2/PI)

Formula: 5*sin(x+10/PI)

5*sin(x+10/PI)

Formula: 5*sin((x+2/PI)*(x+2/PI))

5*sin((x+2/PI)*(x+2/PI))

Formula: 4* sin((x+2/PI)(x+6/PI)/(x+6/PI)(x+2/PI)+(x+2/PI))

4* sin((x+2/PI)(x+6/PI)/(x+6/PI)(x+2/PI)+(x+2/PI))

Formula: 6* cos((x+2/PI)+sin(x+2/PI))

6* cos((x+2/PI)+sin(x+2/PI))

Formula: 3 * (abs(-abs(-abs(x+1.25)+2.5)+2.5)-1.25)

3 * (abs(-abs(-abs(x+1.25)+2.5)+2.5)-1.25)

Formula: 4 * sin (abs(-abs(-abs(x+4.25)+6.5)+4.5)-4.25)

4 * sin (abs(-abs(-abs(x+4.25)+6.5)+4.5)-4.25)

Formula: tanh((x/PI)(x/PI)(x/PI)(x/PI)(x/PI))5* sin((x/PI)(x/PI)(x/PI)*(x/PI))

tanh((x/PI)(x/PI)(x/PI)(x/PI)(x/PI))5* sin((x/PI)(x/PI)(x/PI)*(x/PI))

As you can see there are some quite interesting effects to be had from a waveshaper. Experimentation (and a some mathematical knowledge) is the key to getting usable results.

Note about Input voltages:
You really need to keep both the input voltage under control, and the curve in the waveshaper screen.
Once the input goes outside +/- 5V you will get digital clipping, and aliasing.
If the input is going outside this range use a level adjust module.

Important note:
When putting you formula together be sure to use brackets, and make sure you close them when needed- one missed bracket will destroy your carefully crafted formula.

Note about formulae, and keeping the voltages under control:

You need to keep the output from the waveshaper under control to avoid clipping in modules further down the chain. Once again it will be digital clipping, and that’s not pleasant. To demonstrate if we use the formula
tanh((x/PI)(x/PI)(x/PI)(x/PI)(x/PI))5* sin((x/PI)(x/PI)(x/PI)*(x/PI)) and alter it to
3 * tanh((x/PI)(x/PI)(x/PI)(x/PI)(x/PI))5 sin((x/PI)(x/PI)(x/PI)*(x/PI)) the whole thing starts to go badly astray…

3 * tanh((x/PI)(x/PI)(x/PI)(x/PI)(x/PI))5* sin((x/PI)(x/PI)(x/PI)*(x/PI))

You can see that the curve on the module is going well outside the limits, and that the output is well over +/- 10 V, so any modules after this will be overloaded.
If this does happen then just modify the formula values, or if that doesn’t help you can do the following:
tanh((x/PI)(x/PI)(x/PI)(x/PI)(x/PI))5* sin((x/PI)(x/PI)(x/PI)*(x/PI))/2

tanh((x/PI)(x/PI)(x/PI)(x/PI)(x/PI))5* sin((x/PI)(x/PI)(x/PI)*(x/PI))/2.

Adding the /2 at the end of the formula has reduced the level by half.
To sum up:
If the output is too low multiply the whole formula by a suitable number, if it’s too high divide the whole formula by a suitable number.
A good investment if you want to get serious about devising your own formulae would be a set of Trigonometry tables, Log and Exponential tables, a good scientific calculator. A book on mathematics and Trigonometry would give a few insights too.
Wildly devising a formula without any planning and “hoping for the best” really won’t work (except by pure luck).