Dynamic Range Compression - Release???

DSP, Plugin and Host development discussion.
RELATED
PRODUCTS

Post

FabienTDR wrote: Just as a side-note, although this code is a nice way to illustrate the process, it's a recipe for big trouble sound wise. I'd even say that these pseudo-codes floating around are the main reason why most digital compressors sound like shit.

This particular implementation is a pure aliasing machine! The AR behavior is no more than a side-effect.

This discontinuity will create a signal of infinite bandwidth, resulting is strong aliases in the control (and thus audio) path. Same is true with the naive idea to use abs() as rectifier. These are seriously misleading starting points.

In fact, "attack release are implemented using low pass filters" is not really correct. This is most of all one (heavily) non-linear filter. One single filter which changes its coefficient depending on the change rate polarity. That's a much better starting point, because you'll have to bandlimit the nonlinearity: You simply can't do that with direct branching (at least for the average case).

Finally, a PCM dynamics compressor is not a music dynamics compressor! Not even close.
Could you point me to some literature/info/anything at all on more sophisticated digital dynamic compressor design? I have searched and can't find anything.

Post

@g_loughnan: I couldn't either! I have no idea why the authors of most dynamics processing papers and articles naively ignore the Nyquist theorem and its implications on non-linear processing. All this stuff is well considered in the context of literature discussing digital synths approaches or even explicit distortion algorithms, though.
Fabien from Tokyo Dawn Records

Check out my audio processors over at the Tokyo Dawn Labs!

Post

As Fabian says band limiting is very important. However compression is primarily a time domain process. We need to create a compressor with nice time domain characteristics and ensure that it is band limited.

One problem ( forgetting about band limiting) with a naive compressor where we rectify then apply attack and release is that this envelope signal is just not smooth enough in the time domain. One solution would be to apply an rms window to the rectified signal before the attack/release stage. The problem here is that as we increase the rms window size we slow down the compressor, so we get a smoother compression, but increased attack and release times.

A more sophisticated approach could be to rectify the signal and then generate two envelope signals. The first to closely follow the peak value of the input the second to follow a larger rms window. We then return the max value of these two envelopes and then apply the attack and release. The benefit of this is that the compressor will quickly follow the peak signal while benifiting from the rms smoothing. This type of compression is program dependent and will react differently depending on the dynamics of the input signal. This strategy can be modified to allow multi stage release parameters if required.

I would recommend reading the manual for Fabiens TDR Feedback Compressor. It has a lot of info on band limiting strategies ie where and how to over sample and some nice diagrams in it's control scheme section which details a multi stage envelope similar to what I described above.

There have also been some interesting discussions on this forum on envelope design in the past which you could search for.

Post

Apologies for delay replying. Got interested in another topic and can barely think about only one thing at a time.

Thanks fabientdr for the ideas on envelopes, will continue to consider them.

Am not expert on dynamics processors though have built a lot of them over the decades. Perhaps "ignoring" of the nyquist issues you raise, among old dogs, has to do with experimental findings of "what works". For instance in my ancient analog experiments, either rightly or wrongly decided that attack time < a minimum of 1 ms just doesn't sound good on music. Perhaps the ultimate explanation could be some analog equivalent of your nyquist objections.

But if one just gets in the habit of never using attack < 1 ms, and more typically at least 5 or 10 ms, because real short attacks just sound bad-- Then the nyquist issue you raise is not as nasty, and therefore one might tend to pay attention to other features than the first stage of an envelope detector.

Matt42, the multi-stage program dependent envelopes were in some analog compressors a long time ago. I spent a lot of time playing with program adaptive envelopes in analog and some in digital, mainly because many non-adaptive compressors in the past were not musically pleasing. Set the compressor for good sound for one style of playing, but when the player uses a different style later in the song or in the next song-- Suddenly the compressor doesn't sound good anymore.

So the goal was to make a compressor not so fidgity, so you can more or less set it and forget it. Some of the "classic" compressors people still pay the big bucks for, I was not impressed using them in the old days. They seemed very dull knives unsuitable for "precision work". But I must have been wrong or people wouldn't still prize them so much. :)

Post

I think the main problem with really short attacks is that it just kills the transients too badly. With 5-10ms (or more) attack, you essentially let the initial transient through, then compress a little bit "late" which actually ends up enhancing the transient. So as far as I can see, that's not necessarily a problem with the algorithm.

Post

Reminiscing, ought to dig out old notebooks and verify, but sometimes I'd use diodes for fullwave rectifier, exploiting the built-in voltage drop as the threshold control. Other times used diodes and opamps for "precision rectifiers".

