Frank,

I attach a simple compressor that I made, it is doing most of its calculations
in dB. This one doesn't have the nonlinear compression below the
threshold as yours and for simplicity I left out the delay, also
the attack and decay calculations are simplified. I use it for teaching, so I think the calculations for the compression factor are pretty clear and intuitive.

Günter


Frank Barknecht wrote:
Hallo,
Frank Barknecht hat gesagt: // Frank Barknecht wrote:

I'm trying to build a pure-Pd compressor/limiter effect.

Attached is a slightly better version, which now uses a snapshot~ to
get the current gain, which then is compared to the target gain to
calculate the next gain. Now it seems to be possible to actually
compress audio with it, if you set a low threshold (~ 0.2), a sharp
attack (~1ms), and comp1 to some small value (or 1/comp1 to a large
one) while keeping comp1 at 1.

Testing and comments would be cool!

Ciao
------------------------------------------------------------------------

_______________________________________________
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list

#N canvas 83 0 855 414 10;
#X obj 270 107 - 80;
#X floatatom 270 62 5 0 0 0 - - -;
#X obj 270 131 moses 0;
#X obj 316 154 / 4;
#X floatatom 354 69 5 0 0 2 tresh - -;
#X floatatom 402 68 5 1 100 2 ratio - -;
#X obj 316 175 + 80;
#X obj 316 196 -;
#X obj 316 237 dbtorms;
#X floatatom 316 257 8 0 0 0 - - -;
#X obj 316 216 + 100;
#X obj 270 81 t f f;
#X obj 354 15 inlet;
#X obj 402 14 inlet;
#X msg 270 255 1;
#X text 203 160 linear;
#X obj 270 315 outlet;
#X obj 270 23 inlet;
#X text 318 108 calculate the compression factor;
#X text 354 153 apply the ratio;
#X text 341 130 compress if we are over 0;
#X text 351 196 get the difference in level to the original;
#X text 370 218 convert dB to factor (in pd 0 dB == 100);
#X connect 0 0 2 0;
#X connect 1 0 11 0;
#X connect 2 0 14 0;
#X connect 2 1 3 0;
#X connect 3 0 6 0;
#X connect 4 0 0 1;
#X connect 4 0 6 1;
#X connect 5 0 3 1;
#X connect 6 0 7 0;
#X connect 7 0 10 0;
#X connect 8 0 9 0;
#X connect 9 0 16 0;
#X connect 10 0 8 0;
#X connect 11 0 0 0;
#X connect 11 1 7 1;
#X connect 12 0 4 0;
#X connect 13 0 5 0;
#X connect 14 0 16 0;
#X connect 17 0 1 0;
#N canvas 247 457 613 464 10;
#X obj 90 417 dac~;
#X obj 184 68 random 100;
#X obj 115 161 *~;
#X obj 183 134 vline~;
#X msg 183 112 \$1 20 \, 0 200 10;
#X obj 184 47 metro 500;
#X msg 184 24 bang;
#X floatatom 116 36 5 0 0 0 - - -;
#X obj 116 66 osc~ 110;
#X floatatom 224 202 5 1 100 2 ratio - -;
#X floatatom 179 201 5 0 100 2 thresh - -;
#X obj 184 91 / 100;
#X obj 114 373 *~;
#X obj 136 329 line~;
#X obj 136 253 moses 1;
#X obj 136 297 pack 0 20;
#X obj 212 299 pack 0 200;
#X obj 136 199 env~;
#X obj 136 229 compress;
#X floatatom 273 202 5 0 0 2 attack - -;
#X floatatom 323 202 5 0 0 2 decay - -;
#X text 297 69 compress: calculate compression ratio;
#X connect 1 0 11 0;
#X connect 2 0 12 0;
#X connect 2 0 17 0;
#X connect 3 0 2 1;
#X connect 4 0 3 0;
#X connect 5 0 1 0;
#X connect 6 0 5 0;
#X connect 7 0 8 0;
#X connect 8 0 2 0;
#X connect 9 0 18 2;
#X connect 10 0 18 1;
#X connect 11 0 4 0;
#X connect 12 0 0 0;
#X connect 12 0 0 1;
#X connect 13 0 12 1;
#X connect 14 0 15 0;
#X connect 14 1 16 0;
#X connect 15 0 13 0;
#X connect 16 0 13 0;
#X connect 17 0 18 0;
#X connect 18 0 14 0;
#X connect 19 0 15 1;
#X connect 20 0 16 1;
_______________________________________________
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list

Reply via email to