AudioCompress

AudioCompress is a gentle, 1-band dynamic range compressor intended to keep audio output at a consistent volume without introducing any audible artifacts. It's intended to be used as a pipe in a filter chain, but also works as an ESounD filter, and as a library it can also be embedded into applications such as media players.

Overview

AudioCompress very gently adjusts the audio volume much in the way that the listener would, except without the delay imposed by having to reach for the volume knob. It slowly turns up the volume when it's quiet, and quickly cuts the volume by a perfect amount when it gets louder. By default it maintains about 3dB of headroom (and this is configurable), so that the impact of major peaks is not lost.

Note that AudioCompress is not a normalizer. A normalizer takes an entire audio track and boosts it by the same amount such that the highest peak in the track is "normal" (i.e. at a particular reference power). AudioCompress seeks to make the overall signal level consistent, without removing the dynamic range, and without having to preprocess files. It is quite suitable for adjusting the volume of streaming media or a continuous mix generated on-the-fly.

AudioCompress also differs from a traditional compressor (like what you'd see in a recording studio) in that it also uses the last several seconds' worth of signal in order to adjust the level, rather than using a traditional attack- and ratio-based compression.

Additionally, the AudioCompress library is written in such a way that it is easy to use in other applications. It is also written for speed (while maintaining quality), and as such is suitable for use in embedded systems such as cellular phones and portable media players.

Other systems using AudioCompress

If you are using AudioCompress in another system, I would appreciate hearing about it so I can list it here.

Samples

A simple piano performance with an extreme amount of dynamic range, using the default settings: before, after, and using a traditional compressor

Note that a normalizer would not have much effect on that clip (because of the loud finish), while a traditional compressor all but destroys the dynamic range between the different sections (and adds clipping as well), and would also cause the reverb to get amplified in an uncanny manner. We can see this by looking at the volume profiles of the respective waveforms:

Performance before AudioCompress
Performance after AudioCompress
Performance using a traditional compressor

System requirements

AudioCompress itself will compile and run on any system with the C standard library. It does not directly interface with audio hardware.

Versions 1.5.2 and earlier can also be built as a plugin for XMMS 1.x.

License

AudioCompress is released under the terms of the LGPL. Essentially, this means that you may freely distribute and modify this as long as you make the source available to anyone who has a version you have modified, and you can incorporate the library functions into whatever you want (even commercial/proprietary code) as long as you release any changes to the library itself and let people know that you're using this code.

Reporting Bugs

In the unlikely event that you find a bug, feel free to report it over at the bug tracker.

Download

Current version

Although changes are very rarely made to AudioCompress, you can always get the most current code by checking out AudioCompress from git:
git clone http://git.beesbuzz.biz/AudioCompress.git/
You can also get it on github.

Released version

v2.0 (2007/08/11) - Pretty much a complete rewrite. XMMS plugin and monitor window are gone, library is now much more embeddable. It's amazing how one's perspective on programming changes after being a professional software engineer for several years after writing a quick hack as a grad student.

Previous versions

v1.5.2 (2004/10/19) - Finally got around to adding a : to the getopt() in main(), closing an outstanding bug report from September 29.

v1.5.1 (2004/03/26) - Fixed a bug which was affecting newer versions of xmms due to an undocumented change in their undocumented plugin API

v1.5 (2003/07/05) - Added esd plugin functionality, and fixed a couple of stupid bugs

v1.4 (2003/05/31) - Beefed up the build environment and allowed an X-less build

v1.3 (2003/04/04) - Finally added commandline configuration to the pipeline version

v1.2.1 (2003/03/06) - Fixed a stupid bug in CompressFree()

v1.2 (2003/02/23) - Changed name to AudioCompress, and provide a commandline piping version as well

Before version 1.2, it was known as xmms-compress.

v1.1 (2002/07/31) - Some pretty big bugfixes in the preferences code, and lots of README cleaning-up and so on.

v1.0 (2002/07/09) - Thanks to Javier Conde Rueda, there is finally runtime configuration. Yay!

v0.4 (2002/06/24) - Added OSX build environment (through alternate Makefile), minor algorithm tweaks, even better default configuration to take advantage of this

v0.3 (2002/04/21) - Improved the documentation, monitor window, and default configuration

v0.2 (2002/04/18) - Improved the documentation and build procedure, added some various tweaks to the normalization algorithm, added some stuff to the monitor

v0.1 (2002/04/18) - Initial release