#N canvas 489 64 560 567 10;
#X declare -stdpath ./;
#X obj 2 400 cnv 3 550 3 empty empty inlets 8 12 0 13 #dcdcdc #000000 0;
#X obj 2 467 cnv 3 550 3 empty empty outlets 8 12 0 13 #dcdcdc #000000 0;
#X obj 2 502 cnv 3 550 3 empty empty arguments 8 12 0 13 #dcdcdc #000000 0;
#X obj 101 409 cnv 17 3 52 empty empty 0 5 9 0 16 #dcdcdc #9c9c9c 0;
#X obj 101 476 cnv 17 3 17 empty empty 0 5 9 0 16 #dcdcdc #9c9c9c 0;
#X obj 138 208 midiin;
#X obj 200 293 midiout;
#X text 187 511 (none);
#X obj 200 257 cyclone/midiflush;
#X obj 2 534 cnv 15 552 21 empty empty empty 20 12 0 14 #e0e0e0 #202020 0;
#X text 137 409 bang;
#X text 131 426 float;
#X text 130 478 float;
#X obj 149 293 print;
#X obj 210 226 bng 18 250 50 0 empty empty empty 17 7 0 10 #dcdcdc #000000 #000000;
#X msg 200 175 144 \, 67 \, 100 \, 144 \, 57 \, 100;
#X text 216 196 and leave them hanging;
#X text 230 227 <= flush hanging notes;
#X text 163 155 send a couple of note on messages:;
#X text 131 444 clear;
#X text 170 426 - raw MIDI data stream;
#X text 170 409 - sends note off for hanging notes;
#X text 170 478 - raw MIDI data stream;
#X text 72 91 Like a "panic button" \, [midiflush] keeps track of raw Note-on messages that weren't switched off and "flushes" them by sending corresponding note-offs when it receives a bang.;
#X text 170 444 - clears the hanging notes that [midiflush] keeps track off;
#N canvas 571 199 576 463 example 0;
#X obj 182 198 cnv 15 140 40 empty empty empty 20 12 0 14 #ececec #404040 0;
#N canvas 638 210 443 345 polysynth 0;
#X obj 85 63 inlet;
#X obj 85 105 poly 6 1;
#X obj 85 166 route 1 2 3 4 5 6, f 38;
#X obj 173 298 outlet~;
#N canvas 292 354 342 369 voice 0;
#X obj 197 123 / 127;
#X obj 182 228 *~;
#X obj 182 260 *~ 0.2;
#X obj 92 149 phasor~;
#X obj 92 117 mtof;
#X obj 92 42 inlet;
#X obj 182 297 outlet~;
#X obj 197 183 line~;
#X msg 197 148 \$1 250;
#X obj 49 184 cyclone/triangle~ 0.7;
#X obj 92 83 unpack float float;
#X connect 0 0 8 0;
#X connect 1 0 2 0;
#X connect 2 0 6 0;
#X connect 3 0 9 0;
#X connect 4 0 3 0;
#X connect 5 0 10 0;
#X connect 7 0 1 1;
#X connect 8 0 7 0;
#X connect 9 0 1 0;
#X connect 10 0 4 0;
#X connect 10 1 0 0;
#X restore 24 209 pd voice;
#N canvas 292 354 342 369 voice 0;
#X obj 197 123 / 127;
#X obj 182 228 *~;
#X obj 182 260 *~ 0.2;
#X obj 92 149 phasor~;
#X obj 92 117 mtof;
#X obj 92 42 inlet;
#X obj 182 297 outlet~;
#X obj 197 183 line~;
#X msg 197 148 \$1 250;
#X obj 49 184 cyclone/triangle~ 0.7;
#X obj 92 83 unpack float float;
#X connect 0 0 8 0;
#X connect 1 0 2 0;
#X connect 2 0 6 0;
#X connect 3 0 9 0;
#X connect 4 0 3 0;
#X connect 5 0 10 0;
#X connect 7 0 1 1;
#X connect 8 0 7 0;
#X connect 9 0 1 0;
#X connect 10 0 4 0;
#X connect 10 1 0 0;
#X restore 87 209 pd voice;
#N canvas 292 354 342 369 voice 0;
#X obj 197 123 / 127;
#X obj 182 228 *~;
#X obj 182 260 *~ 0.2;
#X obj 92 149 phasor~;
#X obj 92 117 mtof;
#X obj 92 42 inlet;
#X obj 182 297 outlet~;
#X obj 197 183 line~;
#X msg 197 148 \$1 250;
#X obj 49 184 cyclone/triangle~ 0.7;
#X obj 92 83 unpack float float;
#X connect 0 0 8 0;
#X connect 1 0 2 0;
#X connect 2 0 6 0;
#X connect 3 0 9 0;
#X connect 4 0 3 0;
#X connect 5 0 10 0;
#X connect 7 0 1 1;
#X connect 8 0 7 0;
#X connect 9 0 1 0;
#X connect 10 0 4 0;
#X connect 10 1 0 0;
#X restore 154 209 pd voice;
#N canvas 292 354 342 369 voice 0;
#X obj 197 123 / 127;
#X obj 182 228 *~;
#X obj 182 260 *~ 0.2;
#X obj 92 149 phasor~;
#X obj 92 117 mtof;
#X obj 92 42 inlet;
#X obj 182 297 outlet~;
#X obj 197 183 line~;
#X msg 197 148 \$1 250;
#X obj 49 184 cyclone/triangle~ 0.7;
#X obj 92 83 unpack float float;
#X connect 0 0 8 0;
#X connect 1 0 2 0;
#X connect 2 0 6 0;
#X connect 3 0 9 0;
#X connect 4 0 3 0;
#X connect 5 0 10 0;
#X connect 7 0 1 1;
#X connect 8 0 7 0;
#X connect 9 0 1 0;
#X connect 10 0 4 0;
#X connect 10 1 0 0;
#X restore 217 209 pd voice;
#N canvas 292 354 342 369 voice 0;
#X obj 197 123 / 127;
#X obj 182 228 *~;
#X obj 182 260 *~ 0.2;
#X obj 92 149 phasor~;
#X obj 92 117 mtof;
#X obj 92 42 inlet;
#X obj 182 297 outlet~;
#X obj 197 183 line~;
#X msg 197 148 \$1 250;
#X obj 49 184 cyclone/triangle~ 0.7;
#X obj 92 83 unpack float float;
#X connect 0 0 8 0;
#X connect 1 0 2 0;
#X connect 2 0 6 0;
#X connect 3 0 9 0;
#X connect 4 0 3 0;
#X connect 5 0 10 0;
#X connect 7 0 1 1;
#X connect 8 0 7 0;
#X connect 9 0 1 0;
#X connect 10 0 4 0;
#X connect 10 1 0 0;
#X restore 284 209 pd voice;
#N canvas 292 354 342 369 voice 0;
#X obj 197 123 / 127;
#X obj 182 228 *~;
#X obj 182 260 *~ 0.2;
#X obj 92 149 phasor~;
#X obj 92 117 mtof;
#X obj 92 42 inlet;
#X obj 182 297 outlet~;
#X obj 197 183 line~;
#X msg 197 148 \$1 250;
#X obj 49 184 cyclone/triangle~ 0.7;
#X obj 92 83 unpack float float;
#X connect 0 0 8 0;
#X connect 1 0 2 0;
#X connect 2 0 6 0;
#X connect 3 0 9 0;
#X connect 4 0 3 0;
#X connect 5 0 10 0;
#X connect 7 0 1 1;
#X connect 8 0 7 0;
#X connect 9 0 1 0;
#X connect 10 0 4 0;
#X connect 10 1 0 0;
#X restore 347 209 pd voice;
#X obj 85 134 cyclone/join 3;
#X connect 0 0 1 0;
#X connect 1 0 10 0;
#X connect 1 1 10 1;
#X connect 1 2 10 2;
#X connect 2 0 4 0;
#X connect 2 1 5 0;
#X connect 2 2 6 0;
#X connect 2 3 7 0;
#X connect 2 4 8 0;
#X connect 2 5 9 0;
#X connect 4 0 3 0;
#X connect 5 0 3 0;
#X connect 6 0 3 0;
#X connect 7 0 3 0;
#X connect 8 0 3 0;
#X connect 9 0 3 0;
#X connect 10 0 2 0;
#X restore 194 326 pd polysynth;
#X obj 194 155 cyclone/midiformat;
#X obj 194 210 cyclone/midiflush;
#X obj 194 262 cyclone/midiparse;
#X obj 294 300 cyclone/borax;
#X obj 130 119 bng 30 250 50 0 empty empty empty 17 7 0 10 #d0d0d0 #686868 #000000;
#X msg 194 121 \$1 100;
#X floatatom 194 99 5 0 0 0 - - - 0;
#X obj 194 49 bng 17 250 50 0 empty empty empty 17 7 0 10 #dcdcdc #000000 #000000;
#X text 317 154 generates raw MIDI note messages;
#X text 220 48 generates random note-on messages;
#X obj 312 343 nbx 3 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X text 30 125 Flush them off;
#X obj 194 74 expr random(50 \, 80);
#X obj 194 370 output~;
#X text 358 332 number of active voices, f 9;
#X obj 373 414 declare -stdpath ./;
#X connect 1 0 15 0;
#X connect 2 0 3 0;
#X connect 3 0 4 0;
#X connect 4 0 5 0;
#X connect 4 0 1 0;
#X connect 5 2 12 0;
#X connect 6 0 3 0;
#X connect 7 0 2 0;
#X connect 8 0 7 0;
#X connect 9 0 14 0;
#X connect 14 0 8 0;
#X restore 462 268 pd example;
#X obj 2 3 ./header midiflush;
#X text 22 63 Flush hanging note-ons on raw MIDI;
#X text 72 347 see also:;
#X obj 412 361 open-else;
#X text 455 339 click;
#X text 143 342 Plugdata users or those with ELSE can also use [else/panic] as an alternative, f 42;
#X msg 412 339 panic;
#X connect 5 0 8 0;
#X connect 8 0 6 0;
#X connect 8 0 13 0;
#X connect 14 0 8 0;
#X connect 15 0 8 0;
#X connect 32 0 29 0;