Maybe the following idea was common at the time and memory has failed, but a rectifier made of a balanced modulator would be similar to the "squaring" method mentioned earlier, of digital rectification.

One might make an x-y multiplier out of a transconductance amp, and feed the audio to both the signal and control inputs. Possible biggest problem being that garden variety OTA's might be too temperature sensitive for a road-worthy compressor. Characteristic of the knob response vary too much in hot or cold conditions.

Might be moot nowadays except as intellectual exercise. An EE friend a few months ago sent me an app sheet for a modern dynamics chip with all the goodies inside, on paper with excellent noise and dynamic range specs. Looked good enough for rock'n'roll.

Post

FabienTDR wrote:@g_loughnan: I couldn't either! I have no idea why the authors of most dynamics processing papers and articles naively ignore the Nyquist theorem and its implications on non-linear processing. All this stuff is well considered in the context of literature discussing digital synths approaches or even explicit distortion algorithms, though.
Is it possible to eliminate the aliasing issue with this system using anti-aliasing filters? An IIR could be used as an anti-aliasing filter (so as not too add too much delay) and phase issues wouldn't matter in the the gain computer?

Post

The filter alone won't help, you need a higher rate as well (or bandwidth limiting at the input). But generally, yes, it's a good idea. Another good idea would be "corner free" A/R filters. In other words, A/R filters having a smooth coefficient "transition" instead of an IF. Same holds true for threshold and maybe stereo linking.

I'm sure you're aware of polynomial approximations and their well defined bandwidth extension. These might help controlling the bandwidth inside the gain computer.

The problem is very similar to naive, "geometric" synthesis models being pressed into the Nyquist theorem, say, generation of a sufficiently harmonic squarewave (i.e. aliasing free). One simply can't solve the problem with oversampling alone.
Fabien from Tokyo Dawn Records

Check out my audio processors over at the Tokyo Dawn Labs!

Post

mystran wrote:I think the main problem with really short attacks is that it just kills the transients too badly. With 5-10ms (or more) attack, you essentially let the initial transient through, then compress a little bit "late" which actually ends up enhancing the transient. So as far as I can see, that's not necessarily a problem with the algorithm.
Yes, it really depends on purpose and audience. But compare the behaviour with fast analogue compression. My STC-8 sounds fantastic at fastest speeds. Musically speaking, most analogue compressors allow much, much faster compression than digital (without sounding like a "robot"). The key problem is that as soon you reduce reaction times below ~10ms, naive digital compressors won't really compress the musical content, instead, they see a heavily aliased "image" of it. This of course, also results in aliased audio as soon the CV controls the output gain.

Analogue compression sounds excellent with fast attacks, even on the stereo bus. Most top class mastering compressors offer very fast reaction times. The advantage is that you don't have to accept the "transient enhancement" you are mentioning which in turn also results in a more transparent and musical compression I know this sounds crazy if you're not super familiar with analogue dynamics compression, but they really sound fine! Try fast attacks on a Distressor for a minute!
Fabien from Tokyo Dawn Records

Check out my audio processors over at the Tokyo Dawn Labs!

Post

FabienTDR wrote:
mystran wrote:I think the main problem with really short attacks is that it just kills the transients too badly. With 5-10ms (or more) attack, you essentially let the initial transient through, then compress a little bit "late" which actually ends up enhancing the transient. So as far as I can see, that's not necessarily a problem with the algorithm.
Musically speaking, most analogue compressors allow much, much faster compression than digital (without sounding like a "robot"). The key problem is that as soon you reduce reaction times below ~10ms, naive digital compressors won't really compress the musical content, instead, they see a heavily aliased "image" of it. This of course, also results in aliased audio as soon the CV controls the output gain.
Hey, I wasn't trying to argue against the importance of band-limited processing. I was just pointing out that super fast attacks (analog or not) aren't always what you actually want for your music. It's a worthwhile engineering goal to keep those clean, but it's not necessarily what a given music signal needs.

Post

FabienTDR wrote: Analogue compression sounds excellent with fast attacks, even on the stereo bus. .... Try fast attacks on a Distressor for a minute!
Funny you should mention the Distressor - it's a hybrid -> the gain computer is digital, 100% pure in the audio path though.

I've always broadly (and probably ignorantly) assumed that the "enhancement" of some old compressors with longer attack times actually comes from 'over-signal' actually hitting the output VCA a tad hard and/or the output transformer which is often associated with older ompressor designs.

Post

It can depend on ratio and threshold, the most extreme case a non-lookahead hard limiter with "instant" attack.

