Music and Computers
Changing the Shape of a Waveform
How it works:
A sine wave can be played by pressing keys on the computer keyboard. This
sine wave passes through a chain of WaveShapers that distort the shape
of the sine wave and add harmonics. Don't worry if it sounds "distorted".
It's supposed to. Distortion in an audio system is often just unintentional
WaveShaping that occurs when the signal exceeds the limits of the system.
Whether that is good or bad is your decision.
To Do:
-
Scroll down until you can see the black oscilloscope display.
-
Play sine waves by touching keys on the keyboard. Not all keys make sound.
Each row is an octave higher. The tuning is a 7 tone scale using just intonation.
-
If the keyboard ever stops playing notes, then click on the "Play Keys"
button.
-
Enable one WaveShaper at a time by checking the box next to the formula.
-
Increase the amplitude while holding down a key and notice how the shape
changes. Also notice what happens when you reach the top and bottom. You
can get clipping even without a WaveShaper as we have seen earlier.
-
Play a chord and notice that the sound changes dramatically when WaveShaping
is turned on. This is because you are now shaping a signal that is more
complex than a single sine wave. This results in enharmonic partials. This
could be avoided by putting an individual WaveShaper on each sine wave.
If the function is linear, "y=ax+b", then it doesn't matter whether we
do the WaveShaping before or after we mix (add) them together. But
if the WaveShaping function is non-linear, "y=x3" or "y=sin(x)", then we
get different results depending on whether we apply the WaveShaper before
or after mixing.
-
Play a low note. Enable the first WaveShaper "y=x2". Play the
same note. Notice that the note sounds an octave higher. This is because
the shape of a X2 is a parabola which is symmetric about the
Y axis.
-
Turn on several WaveShapers at once. Each one operates on the output of
the one above. so "y=g(f(x))".
-
The last WaveShaper is a "soft clipper" "y=x/(1+|x|)" will never exceed
the range of -1.0 or +1.0. So it prevents the signal from going beyond
the limits that the audio card can handle.