Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

Compressor without techtalk?

DSP related issues, mathematics, processing and techniques

Compressor without techtalk?

Postby tulamide » Tue Feb 25, 2020 2:58 pm

As the one who's totally incapable of even the easiest forms of DSP, let alone ASM, I have a hard time, when I try to understand how a compressor works in the digital domain. That's why I will describe what I think might happen, and it would be nice if anything that's wrong would be corrected IN THE SAME EASY LANGUAGE :lol:

There's a bunch of numbers in the range [-1, +1]
A threshold (for example 0.5) will be used to check each number. If the number is positive and lower than threshold it passes untouched. If the number is negative, then the abs of number has to be lower than threshold in order to be passed untouched.
Any other number is processed, and the processing goes on for a certain amount of time, once threshold was triggered.
The time range is defined by attack and release. Attack describes the time it takes the compressor to affect the numbers fully. This is linear, starts at 0% and ends at 100%, covering the time that was set for attack (for example 0.1s). Basically something like "compress_ratio * percentage" (compress_ratio * 0.5 at 0.05s in this example)
The release time is a bit more mysterious for me. One would think it's just the opposite of attack, but when I listen to compressors it sounds much more like the fully compressed signal stays that way until release time is over, and then jumps immediately to uncompressed. I bet it is something in between.
The ratio tells us how to affect the numbers. "6:1" would mean a sixfold compression. A number of 1.0 and a threshold of 0.6 would leave 0.4 to compress. 0.4 sixfold compressed would be 0.00625 (0.4,0.2,0.1,0.05,0.025, 0.0125, 0.00625) and the number changes from 1.0 to 0.60625
Knee. Never understood that. What's a knee? Why can it be soft or hard? Why is there no elbow or hip?
Gain. Used to make the signal louder again after compression. The above example of 0.60625 could be raised to 1.0 again (but of course now with the new relationship to the other numbers)

Yep, that's how it looks in my brain. No "oh take tan(h) and make it the cosine of the third root of the second derivative". Just "erm, numbers?"
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Compressor without techtalk?

Postby deraudrl » Tue Feb 25, 2020 5:07 pm

Heh. As someone who spent a largish chunk of his career programming sundry signal processors, my eyes always glazed over when some analyst started talking about tweaking the positions of poles and zeros. "Remember that diagram you gave me last week for the filter you wanted? It's already coded, so just GIVE ME THE DAMN COEFFICIENTS ALREADY!"
I keep a pair of oven mitts next to my computer so I don't get a concussion from slapping my forehead while I'm reading the responses to my questions.
deraudrl
 
Posts: 239
Joined: Thu Nov 28, 2019 9:12 pm
Location: SoCal

Re: Compressor without techtalk?

Postby Spogg » Tue Feb 25, 2020 5:59 pm

I’m not a compressor expert but I would you say you have it tulamide.

To recap, the threshold is the signal level above which the gain changes. The ratio is the amount by which the gain changes, so a 2:1 ratio would halve the gain above the threshold. The so-called “make-up” is a volume adjustment so the peak to peak value (or rms) is similar to the incoming dry signal.

The term “knee” has to be qualified as hard or soft. At the threshold point on the transfer function graph, where the gain is changed, the gain transition can be instant (hard knee) or more gradual (soft knee). A soft knee is less likely to introduce audible distortion at the threshold by avoiding discontinuities. If you imagine a switch that instantly halves the gain you would expect to hear the effect of the switch suddenly changing over.

Assuming the side chain (the bit that evaluates the incoming level and creates a control signal) has a linear characteristic and the release time is longish (normally it’s much longer than the attack) then we have a situation where we have a linear decay instead of exponential. As with an envelope generator, a linear decay or release doesn’t match the ear’s response, so the most perceived change in volume will be towards the end of the decay curve. I blame God for that.

So that’s my understanding, and now I wait for trog to offer a much better explanation. :lol:

Cheers

Spogg
User avatar
Spogg
 
Posts: 3358
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England

Re: Compressor without techtalk?

Postby trogluddite » Tue Feb 25, 2020 6:55 pm

Spogg wrote:...now I wait for trog to offer a much better explanation.

