[PD] Building a compressor in PD?

Mathieu Bouchard matju at artengine.ca
Wed Nov 28 13:45:55 CET 2007

On Tue, 27 Nov 2007, Vreahli the Audio Bandit wrote:

> Heya - I'm just curious - is it even possible to build a compressor in 
> PD without coding it in C? The only way I can think of getting the 
> overall loudness of a signal is by checking audio rate stuff - which 
> won't work with control rate values. Just a curiosity. :)

You can square your signal using [*~] or other, to turn 
square-of-amplitude into DC. Then you can low-pass this with [lop~] or 
other, in order to get a moving average that is smoothly decaying. You can 
use this measurement of loudness (or any adjusted version of it) to 
control some waveshaping function or just another [*~].

If you just want a quick smooth clipping, try these:

   [expr atan($v1*1.57079)/1.57079] (trigonometric clipping)
   [expr tanh($v1)]                 (hyperbolic clipping)
   [expr erf($v1)]                  (gaussian clipping)

All three do no gain on quiet sounds, but clip them in different ways when 
they get louder.

  _ _ __ ___ _____ ________ _____________ _____________________ ...
| Mathieu Bouchard - tél:+1.514.383.3801, Montréal QC Canada

More information about the Pd-list mailing list