Hi guys, so ive made a compressor patch from Johannes Kreidler's Loadbang book, but there isnt loads of information about how to use it and how it works. Ive used compressors before, but this is the first time I've made one. The book progresses the patch from a limiter, which when I tested I found worked pretty much how I expected but I'm struggling to understand how I'm supposed to use the compressor. Say I have a signal coming in too quiet and I want to amplify it - what settings do I diall in ? I cant seem to get this behaviour. Have I missed something? Also, what are the threshold, reference and "compression factor" measured in in this case? Any help much appreciated.
compressorJK.pd
-
Need help understanding compression patch
-
@djpersonalspace
a compressor is used to attenuate peaks, so if your incoming signal is simply too quiet, you have to amplify it (what you already have done in the osc subpatch with a multiplier). threshold and reference are both values in dB, while the compression factor is a ratio (1:x), which means, that the audio signal, which exceeds the threshold level will be attenuated / amplified by this ratio towards the reference point. this dpends on, if the reference level is higher (expander) oder lower (compressor) than the audio level. -
@toxonic hey thanks for the explanation. So am I right in saying that with pd a reference of 100 is setting the compressor to push the signal towards 0db rms? Also, how does compression factor relate to compression ratio that you might expect to see on commercial compressors?
Thanks again
-
@djpersonalspace
yeah, approximately (because you always measure a mean dB value with [env] depending on its window size). or exactly, the part of the signal, which exceeds threshold level - in this case, it would works as an upward-expander: the signal below threshold level would be left untouched, while the part of the signal, which exceeds it, will be amplified towards the reference value. a constant sine wave is not really illustrative for this purpose, try it witch a dynamic sample loop. have a look here, i added a small loop sampler abstraction to your patch.
compsampler.zip
in most cases, you will not want to use the compressor like this:
the benefit of a compressor is, that it attenuates peaks above a given threshhold by a given ratio, which at first makes the signal quiter. after the compression, you can then increase the volume again. the effect is, that the mean-loudness of the signal is higher than before compression. this is why most compressors have so calles "makeup" control to adjust the level of the compressed signal. in addition, you could also add a gain control, for the input level.
if you want to use the compressor the usual way, you can simply save on the reference control an put the threshold control in its place, so you have the same level for both parameters. although you wont be able to use it as expander anymore.
the compression factor is pretty much the same as in usual compressors: a factor of 10 is equal to a ratio of 1:10, a factor of 2, would mean 1:2 as ratio.... this means that the level of the signal above the threshold will be halved (towards the threshold level (which the is the equal to the reference level). -
@djpersonalspace Easiest to understand through a drawing.......
The [expr~] sets the threshold and does the ratio calc.
There is a delay to the audio so as to allow the compression to act early enough....... before the signal actually gets through....... would be called "feed forward" in a classic analogue compressor. 100ms is too long. 3ms would be plenty.
Attack and release times are applied with [line~]
There is a "compensation" adjustment in the final volume control...... used a lot for studio compressors..... and often a complete disaster for live work when it is automated according to the ratio.
Not sure what "reference" is......... I will post again when I have worked that one out.
David.
-
@whale-av yeah, that's it!
@djpersonalspace here is a quick-and-dirty version, what could be done, including variable attack and release controls...
comp2.zip -
@djpersonalspace P.S.
This is a good one........ http://www.katjaas.nl/compander/compander.html
Check out her whole site for some of the best things Pd Audio.........
......... and an education in FFT as a bonus.Also....... just noticed you have not amplified the input in your sub-patch. Your fader is set to a range of 0-1. [*~ 1] is no amplification....... your fader will need to be 0-2 to be able to double the signal when the fader is at full.
David. -
by the way, you could still use the patch as an upward-expander, you would only need to use ratio values below 1 (but > 0).
but be careful to avoid horrible clipping: a ratio 0f 0.5 : 1 means, that each signal exceeding the threshold value will be simply doubeld (starting from threshold)...