The summaries so far (including tulamide's own) are pretty much spot on, as far as I can see. All that I can really add are a few minor details...

Firstly, the threshold isn't usually determined on a sample-by-sample basis. Tulamide's description is about there for a very fast peak-sensing limiter, but more often the signal level is smoothed before comparing it with the threshold (an envelope-follower, basically). For example, the RMS power of the signal over some small window of time is often used. This just helps the gain to be a bit steadier, so that it doesn't wobble around in between each peak of low-frequency signals (though even analogue compressors can wobble a bit for very short time constants, as is well known by bass guitar players). This also explains why some compressors have the options to "look ahead" in the signal, to compensate for the time delay while the window of samples for smoothing are collected.

Secondly, the gain change is traditionally calculated in terms of decibels rather than linearly. So a signal that is 6dB over the threshold with a 2:1 ratio is reduced by 3dB. As Spogg has already pointed out, this is to reflect the way that human perception of volume isn't linear and also depends on the power of a signal, not its peak amplitude. If not done this way, this might also add to the perception that the decay of the compression is abrupt rather than smooth.
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
User avatar
trogluddite
 
Posts: 1730
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Re: Compressor without techtalk?

Postby RJHollins » Tue Feb 25, 2020 7:07 pm

to add ... Knee.

A 'hard knee' initiates compression quickly at the threshold point. [kinda like a hard switch ... figuratively]

A 'soft knee' will ramp up the compression, as it approaches the Threshold 'trigger'. IOW ... a 'soft knee' will gradually start compression earlier to the Threshold. [you kinda 'ease in' to compression]
RJHollins
 
Posts: 1571
Joined: Thu Mar 08, 2012 7:58 pm

Re: Compressor without techtalk?

Postby tulamide » Tue Feb 25, 2020 9:06 pm

Thanks a lot so far! I'm glad I'm not that far off! For my understanding, I quote you guys for sections that leave me with questions still.

Spogg wrote:The term “knee” has to be qualified as hard or soft. At the threshold point on the transfer function graph, where the gain is changed, the gain transition can be instant (hard knee) or more gradual (soft knee). A soft knee is less likely to introduce audible distortion at the threshold by avoiding discontinuities. If you imagine a switch that instantly halves the gain you would expect to hear the effect of the switch suddenly changing over.

Ok, I understand the description. It's basically the curvature at the critical stage over time (the "ease-in" was a good hint, rj!). So why isn't that controlled with the attack? For example by setting the attack to a non-linear approach? Or is "knee" only a seperate control on the GUI, while internally it does exactly that?

trogluddite wrote:Firstly, the threshold isn't usually determined on a sample-by-sample basis. Tulamide's description is about there for a very fast peak-sensing limiter, but more often the signal level is smoothed before comparing it with the threshold (an envelope-follower, basically). For example, the RMS power of the signal over some small window of time is often used. This just helps the gain to be a bit steadier, so that it doesn't wobble around in between each peak of low-frequency signals (though even analogue compressors can wobble a bit for very short time constants, as is well known by bass guitar players). This also explains why some compressors have the options to "look ahead" in the signal, to compensate for the time delay while the window of samples for smoothing are collected.
I understand the explanation! But doesn't it also change the characteristic of the sound in an unwanted way? A single impulse followed by silence might not even be catched at all with a rms window, depending on the settings. Or do I miss something here? (I tend to believe I'm not missing something, because it would explain my sometimes tedious work of running a track over and over again while a compressor without gain/make-up is running, adjusting volume until finally no overloud peaks are detected anymore...)

trogluddite wrote:Secondly, the gain change is traditionally calculated in terms of decibels rather than linearly. So a signal that is 6dB over the threshold with a 2:1 ratio is reduced by 3dB. As Spogg has already pointed out, this is to reflect the way that human perception of volume isn't linear and also depends on the power of a signal, not its peak amplitude. If not done this way, this might also add to the perception that the decay of the compression is abrupt rather than smooth.
Yes, that's why I halved the signal for every ratio step (see my example for 6:1 ratio), imitating 20*log10(v). But it is totally possible that I messed things up once again. Btw., is the reciprocal 10^(dBvalue/20) ?
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Compressor without techtalk?

Postby trogluddite » Wed Feb 26, 2020 12:44 am

tulamide wrote:So why isn't that controlled with the attack? For example by setting the attack to a non-linear approach? Or is "knee" only a seperate control on the GUI, while internally it does exactly that?

They are distinct controls. The "fading" of the attack works over time, but the "fading" of a soft-knee works in terms of signal level by making the ratio progressive. For example; if your target ratio is 4:1, it might really only be 2:1 for a signal that's 1dB over the threshold, 3:1 for a signal that's 2dB over the threshold, and the full 4:1 only for signals 3dB over the threshold. Signals in that little "variable ratio" zone are affected by it no matter what the time constants are - even, say, a constant-level signal that happened to be in that zone. The width of that "variable ratio" zone is what is meant if you see a compressor with "variable knee".

