Audio Compressor – limiter v.2

compressor_limiter_v2_sm_3
compressor_limiter_v2_sm_3compressor_limiter_v2_sm_2_1592187400
5 5 2 Product


In a previous article we have introduced a simple audio compressor limiter. Here, we present an improved version of the original design. The new version includes more features. It offers limiter threshold and compressor ratio adjustments as well as independent release and attack response time adjustments. It has input and output level adjustment potentiometers and there is a digital level indicator for the visual representation of the input, the output and the compression level. There is also a LED to indicate any limiter activity.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

The block diagram

The block diagram of the audio compressor-limiter is presented in figure 1. The unit consists of three stages. The first stage (main audio) is the main stage of audio processing. The second stage (audio AGC) includes the automatic gain control circuits and the third stage (vu meters) is the digital level indicator. The main audio and the AGC stages are based on operational amplifiers circuits, while the VU-meter is based on an Arduino Uno microcomputer.

Compressor - limiter v.2 block diagram

Figure 1. The block diagram of the compressor-limiter v.2

The automatic volume adjustment, ie the compression and limiter functions, are achieved with the aim of a Junction Field Effect Transistor (J-FET) which acts as a variable resistor and adjusts the gain of an amplifier stage. The J-FET is located in the feedback loop of a common, op-amp based, non-inverting amplifier.

The main audio block

The main audio block stage is shown in Figure 2. It consists of a passive attenuator, an adjustable non-inverting amplifier (U1A) and a voltage follower amplifier (U1B). The gain of the non-inverting amplifier is controlled from Q1.

The audio input is applied on C1. The input signal level can be adjusted by RV1 potentiometer so that the device can be adapted to any input source. The following stage is a passive attenuator consisting of R1 and R2 resistors. This is a standard voltage divider that attenuates the input signal by 1 + R1 / R2 times, ie by 34 times or by 30.6 db. The attenuator is compensated by the following amplifier which is based on U1A. It is a non-inverting amplifier based on an op-amp which uses the Q1 FET in its feedback loop. The Q1 is used as an automatic gain-adjusting element.

The main audio block circuit

Figure 2. The main audio block circuit schematic

Under normal conditions, when the limiter is not working, this amplifier’s gain is about +30db, so it fully compensates for the attenuator effect and the signal level at its output is almost equal to the input signal level (the signal on the RV1’s wiper). Q1 operates in its linear range and behaves as a voltage-controlled variable resistor. The voltage that regulates the resistance of Q1 is the voltage applied to its gate (AGC signal). This voltage ranges from +0.6V to -12V approximately. The higher the AGC voltage, the lower the resistance between the drain and the source of Q1. With an AGC voltage of +0.6V the Q1 FET has the lowest possible resistance which is about 30 Ohm. With a minimum control voltage of -12V, on the contrary, the FET has its maximum resistance which is a few tens of KOhm.

Because Q1 is in the feedback loop of the non-inverting amplifier, it affects the gain of the amplifier. In practice, the gain of the non-inverting amplifier is equal to 1 + R4 / (R3 + RQ1). Where RQ1 is the dynamic resistance between the source and drain of the Q1 FET. Since the RQ1 value is at the denominator of the characteristic gain ratio of the amplifier, it follows that the lower the FET resistance, the higher the gain will be.

The U1B operates as a voltage follower. The RV2 potentiometer adjusts the output level. We use the voltage follower to ensure low output resistance so that the compressor-limiter can be connected to any subsequent audio device.

We should also mention some more details about the R1-R2 attenuator. We use the attenuator to ensure that Q1 will operate in its linear (ohmic) region. Q1 should always operate in its linear region in order to act as a voltage-controlled variable resistor. From the characteristic curves of a J-FET, we may observe that a J-FET can operate in its linear region only when the voltage between the source and drain (Vds voltage) is small enough and is maintained in the range of a few tens of millivolts at its absolute value. The polarity of the Vds voltage does not matter because the J-FET is a two-way element but this voltage should definitely not exceed a few tens of millivolts.

jfet curves

Figure 3.J-FET can operate in its linear region for small Vds voltage

Due to the high open loop gain of U1A, the voltage on the non-inverting input of the op-amp is practically equal to the voltage of the inverting input of the same op-amp. Therefore, by ensuring with the R1-R2 attenuator that the voltage at the inverting input will remain quite small, we also ensure that the same will happen at the non-reversing input. By extension, due to the circuit connections, the Vds voltage of Q1 will be also small, ensuring that it will always remain in its linear operating region.

The automatic gain control

