#N canvas 1 53 399 237 12;
#N canvas 189 27 888 819 midifile_write 0;
#X obj 324 -2 bng 45 250 50 0 empty empty choose 5 23 0 8 -62784 -260818
-258699;
#X obj 67 51 tgl 45 0 empty empty record 2 23 0 8 -258699 -241291 -24198
0 1;
#X floatatom 553 772 15 0 0 0 tick - -;
#X obj 67 151 metro 2;
#X floatatom 113 109 15 0 0 0 - - -;
#X msg 113 83 2.005;
#X msg 506 590 verbose \$1;
#X text 494 545 verbosity defaults to 1;
#X obj 324 54 savepanel;
#X msg 409 493 240 1 2 3 4 247;
#X text 523 492 a sysex message;
#X obj 553 742 float;
#X floatatom 506 564 5 0 0 0 - - -;
#X msg 324 408 write \$1 \$2 \$3;
#X msg 326 201 29;
#X msg 364 201 30;
#X msg 210 201 0;
#X floatatom 405 275 5 0 0 0 ticks_per_frame - -;
#X text 80 301 (ticks per quarter note if frames per second is zero)
;
#X msg 288 201 25;
#X msg 248 201 24;
#X text 79 322 25 20 will give accurate timing with metro ticks at
2ms;
#X obj 324 375 pack s 25 20;
#X obj 559 663 midifile;
#X text 7 199 time code frames per second:;
#X text 484 432 default is 90 ticks per quarter note;
#X msg 349 433 write filename.mid;
#X msg 374 458 write filename.mid 77;
#X text 534 458 77 ticks per quarter note;
#X msg 442 526 flush;
#X obj 629 96 cnv 15 200 20 empty empty empty 20 12 0 14 -257985 -66577
0;
#X floatatom 515 95 5 0 0 0 note - -;
#X floatatom 515 125 5 0 0 0 velocity - -;
#X obj 559 283 pack 144 0 0;
#X obj 578 129 sel 0;
#X obj 559 156 t b f;
#X obj 559 257 f;
#X text 160 658 Martin Peach \, 2010;
#X text 553 565 set to 3 to debug input;
#X obj 559 75 notein;
#X obj 119 -2 cnv 15 200 20 empty empty empty 20 12 0 14 -257985 -66577
0;
#X text 121 -3 1: open a file for writing:;
#X obj 116 50 cnv 15 200 20 empty empty empty 20 12 0 14 -257985 -66577
0;
#X text 118 49 2: start recording;
#X obj 139 526 cnv 15 300 20 empty empty empty 20 12 0 14 -257985 -66577
0;
#X text 157 524 4: stop recording and save the file:;
#X floatatom 513 180 5 0 0 0 channel - -;
#X obj 610 237 +;
#X msg 578 185 127;
#X msg 610 157 143;
#X floatatom 709 313 5 0 0 0 value - -;
#X floatatom 709 344 5 0 0 0 controller - -;
#X floatatom 707 393 5 0 0 0 channel - -;
#X obj 755 293 ctlin;
#X obj 755 447 pack 176 0 0;
#X obj 755 479 print ctl>;
#X obj 580 324 print note>;
#X obj 755 329 t b f;
#X obj 755 393 f;
#X obj 810 336 + 175;
#X text 646 93 3: input MIDI as lists;
#X connect 0 0 8 0;
#X connect 1 0 3 0;
#X connect 3 0 23 0;
#X connect 4 0 3 1;
#X connect 5 0 4 0;
#X connect 6 0 23 0;
#X connect 8 0 22 0;
#X connect 9 0 23 0;
#X connect 11 0 2 0;
#X connect 12 0 6 0;
#X connect 13 0 23 0;
#X connect 14 0 22 1;
#X connect 15 0 22 1;
#X connect 16 0 22 1;
#X connect 17 0 22 2;
#X connect 19 0 22 1;
#X connect 20 0 22 1;
#X connect 22 0 13 0;
#X connect 23 1 11 1;
#X connect 23 2 11 0;
#X connect 26 0 23 0;
#X connect 27 0 23 0;
#X connect 29 0 23 0;
#X connect 33 0 23 0;
#X connect 33 0 56 0;
#X connect 34 0 48 0;
#X connect 34 1 49 0;
#X connect 35 0 36 0;
#X connect 35 1 33 1;
#X connect 36 0 33 0;
#X connect 39 0 31 0;
#X connect 39 0 35 0;
#X connect 39 1 32 0;
#X connect 39 1 34 0;
#X connect 39 1 33 2;
#X connect 39 2 46 0;
#X connect 39 2 47 1;
#X connect 47 0 36 1;
#X connect 48 0 47 0;
#X connect 49 0 47 0;
#X connect 53 0 50 0;
#X connect 53 0 57 0;
#X connect 53 1 51 0;
#X connect 53 1 54 1;
#X connect 53 2 52 0;
#X connect 53 2 59 0;
#X connect 54 0 55 0;
#X connect 54 0 23 0;
#X connect 57 0 58 0;
#X connect 57 1 54 2;
#X connect 58 0 54 0;
#X connect 59 0 58 1;
#X restore 76 116 pd midifile_write;
#N canvas 214 27 1028 899 midifile_read 0;
#X obj 198 518 bng 15 250 50 0 empty empty step 18 7 0 12 -4160 -257985
-1;
#X obj -148 60 openpanel;
#X obj -148 7 bng 45 250 50 0 empty empty choose 3 23 0 12 -62784 -260818
-258699;
#X obj -40 146 tgl 45 0 empty empty play -45 23 0 12 -24198 -1 -258699
0 1;
#X msg 231 469 rewind;
#X text 81 468 go to start of file;
#X floatatom 340 560 15 0 0 0 current_tick - -;
#X obj 75 292 hradio 15 1 0 16 empty empty track_number 0 -6 0 12 -62784
-241291 -1 0;
#X msg 75 313 dump \$1;
#X msg 194 432 68050;
#X msg 19 257 track \$1;
#X obj 19 217 hradio 15 1 0 16 empty empty track_number 0 -6 0 12 -62784
-241291 -1 0;
#X obj -40 198 metro 2;
#X text 24 535 creation arguments: midi_file_name;
#X text 23 514 output only this track;
#X text 138 312 parse this track to main window;
#X msg 255 493 0;
#X text 82 432 goto tick 68050;
#X floatatom 104 701 5 0 0 0 note - -;
#X floatatom 171 701 5 0 0 1 velocity - -;
#X floatatom 315 615 15 0 0 0 last_tick - -;
#X msg 151 389 verbose \$1;
#X text -26 390 verbosity defaults to 1;
#X text -97 2 1: choose a MIDI file to play;
#X text 13 140 2: start playing it;
#X obj 275 415 spigot;
#X obj 314 381 tgl 25 0 empty empty loop -45 12 0 12 -4160 -257985
-258113 0 1;
#X msg -148 90 read \$1;
#X floatatom 151 365 5 0 0 0 - - -;
#X obj 151 346 hradio 15 1 0 4 empty empty verbosity 0 -6 0 12 -62784
-241291 -1 0;
#X obj 19 234 - 1;
#X text 684 668 note off events;
#X obj 275 533 midifile wowo.mid;
#X obj -95 496 ctlout 123;
#X msg -95 466 123;
#X obj 275 640 route 144 145 146 147 148 149 150 151 152 153 154 155
156 157 158 159;
#X obj 104 676 unpack 0 0;
#X obj 451 692 route 128 129 130 131 132 133 134 135 136 137 138 139
140 141 142 143;
#X msg -121 117 read I_Wanna_Be_Sedated.mid;
#X obj -95 438 bng 15 250 50 0 empty empty all_notes_off 17 7 0 10
-258113 -257985 -1;
#X obj 453 573 t b b;
#X floatatom -26 254 5 0 0 0 - - -;
#X obj 499 588 bng 15 250 50 0 empty empty end 17 7 0 10 -258113 -257985
-1;
#X text 407 532 bangs at end of file:;
#X obj -123 676 print note_on;
#X obj -124 728 print note_off;
#X floatatom 456 422 9 0 0 0 loop_start_tick - -;
#X text 54 234 -1 = play all tracks;
#X obj 315 593 f;
#X text -18 562 MIDI messages are output as lists;
#X text 111 639 select note on events:;
#X obj 275 816 noteout 1;
#X obj 346 816 noteout 2;
#X obj 418 816 noteout 3;
#X obj 489 816 noteout 4;
#X text -78 746 select note on events:;
#X obj 88 747 route 176 177 178 179 180 181 182 183 184 185 186 187
188 189 190 191 192;
#X floatatom 88 814 5 0 0 0 controller - -;
#X floatatom 155 814 5 0 0 1 value - -;
#X obj 88 789 unpack 0 0;
#X obj -124 783 print controller;
#X obj -26 861 ctlout 1;
#X obj -32 835 f;
#X obj -32 809 t b f;
#X obj 499 553 route bang format tracks ticks_per_quarternote;
#X obj 275 441 f 0;
#X text 601 830 Martin Peach \, 2011;
#X floatatom 578 585 3 0 0 1 format - -;
#X floatatom 658 585 5 0 0 1 tracks - -;
#X floatatom 738 585 5 0 0 1 ticks_per_quarternote - -;
#X floatatom 263 55 5 0 0 1 tracks - -;
#X symbolatom 427 105 40 0 0 0 - - -;
#X obj 427 79 prepend set;
#X obj 418 139 unpack 0 0;
#X floatatom 485 192 15 0 0 0 last_tick - -;
#X floatatom 418 165 5 0 0 1 track - -;
#X floatatom 340 105 5 0 0 1 track - -;
#X obj 340 79 unpack 0 s;
#X obj 496 231 unpack 0 0 0 0;
#X floatatom 496 299 3 0 0 1 / - -;
#X floatatom 527 299 3 0 0 1 - - -;
#X floatatom 559 268 5 0 0 1 clocks_per_click - -;
#X floatatom 591 299 5 0 0 1 32nds_per_quarternote - -;
#X floatatom 714 406 15 0 0 0 microsec_per_quarternote - -;
#X obj 574 427 /;
#X floatatom 715 447 15 0 0 0 microsec_per_tick - -;
#X obj 574 468 / 1000;
#X floatatom 574 499 15 0 0 0 millisec_per_tick - -;
#X obj 740 105 print other_meta;
#X obj 263 18 route seq_num name end time_sig microsec_per_quarternote
;
#X obj 652 76 route key_sig;
#X obj 652 133 unpack 0 0 s;
#X symbolatom 733 238 10 0 0 0 key - -;
#X obj 733 212 prepend set;
#X floatatom 652 162 5 0 0 1 +sharps/-flats - -;
#X obj 692 191 tgl 15 0 empty empty minor 17 7 0 10 -262144 -1 -1 0
1;
#X connect 0 0 32 0;
#X connect 1 0 27 0;
#X connect 2 0 1 0;
#X connect 3 0 12 0;
#X connect 4 0 32 0;
#X connect 7 0 8 0;
#X connect 8 0 32 0;
#X connect 9 0 32 0;
#X connect 10 0 32 0;
#X connect 11 0 30 0;
#X connect 12 0 32 0;
#X connect 16 0 32 0;
#X connect 21 0 32 0;
#X connect 25 0 65 0;
#X connect 26 0 25 1;
#X connect 27 0 32 0;
#X connect 28 0 21 0;
#X connect 29 0 28 0;
#X connect 30 0 10 0;
#X connect 30 0 41 0;
#X connect 32 0 35 0;
#X connect 32 0 56 0;
#X connect 32 1 6 0;
#X connect 32 1 48 1;
#X connect 32 2 64 0;
#X connect 34 0 33 0;
#X connect 35 0 36 0;
#X connect 35 0 44 0;
#X connect 35 0 51 0;
#X connect 35 1 52 0;
#X connect 35 2 53 0;
#X connect 35 3 54 0;
#X connect 35 16 37 0;
#X connect 36 0 18 0;
#X connect 36 1 19 0;
#X connect 37 0 45 0;
#X connect 37 0 51 0;
#X connect 37 1 52 0;
#X connect 37 2 53 0;
#X connect 37 3 54 0;
#X connect 38 0 32 0;
#X connect 39 0 34 0;
#X connect 40 0 25 0;
#X connect 40 1 48 0;
#X connect 46 0 65 1;
#X connect 48 0 20 0;
#X connect 56 0 59 0;
#X connect 56 0 60 0;
#X connect 59 0 57 0;
#X connect 59 0 63 0;
#X connect 59 1 58 0;
#X connect 59 1 62 1;
#X connect 62 0 61 0;
#X connect 63 0 62 0;
#X connect 63 1 61 1;
#X connect 64 0 42 0;
#X connect 64 0 40 0;
#X connect 64 1 67 0;
#X connect 64 2 68 0;
#X connect 64 3 69 0;
#X connect 64 3 84 1;
#X connect 64 4 89 0;
#X connect 65 0 32 0;
#X connect 72 0 71 0;
#X connect 73 0 75 0;
#X connect 73 1 74 0;
#X connect 77 0 76 0;
#X connect 77 1 72 0;
#X connect 78 0 79 0;
#X connect 78 1 80 0;
#X connect 78 2 81 0;
#X connect 78 3 82 0;
#X connect 84 0 85 0;
#X connect 84 0 86 0;
#X connect 86 0 87 0;
#X connect 89 0 70 0;
#X connect 89 1 77 0;
#X connect 89 2 73 0;
#X connect 89 3 78 0;
#X connect 89 4 83 0;
#X connect 89 4 84 0;
#X connect 89 5 90 0;
#X connect 90 0 91 0;
#X connect 90 1 88 0;
#X connect 91 0 94 0;
#X connect 91 1 95 0;
#X connect 91 2 93 0;
#X connect 93 0 92 0;
#X restore 76 83 pd midifile_read;
#X text 15 10 midifile reads and writes MIDI files.;
#X text 152 170 2010/12/11 Martin Peach;
#N canvas 404 184 494 344 META 0;
#X text 12 185 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan
Wilkes for Pd version 0.42.;
#X text 12 25 LICENSE GPL v2 or later;
#X text 12 165 AUTHOR Martin Peach;
#X text 12 5 KEYWORDS control MIDI;
#X text 12 45 DESCRIPTION read and write MIDI files;
#X text 12 65 INLET_0 bang float list rewind read track dump verbose
write flush;
#X text 12 105 OUTLET_0 list;
#X text 12 125 OUTLET_1 float;
#X text 12 145 OUTLET_2 bang;
#X restore 335 202 pd META;