Incidentally, some analogue designs are soft-knee by default because the gain-control components are just inherently non-linear - it's one of those analogue "imperfections" that sounds so "right" that we go out of our way to emulate it in digital.

tulamide wrote:But doesn't it also change the characteristic of the sound in an unwanted way?

Yes, RMS-sensing does change the response quite dramatically; but not necessarily in an "unwanted" way - it depends what you're using the compressor for. There are two main things you might want to do:

1) Control the dynamic range to suit a recording medium. In this case you're trying to reduce peaks (or, more correctly, to raise the average after make-up gain) to get a nice loud signal, but which doesn't overload. This suits the system that you first suggested - grabbing the very highest peaks as quickly as possible to rein them in. As you'd guess, this is what most limiters would use too (they're just a peak-sensing compressor with a very high ratio).

2) Control the dynamic range to make a signal sound more "consistent". A common example is making sure that vocals have a nice, even level so that they stay audible over the backing tracks. In this case, it's more important to control the average power of the signal, as that's what our brain interprets as the "volume" of the sound. So you'd probably use an RMS-sensing compressor for this.

As you suggest, in case (2), peaks might slip through without being gain-reduced very much, even when a fast attack is set. So, as you might guess from this, it's very common to chain two compressors - an RMS-sensing compressor to even out the sound, followed by a peak-sensing compressor to catch any stray peaks that the first one lets through.

tulamide wrote:Yes, that's why I halved the signal for every ratio step

Ah - my bad; I didn't read your post closely enough!

tulamide wrote:Btw., is the reciprocal 10^(dBvalue/20) ?

That's the correct inverse function, yes - but you might get a telling off from Martin if you call it the "reciprocal"! ;)
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
User avatar
trogluddite
 
Posts: 1730
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Re: Compressor without techtalk?

Postby tulamide » Wed Feb 26, 2020 1:44 am

As you suggest, in case (2), peaks might slip through without being gain-reduced very much, even when a fast attack is set. So, as you might guess from this, it's very common to chain two compressors - an RMS-sensing compressor to even out the sound, followed by a peak-sensing compressor to catch any stray peaks that the first one lets through.
To not let me sound like I have no clue how to use compressors: I do. But the specific case I mentioned is key to my final mixes. I am not one of the loudness brigade. Instead I work as carefully as possible to keep a lot of the dynamics. Which means that I often don't use a limiter after the compressor, because limiting literally limits you. Apart from very extreme failures that need to be fixed, I most often only run one limiter (used more like a cutoff than really changing the sound much), on the master track. It gives the mix much more clarity, compared to those EDM tracks with compressed synth drums (!) that sidechain-compress the pads, which work against the compressed bass, which...you get the point!

However, here it was about understanding the inner workings, not about usage. And I think I got a better understanding especially regarding knee settings (up until now I only used my ears to decide for a setting, now I can handle it more precise)
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Compressor without techtalk?

Postby trogluddite » Wed Feb 26, 2020 3:12 am

tulamide wrote:...you get the point!

Oh,yes - I sure do. I'm really glad that dynamic range finally seems to be winning against the "loudness wars". There were some albums from the last couple of decades, electronic and rocky, which had mastering that made otherwise good music almost unlistenable, IMHO.

tulamide wrote:here it was about understanding the inner workings, not about usage

I guessed as much; but since you chose such an easily-searchable thread title, I figured it was worth putting in a few practical examples for folks who find it when they're doing a bit of research.
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
User avatar
trogluddite
 
Posts: 1730
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Re: Compressor without techtalk?

Postby Spogg » Wed Feb 26, 2020 9:16 am

Excellent additional points and clarifications. :D

Trog mentioned Look-ahead and, since this topic may become a mini tutorial for others, I feel I should add something on that aspect.

Look-ahead is actually a misnomer in a way. It should really be called something like Act-later. :lol:

It works by adding a small delay to the incoming signal. The actual incoming signal is evaluated by the side chain bit which will always have a finite response time (attack). The control signal from the side chain will then act on the delayed audio signal. This means that transient processing is enhanced because the control signal can then line up exactly with the transient. With no delay this would be impossible in many situations.

The disadvantage of Look-ahead is that it must create latency, which means it’s unsuitable for live use. I’m not a producer but I believe the most appropriate application would be for compressing mixes, and maybe at the mastering stage. If you used it on a recorded DAW track for say vocals, you’d have to drag the track forward in time to compensate for the latency.

Cheers

Spogg
User avatar
Spogg
 
Posts: 3358
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England

Next

Return to DSP

Who is online

Users browsing this forum: No registered users and 65 guests