#N canvas 63 28 664 702 12;
#X floatatom 71 494 4 0 0;
#X floatatom 104 625 0 0 100;
#N canvas 269 205 698 344 output 0;
#X obj 388 156 t b;
#X obj 388 105 f;
#X obj 388 54 inlet;
#X obj 388 181 f;
#X msg 482 174 0;
#X msg 388 79 bang;
#X obj 388 130 moses 1;
#X obj 482 149 t b f;
#X obj 444 111 moses 1;
#X obj 91 148 dbtorms;
#X obj 444 86 r master-lvl;
#X obj 91 48 r master-lvl;
#X obj 388 207 s master-lvl;
#X obj 28 169 inlet~;
#X obj 213 195 inlet;
#X obj 229 218 s master-lvl;
#X msg 101 72 set \$1;
#X obj 101 98 outlet;
#X msg 213 241 \; pd dsp 1;
#X obj 91 201 line~;
#X obj 31 219 *~;
#X obj 31 247 dac~;
#X obj 91 173 pack 0 50;
#X text 17 149 audio in;
#X obj 28 194 hip~ 1;
#X connect 0 0 3 0;
#X connect 1 0 6 0;
#X connect 2 0 5 0;
#X connect 3 0 12 0;
#X connect 4 0 12 0;
#X connect 5 0 1 0;
#X connect 6 0 0 0;
#X connect 6 1 7 0;
#X connect 7 0 4 0;
#X connect 8 1 3 1;
#X connect 9 0 22 0;
#X connect 10 0 1 1;
#X connect 10 0 8 0;
#X connect 11 0 9 0;
#X connect 11 0 16 0;
#X connect 13 0 24 0;
#X connect 14 0 15 0;
#X connect 14 0 18 0;
#X connect 16 0 17 0;
#X connect 19 0 20 1;
#X connect 20 0 21 0;
#X connect 20 0 21 1;
#X connect 22 0 19 0;
#X connect 24 0 20 0;
#X restore 72 648 pd output;
#X msg 137 625 MUTE;
#X obj 71 521 mtof;
#X obj 77 345 stripnote;
#X obj 201 500 select;
#X obj 246 369 float;
#X obj 255 318 t b f;
#X obj 255 462 float;
#X text 318 310 f - store pitch below;
#X text 301 368 velocity stored here;
#X text 349 395 test velocity for note on or off;
#X text 301 425 note on;
#X text 201 408 note;
#X text 205 423 off;
#X text 308 464 recall pitch;
#X text 272 508 test against latest note-on pitch;
#X text 96 367 pitch \, only;
#X text 96 386 for note-on;
#X text 86 456 pitch;
#X text 197 6 MONOPHONIC MIDI SYNTH;
#X obj 79 308 unpack;
#X obj 80 228 notein;
#X obj 79 260 pack;
#X obj 71 547 osc~;
#X obj 71 573 *~;
#X obj 71 600 cos~;
#X obj 166 557 line~;
#X msg 121 526 \$1 100;
#X msg 201 526 0 1000;
#X obj 121 500 / 100;
#X text 81 74 First \, at top \, incoming MIDI notes are parsed and
used to set pitch and trigger an ADSR envelope. Second \, the envelope
generator itself has been extended to offer controls over the time
and target values via number boxes.;
#X text 82 25 This patch shows how to make a monophonic synthesizer
that could be controlled from a MIDI or voltage-control keyboard--in
this example we assume MIDI.;
#X text 350 658 updated for Pd version 0.34;
#X msg 237 256 55 64;
#X msg 237 282 55 0;
#X msg 181 230 48 200;
#X msg 180 257 48 64;
#X msg 180 283 48 0;
#X text 79 140 The note-off testing is complicated by the fact that
we have to test both that the velocity is zero \, and further that
the note-off pitch matches the pitch that is now playing (the most
recent note-on pitch.);
#X text 317 327 b - bang to recall velocity;
#X obj 246 417 sel 0;
#X connect 0 0 4 0;
#X connect 1 0 2 1;
#X connect 2 0 1 0;
#X connect 3 0 2 2;
#X connect 4 0 25 0;
#X connect 5 0 0 0;
#X connect 5 0 6 1;
#X connect 6 0 30 0;
#X connect 7 0 42 0;
#X connect 8 0 7 0;
#X connect 8 1 9 1;
#X connect 9 0 6 0;
#X connect 22 0 5 0;
#X connect 22 0 8 0;
#X connect 22 1 5 1;
#X connect 22 1 7 1;
#X connect 23 0 24 0;
#X connect 23 1 24 1;
#X connect 24 0 22 0;
#X connect 25 0 26 0;
#X connect 26 0 27 0;
#X connect 27 0 2 0;
#X connect 28 0 26 1;
#X connect 29 0 28 0;
#X connect 30 0 28 0;
#X connect 31 0 29 0;
#X connect 35 0 22 0;
#X connect 36 0 22 0;
#X connect 37 0 22 0;
#X connect 38 0 22 0;
#X connect 39 0 22 0;
#X connect 42 0 9 0;
#X connect 42 1 31 0;
