Main Archive Specials Wiki | FAQ Links Submit Forum

Simple Compressor class (C++)

Type : stereo, feed-forward, peak compressor
References : Posted by Citizen Chunk
Linked file :

Notes :
Everyone seems to want to make their own compressor plugin these days, but very few know where to start. After replying to so many questions on the KVR Dev Forum, I figured I might as well just post some ready-to-use C++ source code.

This is a C++ implementation of a simple, stereo, peak compressor. It uses a feed-forward topology, detecting the sidechain level pre-gain reduction. The sidechain detects the rectified peak level, with stereo linking to preserve imaging. The attack/release uses the EnvelopeDetector class (posted in the Analysis section).

- Make sure to call initRuntime() before processing starts (i.e. call it in resume()).
- The process function takes a stereo input.
- VST params must be mapped to a practical range when setting compressor parameters. (i.e. don't try setAttack( 0.f ).)

(see linked files)


Added on : 25/11/05 by tl_163[ AT ]hotmail[ DOT ]com
Comment :
This code works perfectly, and I have tried a number of sound and each worked correctly. The conversion is linear in logarithm domain.

The code has been written in such a professional style, can not believe it is FREE!!

Keep it up. Two super huge thumbs up.


Added on : 09/12/05 by scuzzphut[ AT ]gmail[ DOT ]com
Comment :
source file seems to be down :-(
anyone have a local copy ???              

Added on : 07/02/06 by citizenchunk[ at ]chunkware[ dot ]com
Comment :
there are some updates: mainly, there is now a SimpleGate class, which implements a simple gate. other than that, minor changes to the code -- but all public functions should work the same.


Added on : 28/02/06 by jinjing20012001[ AT ]yahoo[ DOT ]com
Comment :
hello everybady!
I am a Chinese student, I want to download the code from  but because  the server can not do his job well,I have no chance to download the code.I really hope kind people who have been have the code can tansfer a copy to me!I will be appreciated very much.
my emial is listed as following:
I am looking for your reply as soon as possible.

Added on : 08/05/06 by citizenchunk[ at ]chunkware[ DOT ]com
Comment :
sorry about the link. the new source is at

Added on : 12/03/08 by ben[ AT ]benvesco[ DOT ]com
Comment :

This code has been missing for some time at the posted locations. I found someone with a copy and am now mirroring these files for download on my server. I believe the software license allows this mirroring. The code is unchanged and belongs to the original owner.

Added on : 15/08/11 by jed_hubic[ AT ]yahoo[ DOT ]com
Comment :
Thank you Ben! This help me wrap my head around DSP a bit more. It's a shame this site is essentially dead...              

Added on : 15/04/12 by thewjew[ AT ]gmail[ DOT ]com
Comment :
            is this code still available?  

Added on : 23/04/12 by christian[ DOT ]schragen[ AT ]gmail[ DOT ]com
Comment :
I'm new in programming. how do I embed this code to my project? vst sdk is already loaded from the steinberg developer site. can somebody give me a step by step guide?

Added on : 24/05/13 by jamie[ AT ]jamiebullock[ DOT ]com
Comment :
It loos like the Chunkware code can now be found on GitHub:

Added on : 29/01/14 by mike[ AT ]mikegazzaruso[ DOT ]com
Comment :
              Hi, may i know the range of values to set in SimpleComp? Expecially those for Threshold and Ratio. I set them to 2 and -30 but my sound get incredibly distorted after that. Thanks.

Add your own comment
Comments are displayed in fixed width, no HTML code allowed!


Are you human?

Site created and maintained by Bram
Graphic design by line.out | Server sponsered by fxpansion