aboutsummaryrefslogtreecommitdiff
path: root/pd/doc/3.audio.examples/45.envelope.follower.pd
diff options
context:
space:
mode:
Diffstat (limited to 'pd/doc/3.audio.examples/45.envelope.follower.pd')
-rw-r--r--pd/doc/3.audio.examples/45.envelope.follower.pd101
1 files changed, 101 insertions, 0 deletions
diff --git a/pd/doc/3.audio.examples/45.envelope.follower.pd b/pd/doc/3.audio.examples/45.envelope.follower.pd
new file mode 100644
index 00000000..0c3de2b4
--- /dev/null
+++ b/pd/doc/3.audio.examples/45.envelope.follower.pd
@@ -0,0 +1,101 @@
+#N canvas 64 77 982 581 12;
+#X text 759 566 updated for Pd version 0.26;
+#X text 67 8 ENVELOPE FOLLOWERS;
+#X text 17 28 The env~ object reports ths RMS signal level over the last 256 samples (by default) or any other power of 2 that's at least twice the block size. The analysis is done in an overlapped fashion so that results appear every N/2 points if N is the analysis window size. So the larger the window \, the stabler the result and the less frequently it appears. Computation time doesn't depend heavily on N.;
+#X text 471 28 Envelope followers are frequently used to detect attacks and periods of silence. (There are fancier attack detectors out there \, though.) Here is a simple threshold-based attack and rest detector.;
+#X obj 152 160 dbtorms;
+#X floatatom 75 142;
+#X obj 75 165 osc~ 440;
+#X obj 75 188 *~ 0;
+#X obj 75 211 env~;
+#X floatatom 136 216;
+#X floatatom 152 137;
+#X msg 219 155 \; pd dsp 1;
+#X obj 87 307 t b f;
+#X floatatom 87 330;
+#X obj 94 385 pack;
+#X text 198 215 note 3.01 dB difference between peak and RMS amplitudes.;
+#X obj 94 408 route 0 1;
+#X obj 94 431 > 55;
+#X obj 139 433 < 45;
+#X obj 94 454 sel 1;
+#X obj 139 456 sel 1;
+#X msg 16 494 1;
+#X msg 45 494 0;
+#X obj 94 494 print attack;
+#X obj 87 365 != 0;
+#X obj 517 267 t b f;
+#X floatatom 517 290;
+#X obj 524 348 pack;
+#X obj 524 371 route 0 1;
+#X obj 524 404 sel 1;
+#X msg 458 525 1;
+#X msg 488 525 0;
+#X obj 517 326 != 0;
+#X obj 547 290 < 45;
+#X obj 542 441 timer;
+#X obj 600 371 sel 0;
+#X obj 616 496 sel 0;
+#X obj 542 487 sel 1;
+#X obj 542 528 print rest;
+#X obj 542 464 > 1000;
+#X text 125 330 state -- 1 if waiting for low threshold \,;
+#X text 151 345 0 if we've attained it and now want the;
+#X text 180 359 high one.;
+#X text 165 408 route the RMS value according to state;
+#X text 191 435 if off \, 55 dB means attack. If on \, 45;
+#X text 192 456 dB or less means state changes to off.;
+#X text 106 279 ATTACK DETECTION;
+#X text 515 244 REST DETECTION;
+#X text 590 288 Here we always will test RMS against a low value;
+#X text 615 305 but as before we route the result according to;
+#X text 637 322 our state \, 1 if "resting" \, 0 if not.;
+#X text 645 368 regardless of state \, when RMS isn't low;
+#X text 667 383 reset the timer;
+#X text 691 511 RMS isn't low enough.;
+#X text 602 403 If we're not in rest \, and the RMS is low \,;
+#X text 626 419 check elapsed time sinse RMS last wasn't low.;
+#X text 613 461 If more than 1 second \, report a rest.;
+#X text 664 495 If we're at rest \, pop out of it when;
+#X text 471 94 Both detectors are state machines with two states \, on and off. If on \, a test is run to determine whether to turn off \, and vice versa. The tests are run at each output of the rms~ object.;
+#X connect 4 0 7 1;
+#X connect 5 0 6 0;
+#X connect 6 0 7 0;
+#X connect 7 0 8 0;
+#X connect 8 0 9 0;
+#X connect 8 0 12 0;
+#X connect 8 0 25 0;
+#X connect 10 0 4 0;
+#X connect 10 0 11 0;
+#X connect 12 0 13 0;
+#X connect 12 1 14 1;
+#X connect 13 0 24 0;
+#X connect 14 0 16 0;
+#X connect 16 0 17 0;
+#X connect 16 1 18 0;
+#X connect 17 0 19 0;
+#X connect 18 0 20 0;
+#X connect 19 0 21 0;
+#X connect 19 0 23 0;
+#X connect 20 0 22 0;
+#X connect 21 0 13 0;
+#X connect 22 0 13 0;
+#X connect 24 0 14 0;
+#X connect 25 0 26 0;
+#X connect 25 1 33 0;
+#X connect 26 0 32 0;
+#X connect 27 0 28 0;
+#X connect 28 0 29 0;
+#X connect 28 1 36 0;
+#X connect 29 0 34 1;
+#X connect 30 0 26 0;
+#X connect 31 0 26 0;
+#X connect 32 0 27 0;
+#X connect 33 0 27 1;
+#X connect 33 0 35 0;
+#X connect 34 0 39 0;
+#X connect 35 0 34 0;
+#X connect 36 0 31 0;
+#X connect 37 0 30 0;
+#X connect 37 0 38 0;
+#X connect 39 0 37 0;