#N canvas 423 40 549 871 12;
#X obj 109 542 mtof;
#X obj 109 491 stripnote;
#X obj 260 547 select;
#X obj 251 441 float;
#X obj 260 409 t b f;
#X obj 260 515 float;
#X text 310 400 f - store pitch below;
#X text 300 443 velocity stored here;
#X text 224 487 off;
#X text 304 515 recall pitch;
#X text 156 7 MONOPHONIC MIDI SYNTH;
#X obj 130 376 unpack;
#X obj 86 295 notein;
#X obj 86 322 pack;
#X obj 190 603 line~;
#X msg 190 572 \$1 100;
#X msg 260 573 0 1000;
#X text 39 90 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 41 36 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 232 325 55 64;
#X msg 325 325 55 0;
#X msg 184 325 48 64;
#X msg 282 325 48 0;
#X text 38 157 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 311 417 b - bang to recall velocity;
#X obj 251 470 sel 0;
#X text 273 491 on;
#X obj 81 783 output~;
#X obj 99 747 hip~ 5;
#X obj 99 686 *~;
#X obj 109 569 phasor~;
#X obj 109 593 -~ 0.5;
#X obj 99 634 cos~;
#X obj 172 659 *~;
#X obj 99 658 +~ 1;
#X text 304 804 updated for Pd version 0.37;
#X obj 172 707 cos~;
#X msg 130 325 48 128;
#X text 114 519 pitch;
#X text 303 471 test for note on or off;
#X text 313 548 test against latest;
#X text 355 563 note-on pitch;
#X obj 99 719 *~;
#X obj 190 545 / 127;
#X text 38 223 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 obj 172 683 *~ 2;
#X obj 190 632 +~ 0.5;
#X text 218 703 The +~ 0.5 and *~ 2 are fudge factors.;
#X text 218 664 This replaces the tabread4~;
#X text 216 684 in the previous patch.;
#X text 144 300 These buttons simulate MIDI input.;
#X text 49 466 filter note-on messages, f 8;
#X text 240 596 envelope generator now controls amplitude as well as
grain size, f 31;
#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 42 1;
#X connect 14 0 46 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 43 0;
#X connect 28 0 27 0;
#X connect 28 0 27 1;
#X connect 29 0 42 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 45 0;
#X connect 34 0 29 0;
#X connect 36 0 29 1;
#X connect 37 0 11 0;
#X connect 42 0 28 0;
#X connect 43 0 15 0;
#X connect 45 0 36 0;
#X connect 46 0 33 1;
