DSPRelated.com
Forums

basic compressor question

Started by Jeff Roberts July 18, 2005
So, if we ignore the adaptive portion of a compressor, what is the 
difference between compression and just volume attenuation?  Is it just that 
the amount of attenuation per sample in a compressor is based on value of 
the sample itself?

->Jeff
 


Jeff Roberts wrote:
> So, if we ignore the adaptive portion of a compressor, what is the > difference between compression and just volume attenuation?
The part you choose to ignore.
> Is it just that > the amount of attenuation per sample in a compressor is based on value of > the sample itself?
No. It is based on a running average of sorts. The exact sort determines the characteristic of a particular compressor. Most initiate compression rapidly to avoid overload and relax it slowly to improve naturalness. Good ones do not increase the gain when the signal is below some threshold in order to avoid making background noise prominent. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
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)?

->Jeff

"Jerry Avins" <jya@ieee.org> wrote in message 
news:vOednZVW1udYe0bfRVn-hg@rcn.net...
> Jeff Roberts wrote: >> So, if we ignore the adaptive portion of a compressor, what is the >> difference between compression and just volume attenuation? > > The part you choose to ignore. > >> Is it just that the amount of attenuation >> per sample in a compressor is based on value of the sample itself? > > No. It is based on a running average of sorts. The exact sort determines > the characteristic of a particular compressor. Most initiate compression > rapidly to avoid overload and relax it slowly to improve naturalness. Good > ones do not increase the gain when the signal is below some threshold in > order to avoid making background noise prominent. > > 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:
> 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 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. That's not compression, it's censorship. 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:
> 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)?
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). You can have a look at this manual of a digital audio compressor unit (800kB PDF file): http://www.weiss.ch/ds1/images/DS1-MK2_Manual%20V2_0%20E.PDF On page 8 you can see the main block diagram of the compressor. The following pages contain more block diagrams and schematics that might help you to understand the processing taking place in the unit. In the addendum to the manual you find some actual measurements that display how the different timing constants affect the gain multiplier. HTH, Andor
Yes, compression is gain contorl which can be implemented in DSP by
multiplication.  You would multiply the data sequence that represents
the signal be a relativley slowly changing gain control value.  In DSP
the gain control element or VCA is simply multiplication.

The interesting questions about compressors are how the gain control
value should change in response to the signal.  Key wrods are attack
time, decay time threshold.   


Mark

OK, I'm asking my question poorly.  Let me start over.

A compressor doesn't have to have any adaptive-ness at all.  A compressor 
doesn't even imply that - that's only if you have an _adaptive_ compressor. 
All the compression does in a compressor is move the samples closer 
together.  I know most compressors are adaptive, but I don't care about 
that. I don't care about adapting to the signal! <grin>

What I'm trying to isolate is the difference between volume attenuation of a 
block of sound and compression over a block of sound.

In volume attenuation, you have a scalar from 0 to 1 (not 0 or 1, as someone 
thought before), that you multiply each sample by.  So, if you have 0.5 as 
your volume scalar, then all the amplitudes drop in half, and your audio is 
6 db lower.  So, new_sample = old_sample * volume_scalar.

In a compressor, you have a gain scalar which is also applied across the 
buffer, but this isn't a simple multiplication since you are attenuating 
non-linearly.  So, the formula would be something like new_sample = exp( 
log(old_sample)*gain ), but I'm not sure.  _That's_ what I'm curious about - 
what is the actual compression operation, once you know the gain that you 
want to use.

->Jeff

"Mark" <makolber@yahoo.com> wrote in message 
news:1121721637.736099.109920@g49g2000cwa.googlegroups.com...
> > Yes, compression is gain contorl which can be implemented in DSP by > multiplication. You would multiply the data sequence that represents > the signal be a relativley slowly changing gain control value. In DSP > the gain control element or VCA is simply multiplication. > > The interesting questions about compressors are how the gain control > value should change in response to the signal. Key wrods are attack > time, decay time threshold. > > > Mark >
Jeff Roberts wrote:
> OK, I'm asking my question poorly. Let me start over. > > A compressor doesn't have to have any adaptive-ness at all. A compressor > doesn't even imply that - that's only if you have an _adaptive_ compressor. > All the compression does in a compressor is move the samples closer > together. I know most compressors are adaptive, but I don't care about
I guess you have to try it to see how terrible it sounds. Either that, or think about the shape that an input sinewave would come out as. There are devices that do what you think you want, but they are used for transmission and the original signal is restored at the receiving end. A- and mu-law encoders, used in telephony, are examples.
> What I'm trying to isolate is the difference between volume attenuation of a > block of sound and compression over a block of sound.
The setting of the "volume control" is constant in an attenuator, and varies to keep the amplitude relatively constant in a compressor.
> In volume attenuation, you have a scalar from 0 to 1 (not 0 or 1, as someone > thought before), that you multiply each sample by. So, if you have 0.5 as > your volume scalar, then all the amplitudes drop in half, and your audio is > 6 db lower. So, new_sample = old_sample * volume_scalar. > > In a compressor, you have a gain scalar which is also applied across the > buffer, but this isn't a simple multiplication since you are attenuating > non-linearly. So, the formula would be something like new_sample = exp( > log(old_sample)*gain ), but I'm not sure. _That's_ what I'm curious about - > what is the actual compression operation, once you know the gain that you > want to use.
That's barking up the wrong tree. 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;
Jerry Avins wrote:

   ...

> That's barking up the wrong tree.
Your proposal modifies the waveform. A compressor leaves the waveform substantially unchanged, but modifies the envelope. 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;

Jerry Avins wrote:
> Jerry Avins wrote: > > ... > > > That's barking up the wrong tree. > Your proposal modifies the waveform. A compressor leaves the waveform > substantially unchanged, but modifies the envelope. > > Jerry > -- > Engineering is the art of making what you want from things you can get. > =AF=AF=AF=AF=AF=AF
=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF= =AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF= =AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF Jeff, they key point you are missing is that the compresser chanes gain slowly over many samples. The gain of each sample is not determined just by that sample alone but also by many samples before it and perhaps after it as well. Yes compression is just attenuation, but it is atteniuation that changes automatically but slowly over many samples, not on a sample to sample basis. Mark