A hard limiter, no lookahead, instant attack, will square off the first over-threshold half-wave of a note or transient. When I experimented with this in analog, it would cause a psycho-acoustic perceived click which sounded worse than a brief burst of overload distortion with a slower attack limiter.

Haven't played with recent analog compressors. In the old days, it seemed common to use a few milliseconds of attack coupled with a clipping circuit to control the transient overs. Having seen that feature in old schematics, I concluded that maybe I wasn't the only one who found clicks impressed on transients to be an annoying artifact. :)

Am ignorant of distressor. Years ago the distressor fella was set up next to us at namm and I overheard him bragging about its distortion capabilities, but maybe remembering wrong. Tried to make friends with the fella but he didn't seem to be a "people person". Dunno if he was the developer or just some random flunky. Just wondering, are you certain the distressor doesn't just clip brief overs?

Post

FabienTDR wrote:The filter alone won't help, you need a higher rate as well (or bandwidth limiting at the input). But generally, yes, it's a good idea. Another good idea would be "corner free" A/R filters. In other words, A/R filters having a smooth coefficient "transition" instead of an IF. Same holds true for threshold and maybe stereo linking.

I'm sure you're aware of polynomial approximations and their well defined bandwidth extension. These might help controlling the bandwidth inside the gain computer.

The problem is very similar to naive, "geometric" synthesis models being pressed into the Nyquist theorem, say, generation of a sufficiently harmonic squarewave (i.e. aliasing free). One simply can't solve the problem with oversampling alone.
Thanks for that Fabien. I'm considering your 2 points here; up-sampling (using polynomial interpolation?) on input and "corner free" A/R filters. There is a more advanced system proposed in Udo Zoller's book and I'm wondering if this system deals with these issues. Here is a diagram of the system; the system combines a limiter, compressor, expander and noise gate, but consider just the gain computer for the compressor:
CompressUdoDownsample.jpg
This system down-samples after peak/level estimation; and up-samples just after gain factor calculation. Does this approach have any advantage in terms of the aliasing issue? If not, are you saying that the audio signal needs to be up-sampled on input before peak/rms level estimation?

This system uses a gain smoothing filter at the final stage; will this deal with the branching issue you've mentioned? If not, could you elaborate a little on an alternative approach to using an if statement to determine whether the system is in an attack or a release state?

Your time and insights are much appreciated, thanks.

Ger
You do not have the required permissions to view the files attached to this post.

Post

FabienTDR wrote:The filter alone won't help, you need a higher rate as well (or bandwidth limiting at the input). But generally, yes, it's a good idea. Another good idea would be "corner free" A/R filters. In other words, A/R filters having a smooth coefficient "transition" instead of an IF. Same holds true for threshold and maybe stereo linking.

I'm sure you're aware of polynomial approximations and their well defined bandwidth extension. These might help controlling the bandwidth inside the gain computer.

The problem is very similar to naive, "geometric" synthesis models being pressed into the Nyquist theorem, say, generation of a sufficiently harmonic squarewave (i.e. aliasing free). One simply can't solve the problem with oversampling alone.
Thanks for that Fabien. I'm considering your 2 points here; up-sampling (using polynomial interpolation?) on input and "corner free" A/R filters. There is a more advanced system proposed in Udo Zoller's book and I'm wondering if this system deals with these issues. Here is a diagram of the system; the system combines a limiter, compressor, expander and noise gate, but consider just the gain computer for the compressor:
CompressUdoDownsample.jpg
This system down-samples after peak/level estimation; and up-samples just after gain factor calculation. Does this approach have any advantage in terms of the aliasing issue? If not, are you saying that the audio signal needs to be up-sampled on input before peak/rms level estimation?

This system uses a gain smoothing filter at the final stage; will this deal with the branching issue you've mentioned? If not, could you elaborate a little on an alternative approach to using an if statement to determine whether the system is in an attack or a release state?

Your time and insights are much appreciated, thanks.

Ger

Post

It's unclear to me why he recommends limiting the system's bandwidth even more. Probably for higher efficiency? This downsampling only aggravates the problem.

I'd personally do the exact opposite, i.e. try running the nonlinear blocks at higher (i.e. appropriate) rates to reduce aliasing.

About branching, have a look at the family of logistic functions (symmetric or not) and think of them as a switch. Alternatively, have a look a "fuzzy logic" theory and how it handles branches. :)
Fabien from Tokyo Dawn Records

Check out my audio processors over at the Tokyo Dawn Labs!

Post Reply

Return to “DSP and Plugin Development”