#N canvas 57 27 578 769 12;
#X obj 13 514 mtof;
#X obj 13 463 stripnote;
#X obj 164 519 select;
#X obj 155 413 float;
#X obj 164 381 t b f;
#X obj 164 487 float;
#X text 217 367 f - store pitch below;
#X text 209 415 velocity stored here;
#X text 128 459 off;
#X text 216 486 recall pitch;
#X text 132 2 MONOPHONIC MIDI SYNTH;
#X obj 13 340 unpack;
#X obj 13 273 notein;
#X obj 13 300 pack;
#X obj 94 570 line~;
#X msg 94 544 \$1 100;
#X msg 164 545 0 1000;
#X text 15 75 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 17 21 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 msg 152 290 55 64;
#X msg 152 316 55 0;
#X msg 95 291 48 64;
#X msg 95 317 48 0;
#X text 14 142 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 218 387 b - bang to recall velocity;
#X obj 155 442 sel 0;
#X text 177 463 on;
#X obj 16 712 output~;
#X obj 15 688 hip~ 5;
#X obj 14 642 *~;
#X obj 13 541 phasor~;
#X obj 13 565 -~ 0.5;
#X obj 14 593 cos~;
#X obj 102 617 *~;
#X obj 14 617 +~ 1;
#X text 332 741 updated for Pd version 0.37;
#X obj 102 665 cos~;
#X msg 95 268 48 128;
#X text 18 491 pitch;
#X text 19 443 messages;
#X text 210 441 test for note on or off;
#X text 227 520 test against latest;
#X text 270 535 note-on pitch;
#X text 18 407 filter;
#X text 19 425 note-on;
#X obj 15 664 *~;
#X obj 94 517 / 127;
#X text 14 208 The synthesis technique is the same as in the previous
patch \, done in a simpler (but less general) way with a cos~ object
replacing the wavetable lookup.;
#X text 148 571 envelope generator now controls amplitude;
#X text 317 589 as well as grain size;
#X obj 102 641 *~ 2;
#X obj 123 594 +~ 0.5;
#X text 148 687 The +~ 0.5 and *~ 2 are fudge factors.;
#X text 148 648 This replaces the tabread4~;
#X text 146 668 in the previous patch.;
#X text 211 290 These buttons simulate MIDI input.;
#X connect 0 0 30 0;
#X connect 1 0 2 1;
#X connect 1 0 0 0;
#X connect 2 0 16 0;
#X connect 3 0 25 0;
#X connect 4 0 3 0;
#X connect 4 1 5 1;
#X connect 5 0 2 0;
#X connect 11 0 1 0;
#X connect 11 0 4 0;
#X connect 11 1 1 1;
#X connect 11 1 3 1;
#X connect 12 0 13 0;
#X connect 12 1 13 1;
#X connect 13 0 11 0;
#X connect 14 0 45 1;
#X connect 14 0 51 0;
#X connect 15 0 14 0;
#X connect 16 0 14 0;
#X connect 19 0 11 0;
#X connect 20 0 11 0;
#X connect 21 0 11 0;
#X connect 22 0 11 0;
#X connect 25 0 5 0;
#X connect 25 1 46 0;
#X connect 28 0 27 0;
#X connect 28 0 27 1;
#X connect 29 0 45 0;
#X connect 30 0 31 0;
#X connect 31 0 33 0;
#X connect 31 0 32 0;
#X connect 32 0 34 0;
#X connect 33 0 50 0;
#X connect 34 0 29 0;
#X connect 36 0 29 1;
#X connect 37 0 11 0;
#X connect 45 0 28 0;
#X connect 46 0 15 0;
#X connect 50 0 36 0;
#X connect 51 0 33 1;
