Problem with "standard" stereo compressor circuit?
Been away from this forum for a while, but still having fun with SigmaDSPs :-)
I have encountered a "gotcha" with this standard stereo compressor circuit as found in the AD Toolbox and elsewhere:
To maintain the stereo image, this circuit purportedly responds to whichever of the two input signals is the larger and applies the resulting gain reduction to both channels. It all appears to make complete sense. However...
Say we apply an identical sinewave signal to both input channels, measure the outputs, then mute one of the two inputs. Logically, we would expect the output level of the active channel to remain the same - after all, the "greater than" function ensures that the same signal reaches the compressor's External Control input in both cases.
But what actually happens is that the output level of the active channel goes up by 3dB. Why?
I think it is because the greater-than function is designed to work only with unipolar/integer/control signals and not bipolar/audio signals, i.e. it looks at the DC level rather than the magnitude. So for half of each audio cycle, the zero level of the "dead" input channel is seen as greater than the negative half-cycle of the active signal and is fed through to the compressor control input. Effectively, with one input muted, the remaining active signal is half-wave rectified before being fed to the compressor control input, and that will clearly affect the gain reduction.
Now, maybe I am the last person in the world to notice this but, based on how many times I have seen this circuit cut-and-pasted without any comment, I suspect not. It really does not seem like very desirable behaviour from a stereo compressor.
Fortunately the solution is quite straightforward:
Here, the two signals are rectified to positive-only values by the absolute-value blocks and whichever of the results is higher is allowed to route its associated audio signal through to the compressor control input. With this circuit, muting one input signal has no effect on the level of the other.
Is this a reasonable analysis of the situation?
(I am using an ADAU1701 and Sigmastudio 3.14, BTW)
Audio Signal Processors
SigmaDSP Audio Processors
adau1701
Hello SteveL,
Glad you have been having fun with SigmaDSP.
You definitely hit a "gotcha" on this one! You are definitely correct with the cause. The ">" comparison is a mathematical comparison. So when you mute one of the input signals that input is zero. So when the sine wave goes negative, then 0 is greater than -x so what you are sending to the sidechain is a half wave rectified signal which has half the energy, or half the RMS value, so you will see the output go up 3dB. This is really easy to miss! We both know what you want to do but these dumb computers only do what we tell them to do!
So the trick is to send the comparison block only positive values. So you are correct to use the ABS cells but you do not need to use the ABCD. You can simply use the AB comparison. It will now work fine since all the signals are positive. It will be a few less instructions. Internally in the compressor sidechain input it will rectify the signals anyway so it is fine to send in a rectified signal.
I threw together a project where you can see this all in action at the same time and see the difference. I used a simple summing of the signals then this method of taking the greater of the two. Analog Compressors on the market will be usually one or the other of these methods and they are simply different. I once designed a mix bus compressor and went to extra trouble to sum the sidechain signals so they both would contribute to the compression even if they were slightly different level. I think this is better than "greatest one wins" for compressing mixes, but for compressing background vocals I like the greatest one wins. It holds the level more constant when one note is softer or is missing. Anyhow, I digress...
This is a great observation of an easy mistake to make.
I have attached my project which works on our Mini eval board.
Dave T
Hi Dave,
Thanks for confirming what I thought. Can I humbly suggest, then, that the "incorrect" circuit should not appear in both the SigmaStudio Help file and the SigmaDSP Wiki? At least not without an explanatory note. That implied approval encourages people to use it "with no questions asked" (as I did), and it is easy to miss the anomalous operation because the circuit works exactly as expected all the time both channels are fed with the same signal.
As you say , there are many ways to arrange a compressor with some applications being more fussy than others. My project is for broadcast use and the compressor is followed up by a protective hard clipper, so the issue became very apparent. Muting of one channel would cause the other to hit the clipper, with all the audible effects you would expect!
Thanks also for confirming that an AB comparison would suffice. You have the advantage of knowing how the compressor works internally, but I didn't want to take the risk of feeding the control input a pre-rectified signal without knowing exactly what happens to it inside.
Anyway, it is good to be able to share some insight because I rely on this forum to get me out of trouble at other times :-)
Best regards,
Steve L.
Hello Steve,
Thanks, you are totally right that the example needs to be changed in the help files. I will report that error to the programming team. I missed the detail that you got this example off of the Wiki! So I just changed it. This goes to show you that it is an easy mistake to make.
Meanwhile, You should investigate the RMS limiter. It might do what you need for the final hard clipper rather than use an actual hard clipper. As you noticed, when the hard clipper clips it will produce signals that will alias if not filtered after it.
Recently I found that the RMS Limiter works really well as a brick-wall limiter. Once you set the threshold it will not go above it! It is RMS so I would expect there might be some peaks that get through. I did not experiment with that but you can set the TC to be really fast.
I would be interested to see how this might work for you. I know about your application so I know how important this is.
Dave T
Please log in to reply.