The automatic gain control stage (AGC) adjusts the gain of the main audio by adjusting the AGC voltage at the gate of Q1. The AGC stage receives a signal at its input from the output of U1A. This signal is rectified by the precision rectifier U2A and charges capacitor C6. The positive voltage resulting in C6 is an almost DC voltage and is proportional to the amplitude (volume) of the output signal of the U1A amplifier. The voltage appearing at the ends of the C6 is then reversed and added to another continuous voltage by means of the U2B adder, in order to generate the AGC voltage which is applied to the gate of the Q1.

The automatic gain control stage (AGC)

Figure 4. The automatic gain control stage (AGC) circuit schematic

The final AGC voltage is produced at the ends of the C10 capacitor. Although the voltage across C6 is positive, the AGC voltage across C10 is negative due to U2B acting as an inverting adder. The C6 is charged and discharged from different networks. It charges almost instantly from diode D2 but discharges via R8 and RV4. The discharge time constant can be set by the RV4 and actually determines the release time of the compressor-limiter. The RV6 potentiometer, on the other hand, regulates the charge time constant of the C10 and therefore determines the attack time of the compressor-limiter. As the release time remains considerably longer than the attack time, the release time setting by the RV4 potensiometer remains practically independent (unaffected) of the attack time setting via the RV6.

The RV5 potensiometer is used to add an adjustable DC offset to the C6 voltage. This way, the operating threshold of the compressor-limiter is adjusted. With a minimal DC offset, through the RV5 (when its wiper is on the uppermost right) the compressor-limiter practically starts the compression at very small audio levels. When the DC offset increases, the AGC voltage should exceed this DC offset in order to reach to an appropriate value that will allow for compression to be started. Therefore, the adjustable DC offset via the RV5 allows for the compressor-limiter threshold to be adjusted, ie it determines the volume at which the audio signal is limited to the output of the compressor-limiter.

compressor limiter V.2 operating curves

Figure 5. Typical operating curves of the compressor limiter V.2 for some different threshold levels (as measured)

Finally, there is the RV3 potentiometer which regulates the gain of the U2A rectifier. The U2A operates as a precision half-wave rectifier with adjustable gain. The gain of the precision rectifier is determined by the ratio R7 / (R6 + RV3) and in turn determines the slope of the characteristic curve of the compressor. The higher the gain of the rectifier, the steeper the characteristic slope of the compressor, ie the higher the compression ratio. In other words, the RV3 dimmer adjusts the compression ratio. The higher the compression ratio, the "harder" the compressor is, ie it has a sharper sound level compression effect.

The VU-meters

We use digital voltage unit meters (VU-meters) to produce a detailed display of the functions of the compressor-limiter. These are implemented with an Arduino Uno microcomputer. The display is done in bar graphs on a 2-line alphanumeric Display (16 characters per line).

We use the same circuit that we have already analyzed in detail in a previous article. You may refer to this previous article for detailed description of the Arduino VU-meter. Although we use the same circuit with the Arduino VU-meter, we use a different firmware. In addition, we have included an additional LED in the hardware that lights up when the limiter is activated.

The Arduino based VU meter

Figure 6. The Arduino-based digital VU meter circuit schematic used in this project

There are two bars on the display to indicate the input, output level and/or the compressor level. We use a logarithmic scale (in db) for the input-level and the output-level bar-graphs and a linear scale for the compressor level. The resolution of the logarithmic scale is set to 2db/step. The resolution of the linear scale for the compression level is about 5%/step. These resolution steps are preset in software and they may be set in different values at anytime by altering some values in the code.

There are three display modes, selected by the “mode” push-button (SW1) while the default mode is the “mode 0”. These display modes are as follow:

Mode 0: The input and output level bars are displayed simultaneously. Both graphs are in db (logarithmic scale). The difference in level between the two bars is equivalent to the real-time compression ratio in db.

Mode 1: The input level is displayed in the first line of the LCD and the compression ratio is displayed on the second line of the LCD. While the input level is displayed in db, the compression ratio is displayed in a linear scale as a per cent (%) ratio.

Mode 2: The output level is displayed in the first line of the LCD and the compression ratio is displayed on the second line of the LCD. While the output level is displayed in db, the compression ratio is displayed in a linear scale as a per cent (%) ratio.

In addition to SW1, there is also a second push button, the SW2, which enables or disables peak hold in bar graphs. Non peak-hold graphs is the default at startup.

The limiter LED (D6) lights up when the compression exceeds a given threshold set by code. Due to the fact that the output audio level is sampled after the output volume potentiometer RV2, attenuation set by this potentiometer also accounts for the compression level. Thus, if the output volume is set to low, the limiter LED will be actually light up. That is because the compression level is calculated from the actual difference between the input and the output level.

