#N canvas 632 256 399 237 12; #N canvas 449 4 707 823 midifile_write 0; #X obj 15 2 bng 45 250 50 0 empty empty choose 5 23 0 8 -62784 -260818 -258699; #X obj 130 32 tgl 45 0 empty empty record 2 23 0 8 -258699 -241291 -24198 0 1; #X floatatom 314 777 15 0 0 0 tick - -; #X obj 130 150 metro 2; #X floatatom 176 127 15 0 0 0 - - -; #X msg 176 101 2.005; #X floatatom 262 206 5 0 0 0 - - -; #X floatatom 315 172 5 0 0 0 - - -; #X obj 262 276 list prepend 144; #X floatatom 371 229 5 1 16 0 - - -; #X text 368 209 channel; #X text 412 252 note-on; #X msg 72 459 verbose \$1; #X text 116 433 verbosity defaults to 1; #X text 64 14 1: open a file for writing; #X text 182 43 2: start recording; #X obj 15 181 savepanel; #X msg 107 494 240 1 2 3 4 247; #X text 221 493 a sysex message; #X obj 314 747 float; #X floatatom 72 433 5 0 3 0 - - -; #X msg 15 402 write \$1 \$2 \$3; #X msg 171 269 29; #X msg 209 269 30; #X msg 55 269 0; #X floatatom 96 313 5 0 0 0 - - -; #X text 140 311 ticks per frame; #X text 101 333 (ticks per quarter note if frames per second is zero) ; #X msg 133 269 25; #X msg 93 269 24; #X text 105 350 25 20 will give accurate timing with metro ticks at 2ms; #X obj 15 369 pack s 25 20; #X obj 261 668 midifile; #X floatatom 475 221 5 0 0 0 - - -; #X floatatom 528 184 5 0 0 0 - - -; #X floatatom 585 229 5 1 16 0 - - -; #X text 581 209 channel; #X obj 475 276 list prepend 128; #X text 37 249 time code frames per second:; #X text 269 520 default is 90 ticks per quarter note; #X msg 134 521 write filename.mid; #X msg 159 546 write filename.mid 77; #X text 319 546 77 ticks per quarter note; #X obj 195 573 cnv 15 300 20 empty empty empty 20 12 0 14 -4034 -66577 0; #X text 234 571 4: stop recording and save the file; #X msg 186 573 flush; #X obj 331 98 cnv 15 200 20 empty empty empty 20 12 0 14 -257985 -66577 0; #X text 350 99 3: input MIDI as lists; #X obj 332 116 notein; #X obj 371 253 + 143; #X text 63 723 Martin Peach \, 2010_04_25; #X obj 553 123 ctlin; #X text 626 251 controller; #X obj 585 253 + 175; #X obj 262 246 pack 0 0; #X obj 475 249 pack 0 0; #X text 261 185 note; #X text 312 152 velocity; #X text 473 202 controller; #X text 526 165 value; #X text 136 75 metro rate determines time resolution; #X text 124 401 write filename frames_per_second ticks_per_frame; #X connect 0 0 16 0; #X connect 1 0 3 0; #X connect 3 0 32 0; #X connect 4 0 3 1; #X connect 5 0 4 0; #X connect 6 0 54 0; #X connect 7 0 54 1; #X connect 8 0 32 0; #X connect 9 0 49 0; #X connect 12 0 32 0; #X connect 16 0 31 0; #X connect 17 0 32 0; #X connect 19 0 2 0; #X connect 20 0 12 0; #X connect 21 0 32 0; #X connect 22 0 31 1; #X connect 23 0 31 1; #X connect 24 0 31 1; #X connect 25 0 31 2; #X connect 28 0 31 1; #X connect 29 0 31 1; #X connect 31 0 21 0; #X connect 32 1 19 1; #X connect 32 2 19 0; #X connect 33 0 55 0; #X connect 34 0 55 1; #X connect 35 0 53 0; #X connect 37 0 32 0; #X connect 40 0 32 0; #X connect 41 0 32 0; #X connect 45 0 32 0; #X connect 48 0 6 0; #X connect 48 1 7 0; #X connect 48 2 9 0; #X connect 49 0 8 1; #X connect 51 0 33 0; #X connect 51 1 34 0; #X connect 51 2 35 0; #X connect 53 0 37 1; #X connect 54 0 8 0; #X connect 55 0 37 0; #X restore 76 116 pd midifile_write; #N canvas 391 17 790 881 midifile_read 0; #X obj 124 190 bng 15 250 50 0 empty empty step 18 7 0 12 -4160 -257985 -1; #X obj 4 45 openpanel; #X obj 4 0 bng 45 250 50 0 empty empty choose 3 23 0 12 -62784 -260818 -258699; #X obj 105 39 tgl 45 0 empty empty play 10 23 0 12 -24198 -1 -258699 1 1; #X msg 148 209 rewind; #X text 4 222 go to start of file; #X floatatom 327 383 15 0 0 0 tick - -; #X obj 407 123 hradio 15 1 0 16 empty empty track_number 0 -6 0 12 -62784 -241291 -1 0; #X msg 407 144 dump \$1; #X msg 197 258 68050; #X msg 407 59 track \$1; #X obj 407 19 hradio 15 1 0 16 empty empty track_number 0 -6 0 12 -62784 -241291 -1 0; #X obj 105 166 metro 2; #X text 382 327 creation arguments: midi_file_name; #X text 478 59 output only this track; #X text 470 143 parse this track to main window; #X msg 171 232 0; #X floatatom 151 141 15 0 0 0 - - -; #X msg 151 121 2.005; #X text 86 258 goto tick 68050; #X obj 612 370 t b b b; #X obj 658 765 float; #X floatatom 658 789 15 0 0 0 last_tick - -; #X text 395 351 bangs at end of file; #X msg 407 283 verbose \$1; #X text 452 263 verbosity defaults to 1; #X text 54 12 1: choose a MIDI file to play; #X text 155 52 2: start playing it; #X obj 612 412 spigot; #X obj 684 397 tgl 15 0 empty empty loop 17 6 0 12 -4160 -257985 -66577 1 1; #X msg 4 65 read \$1; #X floatatom 407 266 5 0 0 0 - - -; #X obj 407 251 hradio 15 1 1 4 empty empty verbosity 0 -6 0 12 -62784 -241291 -1 2; #X obj 407 37 - 1; #X text 448 37 -1 = output all tracks; #X obj 269 350 midifile wowo.mid; #X msg 35 96 read I_Wanna_Be_Sedated.mid; #X obj 269 407 list split 1; #X obj 269 467 & 240; #X obj 269 434 t f f; #X obj 314 467 & 15; #X obj 269 495 pack f f; #X obj 269 519 list append; #X obj 269 787 print noteon; #X obj 305 763 print noteoff; #X obj 341 739 print cc; #X obj 269 542 route 144 128 176 224; #X obj 377 716 print bend; #X obj 413 568 print other; #X obj 377 592 unpack f f f; #X obj 458 617 << 7; #X obj 417 637 +; #X obj 377 693 pack f f; #X text 271 812 note: noteon messages with 0 velocity are also considered "noteoff" messages... but here they will go to the noteon outlet; #X obj 417 660 - 8192; #X text 352 465 <- separate channel from status; #X text 361 787 channel \, note \, vel; #X text 405 763 channel \, note \, vel; #X text 407 740 channel \, cc_num \, val; #X text 456 717 channel \, val; #X obj 238 593 unpack 0 0 0; #X obj 278 642 s note_number; #X obj 319 620 s velocity; #X obj 195 370 print <<<; #X text 20 752 Martin Peach 2010_04_25; #X connect 0 0 35 0; #X connect 1 0 30 0; #X connect 2 0 1 0; #X connect 3 0 12 0; #X connect 4 0 35 0; #X connect 6 0 21 1; #X connect 7 0 8 0; #X connect 8 0 35 0; #X connect 9 0 35 0; #X connect 10 0 35 0; #X connect 11 0 33 0; #X connect 12 0 35 0; #X connect 16 0 35 0; #X connect 17 0 12 1; #X connect 18 0 17 0; #X connect 20 0 28 0; #X connect 20 1 4 0; #X connect 20 2 3 0; #X connect 20 2 21 0; #X connect 21 0 22 0; #X connect 24 0 35 0; #X connect 28 0 3 0; #X connect 29 0 28 1; #X connect 30 0 35 0; #X connect 31 0 24 0; #X connect 32 0 31 0; #X connect 33 0 10 0; #X connect 35 0 37 0; #X connect 35 0 63 0; #X connect 35 1 6 0; #X connect 35 2 20 0; #X connect 36 0 35 0; #X connect 37 0 39 0; #X connect 37 1 42 1; #X connect 38 0 41 0; #X connect 39 0 38 0; #X connect 39 1 40 0; #X connect 40 0 41 1; #X connect 41 0 42 0; #X connect 42 0 46 0; #X connect 46 0 43 0; #X connect 46 0 60 0; #X connect 46 1 44 0; #X connect 46 2 45 0; #X connect 46 3 49 0; #X connect 46 4 48 0; #X connect 49 0 52 0; #X connect 49 1 51 0; #X connect 49 2 50 0; #X connect 50 0 51 1; #X connect 51 0 54 0; #X connect 52 0 47 0; #X connect 54 0 52 1; #X connect 60 1 61 0; #X connect 60 2 62 0; #X restore 76 83 pd midifile_read; #X text 15 10 midifile reads and writes MIDI files.; #X text 152 170 2008 Martin Peach;