DSPRelated.com
Forums

basic compressor question

Started by Jeff Roberts July 18, 2005
"Andor" <an2or@mailcircuit.com> wrote in message 
news:1121847430.725232.135360@g49g2000cwa.googlegroups.com...
> Jon wrote: >> My company Symetrix used to make an analog compressor/limiter that had an >> "automatic" setting for the attack and release times. > > Thanks for linking that manual - that's a well designed box! I guess > you discontinued it because of its analogue processing? Do you have > anything similar using digital processing?
We still do make a couple of other analog dynamics processors, but the trend is increasingly away from single function boxes to multi-function boxes, especially DSP-based programmable ones. (We are primarily in the installed or commercial sound business, so a high level of integration, remote management, flexibility, etc. are key features.) Our DSP boxes incorporate similar compressors.
Jerry, I'm not insisting any particular viewpoint.  All I'm trying to point 
out is that there are two parts to the compressor algorithm.  The part that 
determines the gain (the adaptive part), and the part that actually applies 
this gain to the samples.  Right?

The adaptive part is no big deal to me - there are lots of heuristics to 
decide how to determine the gain.  For every compressor plugin, there are 
twenty different controls.  So, whatever.  I don't care about the adaptive 
part, because I can come up with whatever system I want for that.

All I am trying to understand if is there is a non-linear response to the 
gain on a sample basis.  I already have an simple adaptive system that just 
applies a volume gain on a block by block basis, which works fine, but the 
feel of the sound is different than other compressors.

For example, if view the output of a 3rd party compressor with the settings 
cranked low, so that the compression is on all of the time, then the output 
waveform is *not* lowered in ampliude linearly.  It's more like a 
video-style gamma adjustment where the high values are coming down way more 
than the low values.  This gives the sound a different texture that just 
attenuating the samples.

So, are you saying once the adaptive gain control part of your algorithm is 
done, you just use that value to linearly attenuate the samples?  If so, 
that's all I need to know.

Thanks,

->Jeff

"Jerry Avins" <jya@ieee.org> wrote in message 
news:Cr-dnaG126NXikDfRVn-pA@rcn.net...
> John Smith wrote: > ... > >> Don't let the other answers distract you, those people don't remember the >> days when they were as unsure as you. > > What's that intended to mean? Jeff isn't unsure, he simply doesn't yet > see the difference between modifying the waveforms of individual cycles > and modifying the envelope of a signal. His problem, if any, is that he's > so sure his mistaken concept is real that he can't listen. That'll change > eventually. > > Jerry > -- > Engineering is the art of making what you want from things you can get. > &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
Jeff Roberts wrote:
> Jerry, I'm not insisting any particular viewpoint. All I'm trying to point > out is that there are two parts to the compressor algorithm. The part that > determines the gain (the adaptive part), and the part that actually applies > this gain to the samples. Right? > > The adaptive part is no big deal to me - there are lots of heuristics to > decide how to determine the gain. For every compressor plugin, there are > twenty different controls. So, whatever. I don't care about the adaptive > part, because I can come up with whatever system I want for that. > > All I am trying to understand if is there is a non-linear response to the > gain on a sample basis.
There should be none.
> I already have an simple adaptive system that just > applies a volume gain on a block by block basis, which works fine, but the > feel of the sound is different than other compressors.
You need to care about the adaptive part. Working with blocks is your problem. The gain changes are abrupt. You should work instead with the last (or next) N samples where history either decays, or N stays constant.
> For example, if view the output of a 3rd party compressor with the settings > cranked low, so that the compression is on all of the time, then the output > waveform is *not* lowered in ampliude linearly. It's more like a > video-style gamma adjustment where the high values are coming down way more > than the low values. This gives the sound a different texture that just > attenuating the samples.
It's probably lowered more for loud passages than for soft ones. Removing dynamics changes the "feel" of the music.
> So, are you saying once the adaptive gain control part of your algorithm is > done, you just use that value to linearly attenuate the samples? If so, > that's all I need to know.
Yes
> Thanks,
That's not what I understood you to say until now. To avoid issues of attack time, let's consider the kind of compressor I'd like to see in car radios so one can hear soft passages with a window open without being deafened by loud ones. It's task is to hold a more-or-less constant volume, undoing the dynamics in the program material. Clipping is not an issue. You proposed modifying each sample according to its value or the value of one immediately preceding. That distorts waveforms. You can see immediately that something is wrong when the AGC control can vary as fast as the lowest frequency to be reproduced. You want AGC action not at 44,100 Hz, but at less than 20 Hz. To reiterate what I wrote earlier: AGC acts on the wave's envelope, not on individual cycles. Incidentally, in your block approach, the gain control has high frequencies at the transitions between blocks. Not only does the volume have discrete jumps, but some cycles are distorted. Jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
"Jeff Roberts" <jeffr@radgametools.com> wrote in message 
news:D6idnSprko7IFUPfRVn-oQ@speakeasy.net...
> > So, are you saying once the adaptive gain control part of your algorithm is > done, you just use that value to linearly attenuate the samples? If so, > that's all I need to know.
I think we said yes to that several times in several ways. One of the best posts on that was from Andor earlier in the thread: "A compressor consists of a side chain that analyzes the signal and a gain multiplier in the signal path (main chain). The gain multiplier is updated for each new sample by the side chain (where all the timing and thresholding takes place)." -Andor So yes, it really just it is a simple multiplier, nothing fancy. In the analog world, it was a VCA. In DSP, it is a multiply instruction. Although it is possible that the gain multiplier may change significantly on every sample (i.e. very fast attack).
Jon Harris wrote:

> ... it is > possible that the gain multiplier may change significantly on every sample (i.e. > very fast attack).
When avoiding clipping is not an issue, the gain should not change as fast as the lowest frequency that is to remain unattenuated with steady amplitude. When clipping must be avoided, other forms of distortion are generated and should be filtered. If the AGC control can include a 100 Hz component, 100 Hz in the signal will be suppressed. Jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
On Mon, 18 Jul 2005 10:37:02 -0700, "Jeff Roberts"
<jeffr@radgametools.com> wrote:

>No, ignore the adapting part. I don't care about the running average-ish >stuff (I understand all that <grin>). I'm just talking about the actual >mathematical operation when you decide to limit the signal - is >"compression" a different operation than simple volume attenuation (where >the samples are just multiplied by a 0 to 1 value)?
Compression DOES use "simple volume attentuation" as part of its operation (the other part being the "listening to the signal" [either input or output, depending on design] and deciding what that attentuation should be). I suppose that answers your question.
> >->Jeff
----- http://www.mindspring.com/~benbradley
On Mon, 18 Jul 2005 14:05:25 -0400, Jerry Avins <jya@ieee.org> wrote:

>Jeff Roberts wrote: >> No, ignore the adapting part. I don't care about the running average-ish >> stuff (I understand all that <grin>). I'm just talking about the actual >> mathematical operation when you decide to limit the signal - is >> "compression" a different operation than simple volume attenuation (where >> the samples are just multiplied by a 0 to 1 value)? > >I'm sure you mean something significant to you, but I don't get it. All
I saw his question as simple enough (perhaps too simple), trying to second guess something: "As far as front-panel controls, does compression change the volume control, or does it do something I'm not familiar with?" The answer is: it just changes the volume control.
>you can do with a sample is multiply it by some value before sending it on. > >Changing the multiplier suddenly or often creates distortion, but when >done well, much less distortion than clipping. Keeping the multiplier >small enough so that loud passages don't overload may make the volume of >soft passages so low that they merge with the noise. I'm sure you >understand what adjusting the volume does. Compression reduces the >dynamic range. > >Multiplying samples by either 1 or 0 is the same as turning the signal >on or off.
I at first thought he was saying that too, but I re-read it a couple of times, and he wrote:
>> the samples are just multiplied by a 0 to 1 value)?
^ ^^ ^ That's emphasis under 0 TO 1, indicating he understands it as a constant (or variable) ranging between 0 and 1 inclusively as a multiplier to change the signal level.
>That's not compression, it's censorship.
It's only censorship if it's done by a governmental entity! :)
>Jerry
----- http://www.mindspring.com/~benbradley
On Wed, 20 Jul 2005 10:21:17 -0700, "Jeff Roberts"
<jeffr@radgametools.com> wrote:

>Jerry, I'm not insisting any particular viewpoint. All I'm trying to point >out is that there are two parts to the compressor algorithm. The part that >determines the gain (the adaptive part), and the part that actually applies >this gain to the samples. Right? > >The adaptive part is no big deal to me - there are lots of heuristics to >decide how to determine the gain. For every compressor plugin, there are >twenty different controls. So, whatever. I don't care about the adaptive >part, because I can come up with whatever system I want for that. > >All I am trying to understand if is there is a non-linear response to the >gain on a sample basis. I already have an simple adaptive system that just >applies a volume gain on a block by block basis, which works fine, but the >feel of the sound is different than other compressors. > >For example, if view the output of a 3rd party compressor with the settings >cranked low, so that the compression is on all of the time, then the output >waveform is *not* lowered in ampliude linearly. It's more like a >video-style gamma adjustment where the high values are coming down way more >than the low values. This gives the sound a different texture that just >attenuating the samples.
It sounds like the gain is changing with the waveshape of the low-frequency parts of the signal, not just with the overall envelope. To see why this may not be what you want, go to this page and scroll down to "Why does the RNC distort my bass guitar?": http://fmraudio.com/FAQ.htm While you're at it, you might read on that same page "Is the RNC a peak, average or RMS-sensing compressor?". When he writes "The details of this are very nerdish and boring," what he's really saying is the exact algorithm is a trade secret.
>So, are you saying once the adaptive gain control part of your algorithm is
As others have pointed out, your use of the word adaptive here is a bit misleading to others, who see it as implying more than the average compressor does. Perhaps you could call it 'dynamic' gain control.
>done, you just use that value to linearly attenuate the samples? If so, >that's all I need to know.
Yes.
>Thanks, > >->Jeff
----- http://www.mindspring.com/~benbradley