Building-an-Analog-Compressor-Part-0
- 1. Introduction
- 2. Project Overview
- 3. Dynamic Range Compression (DRC)
- 4. Key Compressor Features
- 5. Designing the Envelope Detector with an Analog Hilbert Transform Circuit
1. Introduction
Hey there! Welcome to the first part of our exciting journey into building an analog compressor and transforming it into a VST plugin. We’re going to take you through the entire process, from developing a cool analog compressor to creating a digital model, and finally, building a VST plugin that you’ll be able to replicate yourself—or, if you’re feeling lazy, you can grab it directly from our webshop.
2. Project Overview
So, what’s the plan? We aim to design and build a kickass analog compressor prototype. Once we’ve got that nailed down, we’ll move on to developing a digital model and creating a VST plugin.
Our first mission? Tackling the envelope detector, an essential part of the compressor that enables it to track the amplitude envelope of the input signal and adjust the gain reduction accordingly. But before we get our hands dirty with the hardware, we need to cover some foundational Dynamic Range Compression (DRC) theory.
3. Dynamic Range Compression (DRC)
Dynamic Range Compression (DRC) is a process used in audio signal processing to reduce the dynamic range of an audio signal. The dynamic range is the difference between the loudest and quietest parts of the signal. By compressing this range, we can make the quieter parts louder and the louder parts quieter, resulting in a more consistent and controlled sound. DRC is used across many audio applications, including mastering, mixing, tracking, transmission, and more.
In this project, we’ll focus on compressors—devices that reduce the dynamic range of an audio signal by adjusting the gain of the signal based on the amplitude envelope. Let’s also break down the difference between compressors and limiters.
3.1. Compressor vs. Limiter
A compressor and a limiter are both used to control the dynamic range of an audio signal, but they operate differently:
Compressor: Reduces the dynamic range by attenuating the signal above a certain threshold. The amount of attenuation is determined by the ratio setting. Compressors are typically used to smooth out the dynamic range, making quieter sounds louder and louder sounds quieter.
Limiter: A type of compressor with a very high ratio (usually 10:1 or higher). It prevents the signal from exceeding a certain level, effectively “limiting” the maximum output. Limiters are used to prevent distortion and clipping by ensuring the signal does not exceed a specified threshold.
In summary, while both devices control dynamic range, a compressor provides more subtle and adjustable control, whereas a limiter imposes a strict ceiling on the signal level.
4. Key Compressor Features
Let’s break down the essential controls and features of a compressor. These will be critical when we start designing both the analog hardware and the eventual digital model.
4.1. Threshold
The threshold is the level above which the compressor starts reducing the gain of the input signal. Any signal that exceeds this level will be compressed. The threshold is typically measured in decibels (dB).
4.2. Ratio
The ratio determines the amount of gain reduction applied to the signal that exceeds the threshold. For example, a ratio of 4:1 means that for every 4 dB the input signal exceeds the threshold, the output will only increase by 1 dB. Higher ratios result in more aggressive compression.
4.3. Attack Time
The attack time is the time it takes for the compressor to start reducing the gain after the input signal exceeds the threshold. A fast attack time means the compressor will respond quickly to changes in the input signal, while a slow attack time will result in a more gradual response.
4.4. Release Time
The release time is the time it takes for the compressor to stop reducing the gain after the input signal falls below the threshold. A fast release time means the compressor will stop compressing quickly, while a slow release time will result in a more gradual return to the uncompressed signal level.
4.5. Knee
The knee determines how the compressor transitions between no compression and full compression. A hard knee means the transition is abrupt, while a soft knee results in a more gradual, natural-sounding compression.
4.6. Makeup Gain
Makeup gain is used to boost the compressed signal to compensate for the gain reduction applied by the compressor, ensuring the output signal has a similar level to the input.
4.7. Gain Reduction
Gain reduction is the amount by which the compressor reduces the signal level. It is usually displayed in decibels (dB) and indicates how much compression is being applied.
4.8. Practical Example
To see these features in action, let’s look at an example. Imagine an audio signal with a dynamic range of 40 dB, and we configure our compressor with the following settings:
- Threshold: -20 dB
- Ratio: 4:1
- Attack Time: 10 ms
- Release Time: 100 ms
- Knee: Soft
- Makeup Gain: 5 dB
Once the input signal exceeds -20 dB, the compressor kicks in and starts reducing the gain. For every 4 dB the signal exceeds the threshold, the output will only increase by 1 dB. A 10 ms attack time ensures the compressor responds quickly, while the 100 ms release time ensures a smooth recovery when the signal drops below the threshold. The soft knee results in a smoother transition, making the compression less noticeable. The 5 dB makeup gain ensures that the compressed signal doesn’t sound quieter than the original.
Got it! Here’s how we can modify the section to reflect your novel approach using an analog Hilbert transform circuit for the envelope detector:
5. Designing the Envelope Detector with an Analog Hilbert Transform Circuit
We’ve discussed the basic role of an envelope detector in compression—tracking the amplitude of an incoming signal and converting it into a control voltage for gain reduction. Now, we’re going to take a novel approach to this process by implementing an analog Hilbert transform circuit to handle the envelope detection.
5.1. What is the Envelope?
In signal processing, the envelope refers to the smooth curve that outlines the extremes of an oscillating signal, representing its overall amplitude variation over time. For compressors, this envelope determines when and how much to reduce the gain.
5.2. Using a Hilbert Transform for Envelope Detection
Instead of the traditional rectifier and low-pass filter approach, we will use a Hilbert transform to construct the analytical signal, a complex representation that combines both the real and imaginary components of the input signal. From this, the envelope is easily obtained by calculating the magnitude of the analytical signal.
The steps are as follows: 1. Hilbert Transform: The Hilbert transform shifts the phase of the signal by 90 degrees, producing the imaginary part of the analytical signal. This imaginary component, when combined with the original input (real part), creates a complex signal.
Complex Signal Combination: The real part (input signal) and imaginary part (Hilbert transform output) are combined to form the analytical signal: \[ z(t) = x(t) + j \cdot \hat{x}(t) \] where \(z(t)\) is the analytical signal, \(x(t)\) is the original signal, and \(\hat{x}(t)\) is the Hilbert-transformed signal.
Envelope Calculation: The envelope of the input signal is then extracted by calculating the magnitude of the analytical signal: \[ \text{Envelope} = |z(t)| = \sqrt{x(t)^2 + \hat{x}(t)^2} \] This magnitude represents the instantaneous amplitude (or envelope) of the input signal, without the need for rectification.
5.3. Advantages of Using a Hilbert Transform
By using the Hilbert transform, we can precisely track the amplitude of the signal across a broad frequency range. This method offers some key advantages:
- Accuracy: The Hilbert transform provides a more accurate representation of the signal envelope compared to traditional rectification methods, especially for complex waveforms.
- Phase Information: This method also preserves the phase information of the signal, which can be useful for further processing.
- Smooth Response: The envelope derived from the Hilbert transform is inherently smooth, reducing the need for extensive low-pass filtering.
5.4. Key Components of the Envelope Detector
In our novel approach, the Hilbert transform will replace the traditional rectifier stage. However, some elements will remain:
- Hilbert Transform Circuit: This is the core of our design and can be implemented using an all-pass filter network to create the necessary 90-degree phase shift across the audio spectrum.
- Summing Circuit: The real and imaginary components will be summed to form the analytical signal.
- Magnitude Calculation: Analog multipliers and summing amplifiers will be used to calculate the squared magnitude of the real and imaginary components. If needed, the square root can be approximated with analog circuits or omitted for simplicity.
5.5. Next Steps
In the next post, we’ll dive into the detailed circuit design of the Hilbert transform-based envelope detector. We’ll cover how to build the all-pass filter network, sum the components, and calculate the magnitude to extract the envelope. After that, we’ll integrate this with the rest of the analog compressor prototype.
Stay tuned for more updates, and feel free to ask questions or leave comments below!
Happy building!