The main difference is they support fast lower-precision math, have much more VRAM, much fewer ROPs, and don't have video output ports. It's a specialized GPU.
The main difference is they support fast lower-precision math, have much more VRAM, much fewer ROPs, and don't have video output ports. It's a specialized GPU.
I'm aware, but this is written with an audience in mind that is more familiar with trig than convolution.
Thanks to @tildesounds.bsky.social for prompting this.
Equations demonstrating that distortion applied to two tones with a perfect 5th interval between them results in an intermodulation distortion component that is an octave below the fundamental. This technique is often used by guitar players to get a full sound.
That idea is a direct consequence of interpreting HD as AM. AM doesn't always produce tones that are harmonic relatives of the inputs, namely when the inputs aren't harmonic relatives of each other. The same is true of HD, and when this happens it's called intermodulation distortion.
I also haven't addressed intermodulation distortion (ID). ID is often treated as something categorically different from HD, but I would argue that it is the same thing as HD, but in the context of complex signals, i.e. signals that contain tones that are not harmonics of one another.
I've somewhat conflated "harmonic distortion," as in the harmonics created by distortion, and "a harmonic distortion," as in a memoryless nonlinearity that creates harmonics. If that bothers you, feel free to mentally substitute one or the other definition as appropriate.
Some glossed-over details: I've assumed here that the sidechain signal is the same as the input signal. It doesn't have to be, and when it isn't we can't call a compressor a harmonic distortion. This reasoning only applies when the input and sidechain signals are harmonically related to each other.
Interestingly, I've never seen a compressor design that attempts to account for and cancel out a compressor's effect on phase. Many people use compressors in a way that's closer to being a pure distortion (like OTT), which puts the most dramatic phase distortion in the range where you can notice it.
So, is a compressor always a harmonic distortion? In one sense yes, in that it limits a signal by creating harmonics. In another sense no, in that the harmonics don't have the same phase relationship as they do in a harmonic distortion.
Example showing that amplitude modulation of a wave with a phase-shifted version of the same wave doesn't change the amplitude of the created harmonic.
On the other hand, the phase delay doesn't cause the magnitude of the harmonic spectrum to change due to interference, and the effect would mostly be heard as a change in spatialization (for a stereo signal) or a change in transients.
Arguably yes, because of the influence of the lowpass filter on phase. A more strict definition of a (memoryless) distortion requires that the phase of the created harmonics can only change by a multiple of ฯ/2, and the phase delay of the lowpass filter causes that to no longer be the case.
This makes a compressor look more like a harmonic distortion, with a harmonic profile that's controlled by its lowpass filter characteristics. So, does using a lowpass filter make this not technically a harmonic distortion for some reason?
Contrary to conventional wisdom, aliasing primarily happens inside the envelope follower/gain reduction stages, and the sidechain signal is typically audible, because the envelope follower filter is not steep enough to cut out everything above 20Hz, even with a slow attack/decay time.
Put another way, so long as our envelope follower and gain reduction can be expressed as a (memoryless) distortion applied to the input signal, the whole system can be expressed as a single distortion function.
From all this we can draw a few conclusions. Ignoring the lowpass filter (which corresponds to a very low attack/release time), a compressor is ultimately a saturating distortion like any other.
In fact, if we ignore the lowpass filter in our compressor signal chain, we can combine the rectifier and gain reduction functions and compare that against tanh(x)/x, and see that they look almost identical if we choose appropriate threshold, ratio, and knee settings for gain reduction.
Equations showing tanh(x) in "gain reduction form" is an even distortion.
Looking at tanh(x) again, we could instead frame the function in a "gain reduction form," meaning that we find the function that we would multiply by x to get tanh(x). This is simply tanh(x)/x, which is an even distortion.
Example showing that multiplying odd and even harmonics together produces odd harmonics.
This means we have a signal chain that generates even harmonics, which is then multiplied by our fundamental. The fundamental is the first harmonic, which is odd. When we multiply even and odd harmonics together, the result is all odd harmonics, just like in the tanh(x) function from earlier.
This combined gain reduction function is also an even distortion, so our signal chain so far is: even distortion -> lowpass filter -> even distortion. The final step in the chain is multiplying the result of the GR function with our original input signal.
Example of a simplified gain reduction function. There are several ways to design one of these functions, especially when taking CPU performance in mind, although the overall effect is basically the same.
Without going too deep into the details, in practice, the gain reduction stages can typically be combined together as shown here, where x is the amplitude of the signal, k is the knee sharpness, T is the threshold in dB, and R is the compression ratio.
Graph of a softplus function showing different knee parameters.
The next stage of a compressor is gain reduction. This is typically done by taking our estimated signal level from the envelope follower, converting it to dB, thresholding it, and then converting it back from dB. A "soft knee" function is used for the threshold, like this "softplus" function:
The slew limiter then filters out higher-frequency harmonics. Slew limiters are equivalent to a 1-pole lowpass when they 1) are exponential rather than linear and 2) have equal attack/decay times. They otherwise act like a lowpass + even distortion, which doesn't change the overall analysis much.
A full-wave rectifier is equivalent (ideally) to the absolute value function, and a slew limiter is a kind of specialized 1-pole lowpass filter. A full-wave rectifier is an even distortion. It produces infinite harmonics, all of which are even multiples of the input frequency.
A common envelope follower design works by passing a signal through a full-wave rectifier, which is then sent to a slew limiter to smooth the signal out with a specified attack/decay time. These steps are not spectrally neutral, and if not oversampled, the rectifier can cause aliasing.
Diagram of a compressor I found online, which incorrectly says the sidechain signal is not audible.
Back to compressors: a typical compressor design uses an envelope follower to estimate the level of a signal, and a threshold function to apply gain reduction to the input signal when it gets too loud. (This is a screenshot from a guide for producers, note the "Not Audible" claim--this is not true!)
This way, we can directly frame distortion in terms of amplitude modulation, and estimate the harmonics of our distortion function, without using Fourier analysis. Comparing a direct FFT of tanh(sin(t)) to our calculated harmonics, we get very close agreement. Note that there are only odd harmonics.
Series expansion of tanh(x) when sin(x) is substituted, showing that the result gives us a harmonic series.
We can use those power-of-sine equations in order to directly convert the tanh power series into a harmonic series by substituting sin(x) for x. Here we only calculate a few terms because it gets tedious fast, but we can do this for a large number of terms with Python or Mathematica.
Amplitude modulation on its own does not cause a lot of aliasing, because the maximum frequency in the output is equal to the sum of the maximum frequencies in the inputs. However, if we do amplitude modulation repeatedly (as in the tanh power series), there's no upper frequency limit.
This means we can express this distortion function in terms of amplitude modulation of a signal with itself. There are a few caveats here: not every function readily converts to a power series, and the bound where the series converges is generally limited.
Power series of the tanh function.
So, how does this relate to distortion? For many functions, we can get a representation of the function in terms of powers of the input, namely a power series. Here's the power series for the tanh(x) function, which is one of the most commonly used distortion functions for softclipping in audio.