#N canvas 222 84 686 544 12;
#X obj 48 106 r trigger;
#X obj 48 154 tabread4~ dbtorms;
#X floatatom 86 232 0 0 0;
#N canvas 159 26 495 266 output 0;
#X obj 338 160 t b;
#X obj 338 110 f;
#X obj 338 60 inlet;
#X text 344 29 mute;
#X obj 338 185 f;
#X msg 425 178 0;
#X msg 338 85 bang;
#X obj 338 135 moses 1;
#X obj 425 153 t b f;
#X obj 397 117 moses 1;
#X obj 83 148 dbtorms;
#X obj 397 92 r master-lvl;
#X obj 83 42 r master-lvl;
#X obj 338 210 s master-lvl;
#X obj 22 181 inlet~;
#X obj 199 41 inlet;
#X text 199 18 level;
#X obj 199 100 s master-lvl;
#X msg 96 65 set \$1;
#X obj 96 89 outlet;
#X msg 214 64 \; pd dsp 1;
#X obj 83 194 line~;
#X obj 22 212 *~;
#X obj 22 241 dac~;
#X obj 83 171 pack 0 50;
#X text 20 158 audio;
#X text 93 110 show level;
#X connect 0 0 4 0;
#X connect 1 0 7 0;
#X connect 2 0 6 0;
#X connect 4 0 13 0;
#X connect 5 0 13 0;
#X connect 6 0 1 0;
#X connect 7 0 0 0;
#X connect 7 1 8 0;
#X connect 8 0 5 0;
#X connect 9 1 4 1;
#X connect 10 0 24 0;
#X connect 11 0 1 1;
#X connect 11 0 9 0;
#X connect 12 0 10 0;
#X connect 12 0 18 0;
#X connect 14 0 22 0;
#X connect 15 0 17 0;
#X connect 15 0 20 0;
#X connect 18 0 19 0;
#X connect 21 0 22 1;
#X connect 22 0 23 0;
#X connect 22 0 23 1;
#X connect 24 0 21 0;
#X restore 48 258 pd output;
#X msg 124 232 MUTE;
#X text 166 231 <-- output amplitude;
#X text 141 298 <-- attack;
#X text 568 305 <-- release;
#X obj 48 208 *~;
#N canvas 574 520 906 400 make-table 0;
#X msg 107 49 bang;
#X obj 107 78 t b b;
#X obj 159 142 f;
#X obj 197 142 + 1;
#X msg 175 112 0;
#X obj 107 107 until;
#X obj 161 177 t f f;
#X obj 411 106 sig~;
#X floatatom 411 78 0 0 0;
#X floatatom 427 170 0 0 0;
#X obj 427 198 metro 250;
#X obj 411 227 snapshot~;
#X floatatom 411 256 0 0 0;
#X obj 341 311 loadbang;
#X graph graph1 0 0 123 10 621 163 821 63;
#X array dbtorms 123 float 0;
#X pop;
#X text 823 156 0;
#X text 825 56 10;
#X text 640 166 ------ 123 samples ------;
#X graph graph2 0 0 130 12000 628 340 828 240;
#X array mtof 130 float 0;
#X pop;
#X obj 275 234 mtof;
#X floatatom 274 259 0 0 0;
#X text 638 348 ------ 130 samples ------;
#X text 837 333 0;
#X text 839 233 12000;
#X obj 109 210 mtof;
#X obj 97 167 sel 129;
#X obj 107 245 tabwrite mtof;
#X msg 63 328 \; mtof write mtof.txt;
#X msg 341 334 \; dbtorms read dbtorms.txt \; mtof read mtof.txt;
#X obj 411 138 tabread4~ mtof;
#X text 48 15 patch to regenerate the mtof table;
#X text 256 53 test accuracy (start DSP and metro first);
#X connect 0 0 1 0;
#X connect 1 0 5 0;
#X connect 1 1 4 0;
#X connect 2 0 3 0;
#X connect 2 0 6 0;
#X connect 2 0 25 0;
#X connect 3 0 2 1;
#X connect 4 0 2 1;
#X connect 5 0 2 0;
#X connect 6 0 24 0;
#X connect 6 1 26 1;
#X connect 7 0 29 0;
#X connect 8 0 7 0;
#X connect 8 0 19 0;
#X connect 9 0 10 0;
#X connect 10 0 11 0;
#X connect 11 0 12 0;
#X connect 13 0 28 0;
#X connect 19 0 20 0;
#X connect 24 0 26 0;
#X connect 25 0 5 1;
#X connect 29 0 11 0;
#X restore 451 222 pd make-table;
#X text 35 6 PITCH ENVELOPES;
#X text 125 24 For pitch envelopes \, unlike amplitude envelopes \,
discontinuities are allowed and sometimes you would rather the envelope
generator actually jump to zero when it's triggered. The "adsr2" object
does this for you if you send a negative trigger instead of a positive
one:;
#X obj 280 106 r trigger2;
#X obj 280 178 tabread4~ mtof;
#X obj 280 202 osc~;
#X msg 46 288 \; pd dsp 1 \; trigger 1 \; trigger2 1;
#X text 358 297 <-- attack;
#X msg 249 293 \; pd dsp 1 \; trigger 1 \; trigger2 -1;
#X msg 472 293 \; pd dsp 1 \; trigger 0 \; trigger2 0;
#X obj 280 154 +~ 69;
#X text 358 314 restarting;
#X text 363 331 pitch env;
#X text 37 377 We have added a new table \, mtof \, for converting
audio signals from pitch to frequency. Its range is 1-127 \, so you
want to add a base pitch in before you start reading from it.;
#X text 37 443 This is an extreme use of pitch enveloping. In a real
situation you might want an envelope controlling vibrato depth or the
like instead of straight pitch.;
#X text 413 497 updated for Pd version 0.34;
#X obj 48 130 adsr2 100 50 200 90 1000;
#X obj 280 130 adsr2 20 200 100 100 1000;
#X connect 0 0 25 0;
#X connect 1 0 8 0;
#X connect 2 0 3 1;
#X connect 3 0 2 0;
#X connect 4 0 3 2;
#X connect 8 0 3 0;
#X connect 12 0 26 0;
#X connect 13 0 14 0;
#X connect 14 0 8 1;
#X connect 19 0 13 0;
#X connect 25 0 1 0;
#X connect 26 0 19 0;