How to build the Audio Compressor – limiter v.2

This is an open-source circuit project granted under a Creative commons Attribution-ShareAlike license. Thus you may build it freely and use it as you wish. All the building details of this project are actually provided in KiCad files in the attachment section. We also provide the Arduino code for free.

compressor limiter v2 audio circuit board

The audio circuits electronic board of the compressor limiter V.2 (photo of the prototype)

Thus, in order to build this project, first you must purchase the required components from your local electronic components store. Then you must assemble the circuits on circuit boards following schematic and assembly instructions according to KiCad files. You can use either general purpose circuit boards or you may print your own printed circuit boards according to the pcb designs provided in KiCad files.

The original design includes 2 printed circuit boards – one for the audio circuits and another one for the Arduino-based display. The compressor limiter can operate interdependently from the display unit. Thus, you may build and use the audio-circuits with or without the display unit.

compressor limiter v2 digital vu meter board

The Arduino based digital VU meter board (photo of the prototype)

 

Initial adjustments

The audio circuits need no initial adjustments. The compression-limiter audio circuits will operate normally upon providing the power supply. The audio circuits require 2 power supply voltages of +15V and -15V, respectively, as showed in the schematics.

The Arduino – Display unit is powered from a third power supply unit of +9VDC. The power supply of +9V is actually connected to the audio-circuits board and passed to the arduino board threw a connector (J4) as showed in the schematics and the block-diagram. You may follow this default configuration, or alternatively, you may not connect at all the +9V power supply to the audio board and power the Arduino-board directly from its own power supply connector.

The Arduino display unit needs some initial calibration. The RV9 trimmer must be adjusted to achieve a propper contrast level for the LCD and also the RV7 and RV8 trimmer potentiometers must be adjusted for setting the VU meter full scale level. In the original design, we have set these potentiometers for full scale at 2Vpp as follow:

  1. We’ ve powered-up the Arduino from its own power supply connector.
  2. Without connecting the Arduino-VU meter to the audio board we’ve provided a sinus audio signal at pins 3 and 4 of the J5 connector from an audio signal generator. The signal amplitude was set to 2Vp-p.
  3. In display mode-0, we’ve set the RV7 and RV8 trimmer potentiometers for full scale at 2Vp-p for both the input audio and output audio bar graphs.


You may actually set the full scale at another level. This is not critical as long as the two bars (for the input and output level, respectively) are set for the same full-scale amplitude. The typical rule is to set for a full-scale amplitude equal to the typical peak-amplitude of your choice at the compressors-limiter output.

Building a stereo version

For a stereo version of the audio compressor-limiter you have 2 basic options:

  1. You may build two identical circuits, one for the right (R) audio channel and another one for the left (L) audio channel.
  2. You may build two main-audio circuits blocks for the R and L channels, respectively, only one AGC circuit block and only one Arduino-VU meter. In this case, you must use an adder (or mixer) to mix (add) the R+L signal outputs (SU outputs) from both main-audio circuits and provide the mixing output to the AGC circuit input (S_Uin input). The output of the AGC circuit (AGC out) then, has to be connected to both AGC inputs (AGC) of both main-audio circuits for the R and L channels, respectively.

You may also use 2 Arduino- VU meters in the second option. It does not matter, as long as you take care with the audio sections.

In every case of building a stereo version, you must also take care to use high quality low-tolerance components in order to achieve the same characteristics for both audio channels.

Some notices

You may have noticed that we haven’t mentioned any details about the release and attack times setting range and also about the slope setting range of the compressor limiter. This is due to the fact that apart from figure 5 we have not actually got any detailed measurements of these characteristics. We have just set them based on trial-and-error testing and οn subjective auditory assessment according to the designers perception.

However, due to the broad setting range, we believe that the circuits will fulfill even the most demanding requirements. Anyway, there is always the option of re-setting the default characteristics by altering components values.

There is another useful detail that we have to mention. In the original design, we have used logarithmic – type potentiometers for the RV1 and RV2 and linear types for the rest of potentiometers used in the circuit. You may follow this rule, or you may experiment with any other configuration.

Finally, we have to mention that all resistors used in the circuit are of 5% tolerance or better and of 1/4W type, apart from R23 which is of 1W type.

 

Attachments

Click below to download:

The original design on KiCad (includes schematics and Printed Circuit Boards artwork). You will need KiCad (V5.1.6 or later) to view and process these files.

The programming code in C for  the Arduino VU-meter used in this project.

These are provided under a Creative commons Attribution- Shared Alike license. 

 Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

 

List of the comments:
No comments have been posted yet.
Vote:

Give your advice about this item:

Username:
E-mail: