FX INTRODUCTION / 03 / DRAFT

Distortion: round off waveform peaks

Increasing Gain alone does not change the waveform shape. This time, use a function that grows more slowly for larger values to change the tone.

This article is a work in progress. The examples will be refined through listening. Run starts playback; Stop ends it. Use Apply after editing values. Stop the playing iframe before trying another one.

Listen with the built-in FX

SettingMeaning
driveInput drive multiplier
mixDry/wet mix

Select none in FX Monitor to see the waveform after the built-in FX. This pass-through effect makes input and output overlap; it does not compare the signal before and after the built-in FX.

Open in a separate Playground tab ↗

How the PCM is processed

The function here is tanh. It is nearly linear around zero, but approaches ±1 for large positive and negative inputs. It rounds the sine wave's peaks and creates harmonics. The input multiplier drive controls distortion; the final multiplier gain controls output loudness. Listen separately for a louder sound and a change in tone.

input[ch][i] is one input sample. ch identifies a left or right audio channel, not a physical FM voice. Store values carried between blocks in state. Since process cannot access outer variables, put settings in context.

Try it with liveFx

Open in a separate Playground tab ↗

Select distortion-lab in FX Monitor to compare the input and output of this process.

  1. Try drive at 1, 10, and 40, adjusting gain to compare at similar loudness.
  2. Look at the waveform peaks and the additional harmonics in Spectrum.
  3. Change only gain and check that it changes height rather than waveform shape.

Scope of this example

This learning example uses simple tanh. The built-in drive has a maximum of 20 and also has a mix control. Strong nonlinear processing can produce aliasing. This example does not oversample.

The waveform shows changes over time; Spectrum shows the strength of frequency components. A short display window or smoothing can hide some changes. Listen while changing one setting at a time.