#N canvas 544 60 549 725 12;
#X floatatom 68 597 8 0 0 0 - - - 0;
#X floatatom 322 320 5 0 999 0 - \$0-osc2 - 12;
#X obj 322 354 osc~;
#X obj 248 531 lop~;
#X floatatom 273 502 4 0 100 0 - \$0-lop - 0;
#X obj 247 406 +~;
#X obj 247 375 osc~ 500;
#X obj 248 468 *~;
#X obj 248 594 snapshot~;
#X floatatom 248 655 9 0 999 0 - - - 0;
#X obj 248 624 sqrt;
#X obj 68 624 dbtorms;
#X text 301 469 square the signal;
#X text 285 623 convert to RMS;
#X text 293 531 low-pass filter;
#X text 317 654 output;
#X obj 259 566 r \$0-tick;
#X obj 68 461 r \$0-tick;
#X obj 68 572 f;
#X obj 86 530 env~;
#X obj 322 408 *~;
#X obj 340 383 tgl 19 0 empty empty empty 0 -6 0 8 #dfdfdf #000000 #000000 0 1;
#X text 32 142 Here we're adding two oscillators so the result should be an RMS of one if the second oscillator is on \, 0.707 otherwise. Note two effects: first \, the more responsive the envelope follower \, the less accurate the result (but the faster it responds). Second \, if the two oscillators are tuned close to each other their beating affects the numbers coming out., f 70;
#X obj 68 362 ../5.reference/set-dsp-tgl;
#X text 99 365 DSP on/off;
#X msg 68 399 \; pd dsp \$1;
#X text 32 61 An envelope follower measures the mean square power of an signal as it changes over time. (You can convert mean square power to RMS amplitude or to decibels if you wish.) The term "mean square" means simply that the signal should be squared \, and then averaged. The averaging is done using a low-pass filter such as [lop~]., f 70;
#X text 33 236 The [env~] object at right \, which is a built-in envelope follower using a higher-quality low-pass filter than [lop~] \, is shown for comparison. Its output is artificially slowed down to match the homemade one at left., f 70;
#X text 308 502 <-- responsiveness;
#N canvas 847 473 382 265 init 0;
#X obj 85 14 loadbang;
#X obj 85 38 bng 19 250 50 0 empty empty empty 0 -6 0 8 #dfdfdf #000000 #000000;
#X obj 85 67 f \$0;
#X obj 229 91 metro 250;
#X obj 229 66 r \$0-metro;
#X obj 229 115 s \$0-tick;
#X msg 85 91 \; \$1-osc2 400 \; \$1-lop 10 \; \$1-metro 1;
#X text 86 181 This subpatch initializes the patch \, starts the metronome and loads initial values in number boxes., f 31;
#X connect 0 0 1 0;
#X connect 1 0 2 0;
#X connect 2 0 6 0;
#X connect 3 0 5 0;
#X connect 4 0 3 0;
#X restore 444 636 pd init;
#X text 78 320 frequency of second oscillator -->;
#X text 365 383 <-- on/off;
#X floatatom 68 655 9 0 999 0 - - - 0;
#X text 331 562 take snapshot every 1/4 second, f 16;
#X text 122 529 <-- built-in envelope follower for comparison, f 12;
#X obj 93 19 cnv 5 5 25 empty empty Envelope\ Follower 15 13 0 16 #dfdfdf #202020 0;
#X connect 0 0 11 0;
#X connect 1 0 2 0;
#X connect 2 0 20 0;
#X connect 3 0 8 0;
#X connect 4 0 3 1;
#X connect 5 0 7 0;
#X connect 5 0 7 1;
#X connect 5 0 19 0;
#X connect 6 0 5 0;
#X connect 7 0 3 0;
#X connect 8 0 10 0;
#X connect 10 0 9 0;
#X connect 11 0 32 0;
#X connect 16 0 8 0;
#X connect 17 0 18 0;
#X connect 18 0 0 0;
#X connect 19 0 18 1;
#X connect 20 0 5 1;
#X connect 21 0 20 1;
#X connect 23 0 25 0;
