About the compressors
-
- KVRian
- 1223 posts since 11 Aug, 2004 from France
Hi everybody !
I have used a lot the search function on the kvr forums and music-dsp archive to understand better how a compressor works. I think I have learned the basics, but there are still some points which seems too much dark for me...
A simple compressor works with an envelope detector, performed with a Low pass filtering (on the signal's absolute values ?), and some other formulas depending of the needs (RMS calculation, linear to dB conversion...). Then, the mean value of the envelope is checked to know if the signal must be compressed or not. And the attenuation is calculated...
The things I don't understand too much are about the attack/release dependance... Many ways to implant them are existing, the only important thing is how it sounds. But I want to know if I have understand everything : I have seen two ways, filtering the enveloppe with a cutoff frequency dependant of the attack/release length (frequency is just the period's inverse) or delaying the envelope of the attack/release length. There are two envelopes, one for each parameter, one to check if the compression must be put on, the other to bypass the compression. Am I right ?
An other thing I have seen is how to implant the "soft/hard knee" feature. Apparently, the soft knee is done by processing the envelope from the output instead of the input... What do you think of it ?
Thanks for the help !
I have used a lot the search function on the kvr forums and music-dsp archive to understand better how a compressor works. I think I have learned the basics, but there are still some points which seems too much dark for me...
A simple compressor works with an envelope detector, performed with a Low pass filtering (on the signal's absolute values ?), and some other formulas depending of the needs (RMS calculation, linear to dB conversion...). Then, the mean value of the envelope is checked to know if the signal must be compressed or not. And the attenuation is calculated...
The things I don't understand too much are about the attack/release dependance... Many ways to implant them are existing, the only important thing is how it sounds. But I want to know if I have understand everything : I have seen two ways, filtering the enveloppe with a cutoff frequency dependant of the attack/release length (frequency is just the period's inverse) or delaying the envelope of the attack/release length. There are two envelopes, one for each parameter, one to check if the compression must be put on, the other to bypass the compression. Am I right ?
An other thing I have seen is how to implant the "soft/hard knee" feature. Apparently, the soft knee is done by processing the envelope from the output instead of the input... What do you think of it ?
Thanks for the help !
-
- KVRist
- 189 posts since 29 May, 2005 from Rennes, France
Coucou WolfenWolfen666 wrote:A simple compressor works with an envelope detector, performed with a Low pass filtering (on the signal's absolute values ?), and some other formulas depending of the needs (RMS calculation, linear to dB conversion...). Then, the mean value of the envelope is checked to know if the signal must be compressed or not. And the attenuation is calculated...
In fact, you can use various enveloppe detector: half wave rectifier (you take only positive values of the signal) + lowpass, full wave rectifier (absolute value) + lowpass, or squared wave + lowpass. If I remember correctly, in the last case you get the RMS level and in the first 2 cases you should get the peak level.
It could be understood simply. If you want to estimate the level of a sinusoidal wave without performing a FFT (correlation with another sinusoidal wave), you could rectify the wave. Then, the average value of the rectified wave is equal to sqrt(2) times the peak value (amplitude) of the wave. The avering is obtained by a lowpass filter in a compressor, the time constant for the averaging correspond to the attack/release times.
Soft/hard knee is related to the way you perform the compression depending on the level out of your enveloppe detector: you may use a single threshold to compress or not (hard knee), or use a curved reaction near threshold (soft knee).
I can't help you for the other questions
-
- KVRian
- Topic Starter
- 1223 posts since 11 Aug, 2004 from France
Salut zieQ
(arf these frenchies are everywhere
)
You have answered nearly to all of my questions ! And you have put the digit exactly at the place which is problematic for me :
You have answered nearly to all of my questions ! And you have put the digit exactly at the place which is problematic for me :
What means the "time constant" ? It is about the cutoff frequency, the Q of the filter ?The avering is obtained by a lowpass filter in a compressor, the time constant for the averaging correspond to the attack/release times.
-
- KVRist
- 189 posts since 29 May, 2005 from Rennes, France
Sorry, i was not clear. I made an analogy with electronics, where the time constant of a RC lowpass filter is tau = RC, and correspond to the time for the condenser to charge to 66% of the total applied voltage. The corresponding cutoff frequency of the filter is then defined as 1 / (2 * pi * tau). In fact, the time constant is the time used the summation/integration in the avering process, so it is inversely proportionnal to the frequency of the filter.Wolfen666 wrote:What means the "time constant" ? It is about the cutoff frequency, the Q of the filter ?
- KVRian
- 1141 posts since 2 Oct, 2001 from Berlin, Germany
What you describe is so-called feed-back compression, like those on gear such as the 1176/78 or LA2A (most older opto-electric comps were FB devices). Taking the output as reference leads to a semi-automatic compression, be it slope- or envelope-wise. The faster the envelope, the more the slope goes from compression to limiting. This especially applies to a limiting device like the 1176 in the 1:20 or even all-button mode, as the device has to perform negative reduction (1:-n) in order to achieve sort of a 1:inf slope with the FB signal (as the system gain is less than 1). Transients lead to 1:-n while steady state might be well over 1:inf.Wolfen666 wrote: An other thing I have seen is how to implant the "soft/hard knee" feature. Apparently, the soft knee is done by processing the envelope from the output instead of the input... What do you think of it ?
So, feed-back compression is more than just plain soft knee. It's 'gain riding' in a very signal-dependent fashion, but very hard to predict and to push into precise directions.
Of course that depends on what you do with the detector's signal. Having a FET as the gain-control element (as a voltage divider), for instance, the slope is highly dependent on its transfer characteristics. E.g., the FET's saturation area greatly limits the point where 1:-n compression would exceed a certain point.
If you follow an ordinary feed-forward design, a soft knee slope can easily be implemented having a lookup table with a hard-knee slope and applying a LP filter over the values. You have to run the LP both directions, but it works fine and you can control the knee just by tuning the cutoff.
Sascha Eversmeier [formerly digitalfishphones]
TOURAGE DSP
croquesolid drum processor- mix real drums fast & focused
TOURAGE DSP
croquesolid drum processor- mix real drums fast & focused
-
- KVRian
- Topic Starter
- 1223 posts since 11 Aug, 2004 from France
zieQ > OK that's what I thought, as I said frequency is just the inverse of a period, thanks for the information
sascha > so feedback compression seems to be interesting, but it's not really the simplest way to implant a soft knee fonctionnality.
Let's say I have my two envelopes tuned correctly with a LP filter by the attack/release parameters. When I detect on the attack envelope I must compress the signal, I apply on it an attenuation, dependant of the difference between the threshold and the amplitude of the envelope. That's the "hard knee design". Do you mean I have to filter again my envelope to get the soft-knee design ? I don't get it...
sascha > so feedback compression seems to be interesting, but it's not really the simplest way to implant a soft knee fonctionnality.
Arf again I don't understandIf you follow an ordinary feed-forward design, a soft knee slope can easily be implemented having a lookup table with a hard-knee slope and applying a LP filter over the values. You have to run the LP both directions, but it works fine and you can control the knee just by tuning the cutoff.
- KVRian
- 1141 posts since 2 Oct, 2001 from Berlin, Germany
Forget about the envelope for a moment. I was just talking about the static in/out slope. Question is, where do you take that from? A simple 'if (input > threshold)' doesn't apply here. One solution could be a waveshaper. Another possible way could be the table I was talking about. You can easily fill such with whatever hard-knee function you want (even add multiple points if you like). The filtering then takes place over all the table's values in order to achieve a smooth curve. Get it?Wolfen666 wrote: Arf again I don't understandLet's say I have my two envelopes tuned correctly with a LP filter by the attack/release parameters. When I detect on the attack envelope I must compress the signal, I apply on it an attenuation, dependant of the difference between the threshold and the amplitude of the envelope. That's the "hard knee design". Do you mean I have to filter again my envelope to get the soft-knee design ? I don't get it...
Sascha Eversmeier [formerly digitalfishphones]
TOURAGE DSP
croquesolid drum processor- mix real drums fast & focused
TOURAGE DSP
croquesolid drum processor- mix real drums fast & focused
-
- KVRian
- Topic Starter
- 1223 posts since 11 Aug, 2004 from France
I was still on the "if (input > threshold)", everything is OK now
Thanks for the explanation !
(and I have just seen you are the developper of digitalfishphones, your plug-ins are really excellent
)
(and I have just seen you are the developper of digitalfishphones, your plug-ins are really excellent
-
- KVRAF
- 4738 posts since 20 Feb, 2004 from Gothenburg, Sweden
sascha: is there anything "wrong" with having non-static time settings for the envelope detector when using opto-compression? 
And oh, my compressor ( http://www.kvraudio.com/forum/viewtopic ... highlight= ) is heavily influenced by endorphin, which until I started making my own was my go-to compressor, even on the main bus
And oh, my compressor ( http://www.kvraudio.com/forum/viewtopic ... highlight= ) is heavily influenced by endorphin, which until I started making my own was my go-to compressor, even on the main bus
Stefan H Singer
https://dropshotaudio.com/
https://dropshotaudio.com/
- KVRian
- 1141 posts since 2 Oct, 2001 from Berlin, Germany
Surely not. Indeed, riding the gain in FB mode tends to be highly musical. I've spent much time over that while developing the am|track for Samplitude. Since then, I feel so biased that I tend to dislike feed-forward comps and static envelopes... I've even turned my gig comp (a Behringer Composer) into a FB unitstefancrs wrote:sascha: is there anything "wrong" with having non-static time settings for the envelope detector when using opto-compression?
Mycket brastefancrs wrote:And oh, my compressor ( http://www.kvraudio.com/forum/viewtopic ... highlight= ) is heavily influenced by endorphin, which until I started making my own was my go-to compressor, even on the main bus
Sascha Eversmeier [formerly digitalfishphones]
TOURAGE DSP
croquesolid drum processor- mix real drums fast & focused
TOURAGE DSP
croquesolid drum processor- mix real drums fast & focused
-
- KVRist
- 415 posts since 8 Dec, 2003 from NYC (born & raised in Philly)
man, these compressor threads show up all the time around here. it's like everyone and their mama wants to write a compressor plugin! 
which is why i wrote the SimpleComp class a while ago, as part of the SimpleSource library.
it's a pretty basic feed-forward design, and the runtime function is well documented, so it should provide you with a good start. (IMHO, you should focus on the very simple feed-forward designs before tackling the intricacies of feed-back designs.)
enjoy! and good luck.
== chunk
which is why i wrote the SimpleComp class a while ago, as part of the SimpleSource library.
it's a pretty basic feed-forward design, and the runtime function is well documented, so it should provide you with a good start. (IMHO, you should focus on the very simple feed-forward designs before tackling the intricacies of feed-back designs.)
enjoy! and good luck.
== chunk
-
Music Engineer Music Engineer https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=15959
- KVRAF
- 4380 posts since 8 Mar, 2004 from Berlin, Germany
which is also the reason why i did my compressor. maybe it's because the compressor is such a basic effect, that everybody feels to implement it on his/her owncitizenchunk wrote:man, these compressor threads show up all the time around here. it's like everyone and their mama wants to write a compressor plugin!
which is why i wrote the SimpleComp class a while ago, as part of the SimpleSource library.
-
- KVRian
- Topic Starter
- 1223 posts since 11 Aug, 2004 from France
Thanks to everybody 
-
- KVRAF
- 4738 posts since 20 Feb, 2004 from Gothenburg, Sweden
Hm. Is there any way to do opto expansion as well? You can't really do it the "straight forward" way since you don't have a "goal dB" and hence will just end up doing endless expansion (increasing the distance from the threshold over and over again).sascha wrote:Surely not. Indeed, riding the gain in FB mode tends to be highly musical. I've spent much time over that while developing the am|track for Samplitude. Since then, I feel so biased that I tend to dislike feed-forward comps and static envelopes... I've even turned my gig comp (a Behringer Composer) into a FB unitstefancrs wrote:sascha: is there anything "wrong" with having non-static time settings for the envelope detector when using opto-compression?
Mycket brastefancrs wrote:And oh, my compressor ( http://www.kvraudio.com/forum/viewtopic ... highlight= ) is heavily influenced by endorphin, which until I started making my own was my go-to compressor, even on the main bus
edit: should one let the resulting level reduction/boost affect the envelope times instead of just letting the output go into the level detector?
Stefan H Singer
https://dropshotaudio.com/
https://dropshotaudio.com/
-
- KVRAF
- 3080 posts since 17 Apr, 2005 from S.E. TN
Stephan, it is difficult to characterize an 'opto' response unless you pick out a particular device to study (or just make up some hypothetical device with certain characteristics).
There have been many opto compressor designs since the dawn of broadcast radio and talkie movies. The earliest schematics I've seen (I've not ever seen the actual early units), used an incandescent lamp as modulation light source, and an opto-tube as the gain stage.
Other light sources have included electroluminescent panels and LED's (both visible light and infrared).
Many modern opto compressors have used CDS cells (cadmium sulfide photoresistors) as gain stage.
You can wire the CDS as a resistive divider to get one 'character' of modulation-vs-gain, or you can wire the CDS as a negative feedback element in an opamp circuit to get a slightly different 'character' of modulation-vs-gain (assuming you use the same kind of CDS cell in both circuits).
Obviously Electroluminescent panels and LED's respond faster to input signal changes than an incandescent lamp. It is reasonable to expect that the different devices might have different light-output-vs-voltage-input characteristics.
I've never toyed with photo-responsive electron tubes, but will guess that those devices were usually very fast responding, but maybe thats a bad guess.
CDS cells can be designed with amazing variety of response characteristics. I haven't looked at spec sheets for a decade, but unless a lower market for CDS cells has restricted the available variety, you can order about any kind of response characteristics you want, from very fast-responding devices, to very slow-responding devices.
Many simple opto compressors might use the 'light-on' threshold voltage of an electroluminescent panel or LED to get a 'free' threshold setting. Below a certain threshold voltage, many light devices are completely off. In the case of an opto comp with an incandescent light source, you get a slow attack-release envelope for free just by the thermal lag in the light bulb. But if you choose a different model of light bulb, perhaps the envelope characteristics would significantly change without changing any other circuit elements.
Many simple opto compressors choose medium-attack, long-release CDS cells, so that a fast light source like an LED, is smoothed out by the nature of the CDS cell, so you don't have to worry about any envelope control circuitry. Just full-wave-rectify the output signal and directly drive an LED. The CDS cell's response lag provides the envelope. With such a simple circuit, you change the envelope response by picking a different model of CDS cell from the manufacturer's list.
If you want to 'take more control' over an opto design, you could specify a very fast response CDS cell, and do electronic envelope processing before you drive the LED. That way, the knob settings in your LED drive circuit determine the attack and release, rather than the CDS cell itself.
Hardly any CDS optoisolators have a linear control range. If the LED drive current doubles, the resistance doesn't cut in half. And if you double the LED drive current again, the resistance won't change the same percentage step that the first current-doubling caused. And since you are driving the optoisolator from the output of the circuit, you have this time-lagging non-linear gain element in a feedback loop to make it even more difficult to predict.
Sorry for the long message. Just pointing out that if someone is talking about an opto's 'characteristics', maybe they are talking about a particular famous compressor, but you could have many different responses out of an opto compressor, depending on design and individual components.
=====
Ooops, almost forgot. Re changing the envelope times-- Many CDS cells have a memory effect. For instance, you might find a CDS cell that 'mostly recovers' in 100 ms if you hit it with a brief blip of light, but it might take 500 ms or longer to recover from a sustained period of light.
So if modeling such a device, it would be the right direction to make the release longer with sustained loud passages of music, and make the release shorter with short loud passages of music.
There have been many opto compressor designs since the dawn of broadcast radio and talkie movies. The earliest schematics I've seen (I've not ever seen the actual early units), used an incandescent lamp as modulation light source, and an opto-tube as the gain stage.
Other light sources have included electroluminescent panels and LED's (both visible light and infrared).
Many modern opto compressors have used CDS cells (cadmium sulfide photoresistors) as gain stage.
You can wire the CDS as a resistive divider to get one 'character' of modulation-vs-gain, or you can wire the CDS as a negative feedback element in an opamp circuit to get a slightly different 'character' of modulation-vs-gain (assuming you use the same kind of CDS cell in both circuits).
Obviously Electroluminescent panels and LED's respond faster to input signal changes than an incandescent lamp. It is reasonable to expect that the different devices might have different light-output-vs-voltage-input characteristics.
I've never toyed with photo-responsive electron tubes, but will guess that those devices were usually very fast responding, but maybe thats a bad guess.
CDS cells can be designed with amazing variety of response characteristics. I haven't looked at spec sheets for a decade, but unless a lower market for CDS cells has restricted the available variety, you can order about any kind of response characteristics you want, from very fast-responding devices, to very slow-responding devices.
Many simple opto compressors might use the 'light-on' threshold voltage of an electroluminescent panel or LED to get a 'free' threshold setting. Below a certain threshold voltage, many light devices are completely off. In the case of an opto comp with an incandescent light source, you get a slow attack-release envelope for free just by the thermal lag in the light bulb. But if you choose a different model of light bulb, perhaps the envelope characteristics would significantly change without changing any other circuit elements.
Many simple opto compressors choose medium-attack, long-release CDS cells, so that a fast light source like an LED, is smoothed out by the nature of the CDS cell, so you don't have to worry about any envelope control circuitry. Just full-wave-rectify the output signal and directly drive an LED. The CDS cell's response lag provides the envelope. With such a simple circuit, you change the envelope response by picking a different model of CDS cell from the manufacturer's list.
If you want to 'take more control' over an opto design, you could specify a very fast response CDS cell, and do electronic envelope processing before you drive the LED. That way, the knob settings in your LED drive circuit determine the attack and release, rather than the CDS cell itself.
Hardly any CDS optoisolators have a linear control range. If the LED drive current doubles, the resistance doesn't cut in half. And if you double the LED drive current again, the resistance won't change the same percentage step that the first current-doubling caused. And since you are driving the optoisolator from the output of the circuit, you have this time-lagging non-linear gain element in a feedback loop to make it even more difficult to predict.
Sorry for the long message. Just pointing out that if someone is talking about an opto's 'characteristics', maybe they are talking about a particular famous compressor, but you could have many different responses out of an opto compressor, depending on design and individual components.
=====
Ooops, almost forgot. Re changing the envelope times-- Many CDS cells have a memory effect. For instance, you might find a CDS cell that 'mostly recovers' in 100 ms if you hit it with a brief blip of light, but it might take 500 ms or longer to recover from a sustained period of light.
So if modeling such a device, it would be the right direction to make the release longer with sustained loud passages of music, and make the release shorter with short loud passages of music.
Last edited by JCJR on Fri May 12, 2006 3:49 pm, edited 2 times in total.
