- Published on
Why scaling output after distortion is good?
- Authors

- Name
- Desi Ilieva
A bit about the discrete signals
In digital audio, we don't process continuous waveforms, we process samples. A sample is just a number that represents the signal’s amplitude at a specific point in time.
This is the dedicated notation for continuous signals:
x(t) (continuous)
And this for the discrete signals:
x[n] [discrete]
The x[n] is actually the value of the signal sampled at a certain moment of time (usually between –1 and 1).
A digital signal is therefore just a sequence of numbers - list of amplitudes over time.
When we process digital audio, we apply mathematical operations / functions to those sampled numbers [n].
We usually represent the input signal as x[n] and the produced output as y[n]:

Then we apply a function/operation (filtering,modulation etc) to the input signal:

And get the output signal as:
y[n]=f(x[n])
- This notation is essential to know in DSP, later in another article we will loop deeper in the output signal and dive into another big concept - linear systems.
Why do we need output scaling in distorition?
First let's hint what a nonlinear function is and why distorion type of plugins are nonlinear.
When we apply nonlinear functions to a signal, the waveform's shape changes and so does the amplitude of the signal.
Nonlinear processing creates new harmonics, which increases also the overall energy of the signal.
So if we start with a signal x[n] in the range(-1 to 1), the processed output signal y[n], might come out louder or clipping.

The nonlinear processing push the peaks of the signal and the newly created harmonics upward, and to prevent the loudness and clipping to go too far we apply scaling after the nonlinear function(distortion).
How to scale the output?
Scaling simply means multiplying the output by a constant between 0 and 1:
y[n]=f(x[n]) * gainFactor
- f(x[n]) -> the nonlinear output
- gainFactor -> scaling value (e.g. 0.5, 0.3)
Lowering this factor scales the waveform further from clipping, without changing its shape.
Scaling is a linear operation - it doesn't change the phase, harmonic structure or color of the sound but only its amplitude.

Here's a small code snippet from JUCE to scale tahn saturation:
juce::dsp::FastMathApproximations::tanh(drive * x) * gainFactor;
Why scaling matters?
Without scaling, the output can:
Hit the digital ceiling (0 dbfs) and clip harshly
Push compressors or limiters too hard downstream
Create big gain differences between processed and clean signals in mix
With scaling:
More headroom is preserved
Mix balance is more consistent
Harmonic tone is preserved without changing its color
It's a simple and easy thing to do but it’s essential part of the nonlinear DSP processing.
Summary
Digital signals are sequences of samples:
x[n] -> input
y[n] -> output
Nonlinear functions can add a lot of harmonics and increase the amplitude significantly. To prevent clipping, apply a scaling factor after the nonlinear processing:
y[n]=f(x[n]) * gainFactor
Scaling keeps free headroom and ensures clean and controlled output levels.