-1
\$\begingroup\$

Similar to Simple circuit to boost line-level audio

Background: Some songs start out really quiet - Queen is notorious for this - and then eventually ramp up to passable audio levels. To hear them, you have to turn up the volume; at least until they get to the “normal” levels, and then you have to turn it back down. Other songs have really strong mixes and peak the needles even at “moderate” settings.

Goal: I’m looking for a circuit - likely a couple of op-amps - that will boost and cut an audio signal between minimum and maximum values, ideally set with potentiometers. So if the song is low, the signal is boosted to minimum levels, but otherwise not altered. Ditto for louder signals, but attenuated as needed. Signals In between the max and min are just passed through. Is this doable within a reasonable definition of “doable”?

\$\endgroup\$
1
  • 2
    \$\begingroup\$ Please don't forget: One of the tings that differenciates the great music of the past from todays pop songs is the dynamic range... Todays pop music is often "compressed to death" and becomes boring pretty quickly. Peak on (for example) a CD is given by the technology. But todays music is still much "louder" becaus all the quiet passages get amplified to the same levels as the louder stuff... So be careful what you wish for :) \$\endgroup\$
    – kruemi
    Commented Jun 10 at 7:54

2 Answers 2

3
\$\begingroup\$

As Bob says, the circuit you want is called Automatic Gain Control, or (more generally) a "compressor" (because it compresses the dynamic range, which is the difference between the loudest and quietest parts of the signal). The term "compressor" is more general, as this type of circuit is also often used for other purposes, for example, controlling the peaks of a signal, or "fattening" a specific sound such as a vocal or a snare drum in a mix.

Before diving in, you should take some time to understand the basic topology(s) of such a circuit:

  • main signal path with gain control element
  • detector circuit (derives a DC control voltage from the signal)
  • typically, some processing of the DC control voltage before applying it to the gain element

and the important parameters that result:

  • threshold
  • ratio
  • attack time
  • release time
  • "makeup" gain

There is a ton of info on the web about this, much is more aimed at people learning audio engineering (mixing), but here is one paper particularly suited to the electronics engineer. It's by a company that make a number of parts specifically aimed at making compressors and limiters (a limiter is more or less a compressor with a very high ratio). If you decide to continue with this project, I would recommend their app notes and devices highly.

These days such a device is often implemented in the digital domain, but I assume that you wish to make an analogue processor.

For the application that you want you would typically want a very slow attack and release time, however the ideal settings will probably vary a bit from song to song (and on personal taste). But here are some starting values I would try if I was making this:

  • attack/release time : 500ms to 2s
  • threshold : assuming the signal is peaking to about -2/3dB of maximum, about 10 to 15dB below the maximum.
  • ratio : bit hard to say, but enough to give about 6dB of attenuation, probably around 3:1
  • makeup gain - about 6dB

(By the way, the terms "boost" and "buck" are usually used to refer to switch mode power supplies. With audio, you would be better talking about "amplification and attenuation".)

\$\endgroup\$
3
\$\begingroup\$

What you're looking for is called "automatic gain control" or "compressor".

The idea is to:

  1. Measure the signal's "amplitude"

  2. Apply attenuation or gain to keep loudness constant

I put quotes around "amplitude" because several things can be measured. If the goal of the system is to prevent saturation of amplifiers or magnetic tape then the variable of interest is peak amplitude, or close to that ; a peak detector can be used. In your application it would rather be loudness, which is more related to average power. As an approximation, average amplitude of absolute value can be used too, so that would be a precision rectifier followed by lowpass filtering.

To apply gain or attenuation to the signal in the analog domain, you need a voltage controlled volume control, which multiplies the audio signal with the gain control signal. This gets a bit hairy, because analog multiplication is difficult and expensive to with both precision and low distortion. Fortunately, DC precision is not required becaus there isn't any DC in the signal, and out of the box precision is not required either because the device can be adjusted with knobs to yield the desired effect.

So most systems will either use some form of voltage controlled resistor (JFET, LDR...) to tweak the volume, or an audio voltage controlled amplifier which is basically an analog multiplier with some constraints removed (not caring about DC, offset, precision, etc, means it can be a lot cheaper).

How these two subsystems interact with each other is when the can of worms is opened. Because the control variable ("loudness") needs to be filtered and smoothed, otherwise the circuit would simply compress every high value in the signal and let through every low value, resulting in huge distortion like clipping. So it needs to measure average loudness over a short (but not too short) length of time, and attenuate the signal according to that.

None of these systems can see into the future, they only react to the signal, so sudden transitions from loud to quiet and vice versa expose the system's reaction time. This is called "compressor pumping" and it is very recognizable, sometimes used as an effect. When it happens, every time the drummer whacks, the compressor turns the volume down for a few tenths of a second then back, and that modulates the rest of the audio.

Nowadays this is done with DSP because multiplication is not a problem for computers. So the simplest solution to your problem is to add a compressor plugin to your media player, there are plenty of those. Unlike analog, in the digital domain if you are playing back recorded audio, the compressor can cheat, look ahead into the "future" of the track, and begin attenuating just before it switches from quiet to loud (and vice versa) which reduces artifacts.

Is this doable within a reasonable definition of “doable”?

I'm not going to give any schematics because I've never built one of these and if you want one that sounds good, then you should ask someone who built one that sounds good.

Multiplying audio by any signal that is not constant is a nonlinear process that will add distortion, the question is how much and how audible. And since the way we hear and process distortion into "good sounding" and "bad sounding" is not well understood, a lot of experimentation and fine tuning is probably going to be required. So while the end result is not necessarily a huge complex circuit, it'll probably require a lot of tinkering.

Note that oldskool mixes like your Queen example are recorded at normal levels, ie the peaks are actually peaks. To avoid clipping during peaks the rest of the audio is at a much lower level, so the dynamic range is preserved. This is best for a calm environment, but unsuitable for listening in a car, for example, where ambient noise will cover the quiet passages. More recently, the loudness wars have resulted in many recordings which are compressed to death, there is no dynamic range, which renders the music unlistenable except in a car.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Setup of a compressor is an art. In many places the "now retired audio god" has set the compressor to the "perfect settings" and now there is a big sign "don't touch the compressor if you want to live!" over the controls of that device... :D \$\endgroup\$
    – kruemi
    Commented Jun 10 at 7:49
  • 2
    \$\begingroup\$ Yes! I'm afraid it's becoming a lost art as many records released today have something like 1dB dynamic range! \$\endgroup\$
    – bobflux
    Commented Jun 10 at 10:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.