Understanding and modifying Chris's compressor

I am reading the source of the late Chris Capel’s well reputed compressor.

Are there any constraints on creating derivative works?

Does anyone else here understand the code well?

I found Chris’ own post with a link to his tutorial. But it is stale. Copies?

Old versions?

How do Compressor’s settings map to Chris’ if at all? (I think I understand the theory of Chris’ better than the other.)

Other help?

Someone tells me it is superior to the builtin compressor for narration, but with some deficiencies… challenge accepted.

1.2.6 is the hero version as far as I know. Chris was working on advanced versions when the project stopped. The only shortcoming I know of, and not everybody has the problem, is what to do at the beginnings and ends. Look-Ahead processing is just ducky when there is show before and after the sample point, less so when there isn’t.

I use it as a broadcast compressor simulator. I record the Car Talk radio show once a week. I used to do it off the air and I have quite a few shows in the can like that. I have excellent TV and FM radio reception in Los Angeles. I can see Mt Wilson from here.

http://kozco.com/pix/WilsonTransmitters.jpg

Then the local station started to mess with it and slide promos and announcements into the show in place of show segments. Minnesota Public Radio is the grand champion at this. They hide between two and three segments each week. Of course if you didn’t know they were doing that, you would never figure it out.

“Wasn’t the woman with the exploding Mustang funny?”

“What exploding Mustang?”

So I started to download the podcast which has all the show segments in it. However, the download is basically the studio presentation missing the broadcast compressor. Ray mumbles in his beer and Tom has a laugh that is detectable on Cal Tech seismometers. The shows are unlistenable in the car.

Enter Chris’s compressor. With the first number, Compression Ratio, advanced from the default 0.5 to 0.77, the shows are nearly carbon-copy perfect to the shows as broadcast by KPCC. They are louder, denser and more even, but you can’t quite put your finger on why.

You know if you’ve been in the documentation that Chris designed his software so he could listen to opera in the car. Same problem. Tutti Orchestra and Chorus with Diapason Organ in one instant and single violin in the south forty the next. Unlistenable in the car.

I always said his software sounded so good because he started with cellos and worked up instead of starting with algorithms and working down.

Koz

Someone experienced with it suggested .8, .3, -28, 2, .7 for spoken word, but is stil dissatisfied with behavior at start and end and next to longer pauses. Too much amplification in the latter. Those suggestions came with the caution that we must each tune to our own setups.

I wonder if the hidden advanced settings (exponents, separate attack and decay) might adapt it better to nonmusical all speech recordings. Speech does not have decaying percussive sounds.



;;Version 1.2.6

;;Authored by Chris Capel (> http://pdf23ds.net> )
;;All rights reserved
;;Permission granted for personal use, without redistribution.

so… I must keep improvements to myself?

My understanding:

Define a curve that rides above the peaks of your sound, plotted on the dB axis. The amount by which this curve falls short of 0 dB, multiplied by compression ratio, is the varying amplification. So a curve that hugs the sound closely and a ratio of 1 yields something like uniform volume.

The last of the sliders defines a constant amplification applied as the last step and is not essential to the effect.

First take an approximate envelope by taking peaks of successive windows of 3000 samples, overlapping by a half width. Then smooth out the dips by a method that depends on hardness. Then modify the parts of that curve falling below the floor, according to noise gate falloff. Add to floor the floor minus the smooth curve (a positive dB value) times the gate ratio. Thus -1 does nothing, 0 just flattens the gain in quiet sections, positive values cause background noise to amplify less, extreme enough values can even cause the curve to exceed 0 dB and can make the noise absolutely lower than it was.

The method of smoothing is this: define a function Chris calls a “paraboloid” (I think that word means a surface in 3d, but never mind). This has a quadratic falling part and a quartic rising part meeting at a bottom.

Find rigid translations of that curve that fit on top of the envelope as plotted on the dB axis. The arc of the curve between points where it touches the envelope becomes part of the smooth curve.

Something a bit different happens at the start of the sound that I do not understand yet.

Higher hardness means a narrower paraboloid which thus can follow the envelope more closely, raising sound in shorter dips.

Hidden options can be uncommented, allowing variation of the two exponents of the paraboloid, and separate variation of “attack and release times” (time paraboloid takes to rise and fall between the bottom and 1 dB), instead of one hardness that determines both. Why the particular defaults were chosen must be the result of experience I can’t match. Comments mention earlier unsatisfactory smoothing with straight lines that made compression too hard or too uneven.

So I figured all that out before I tried it! Meanwhile I use the packaged Compressor a lot but do not have a comparable understanding of its details.

I was considering a version of Chris’ with a debug option to plot the curve.



;;Chris’s Dynamic Compressor, version 1.2.7.b1

;; > http://pdf23ds.net/software/dynamic-compressor
;;Copyright (c) 2010 Chris Capel
;;Released under the MIT license. See line 77ish for details.

at around line 77

;;Permission is hereby granted, free of charge, to any person obtaining a copy
;;of this software and associated documentation files (the “Software”), to deal
;;in the Software without restriction, including without limitation the rights
;;to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
;;copies of the Software, and to permit persons to whom the Software is
;;furnished to do so, subject to the following conditions:

;;The above copyright notice and this permission notice shall be included in
;;all copies or substantial portions of the Software.

;;THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
;;IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
;;FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
;;AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
;;LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
;;OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
;;THE SOFTWARE.

I skipped that to get to the good stuff…