Reverse-engineering your compressor

Look at this picture, and this code:

(cond
 ((arrayp s)
  (let*
      ((tiny (db-to-linear -200))
       (ceiling (db-to-linear -0.01))
       (quotient (prod (s-max tiny (s-abs (aref s 0)))
                       (recip (s-max tiny (s-abs (aref s 1))))))
       (left (s-min ceiling quotient))
       (right (s-min ceiling (recip quotient))))
    (vector left right)))
 (t "Stereo sound please!"))

See what I did? Using Audacity’s compressor, but I could do this to examine the behavior of other compressors and limiters too.
tracks003.png

Nice :slight_smile:

By the way, Robert has a nice way of writing a very small number:

1e-15

So compressors with “soft knees” ought to make less angular curves. Does it make a difference to trained ears?

The more gradual the change in gain, the less noticeable it should be. However, we need to make compromises. If a limiter changes the gain over a period of many seconds, then the effect will be virtually imperceptible, however, it will not then be acting as a “limiter”. For a limiter effect we want the gain to change rapidly.

I was using the shortest attack (.1 s) and release (1 s) available in Compressor. The first affects the upward slope of the curve (which are regions of decreasing gain) and the other the downward. Threshold, ratio, and makeup all influence the extremes the curve moves between. Attack and release are the shortest times permitted for moving up or down from one extreme to the other.

I don’t like it how noise is brought up more after quiet words than after loud words.

I know from reading the code, and this diagram confirms, that the effect of noise floor is to make the curve stop falling when sound is low – but it has no effect on just where that curve plateaus, thus noise comes up more, if what preceded noise was under the threshold for nearly a second.

It’s not working like an expander combined with a compressor.

I think that’s a matter of the slopes of the gain curve I plotted, whereas a soft knee means making that slope change continuously when the curve hits its bottom. Is that really important too?