Cornus Ammonis
banner
cornusammonis.bsky.social
Cornus Ammonis
@cornusammonis.bsky.social
Just a feedback loop
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.
January 6, 2025 at 6:52 PM
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.
January 6, 2025 at 6:48 PM
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.
January 6, 2025 at 6:44 PM
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.
January 6, 2025 at 6:42 PM
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.
January 6, 2025 at 6:37 PM
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.
January 6, 2025 at 6:35 PM
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.
January 6, 2025 at 6:34 PM
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:
January 6, 2025 at 6:31 PM
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.
January 6, 2025 at 6:28 PM
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!)
January 6, 2025 at 6:27 PM
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.
January 6, 2025 at 6:26 PM
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.
January 6, 2025 at 6:25 PM
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.
January 6, 2025 at 6:22 PM
When u = v, we get sin(u)^2 = 1/2 (cos(0) - cos(2u)). In other words, squaring our signal has created a second harmonic (cos(2u)) and DC bias (cos(0)). There's a general form for powers of a sine wave, the first few terms of which are here.
January 6, 2025 at 6:21 PM
AM is simply multiplication of two signals. This trig identity describes the tones created by AM, and has deep implications for audio in general. The tones produced by AM generally won't be harmonics of the input signals, but what if the two signals are the same?
January 6, 2025 at 6:19 PM
Amplitude modulation, on the other hand, produces "sidebands," which are tones with frequencies equal to the sum and difference of the two inputs.
January 6, 2025 at 6:17 PM
By definition, harmonic distortion is the creation of tones that are periodic with the input signal. That means that harmonic distortion produces tones with frequencies that are integer multiples of the input signal's frequency.
January 6, 2025 at 6:16 PM
I was asked the other day, why do compressors need antialiasing? At first I thought I knew the answer, but thinking about it harder, I pretty soon realized I didn't understand what was actually going on. So, I went deep in research to figure it out... 🧵
January 6, 2025 at 6:14 PM
The length of the different stages is definitely the primary determinant of how much high frequency content the envelope has, but the areas circled in red here are also problematic. Anything that looks like a discontinuity in the derivative is likely to result in a lot of high-frequency content.
December 17, 2024 at 12:58 AM
This surprised me: 4-point Lagrange interpolation performs terribly when using float arithmetic (left plot) due to rounding error, and is worse than linear interpolation except over a small range of LUT sizes. When using doubles (right), Lagrange outperforms until your LUT has around 2^16 entries
December 11, 2024 at 10:50 PM
Nice thing about this approach is it's very flexible. The same solver can be used to make... a 2D spatial fuzz distortion? There isn't really an existing term for this thing. The system used here is Yang's Jumping Oscillons model.
December 8, 2024 at 11:05 PM
This probably says more about the dismal dimes square milieu this guy is in, but this is a new golden age for music, and yes, that includes live music. Just don't let the algorithm tell you what to like. Go to some DIY shows, there's good ones in every city, all the time, if you know where to look.
December 2, 2024 at 4:09 AM
Very early stages but I'm excited about this: I'm developing a new kind of resonator. No delays, no Karplus-Strong, just a pure partial differential equation solver running in real time.
November 24, 2024 at 9:20 PM
Belousov-Zhabotinsky in Mandelbrot phase-space
November 19, 2024 at 11:55 PM
Perfume bottle design
November 18, 2024 at 9:57 PM