aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--midifile/midifile-help.pd516
-rw-r--r--midifile/midifile.c2
2 files changed, 273 insertions, 245 deletions
diff --git a/midifile/midifile-help.pd b/midifile/midifile-help.pd
index 57d3e8f..a208b82 100644
--- a/midifile/midifile-help.pd
+++ b/midifile/midifile-help.pd
@@ -1,244 +1,272 @@
-#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;
+#N canvas 375 332 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 203 523 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 -35 142 tgl 45 0 empty empty play -45 23 0 12 -24198 -1 -258699
+0 1;
+#X msg 236 474 rewind;
+#X text 86 473 go to start of file;
+#X floatatom 373 593 15 0 0 0 current_tick - -;
+#X obj 80 297 hradio 15 1 0 16 empty empty track_number 0 -6 0 12 -62784
+-241291 -1 2;
+#X msg 80 318 dump \$1;
+#X msg 199 437 68050;
+#X msg 24 262 track \$1;
+#X obj 24 222 hradio 15 1 0 16 empty empty track_number 0 -6 0 12 -62784
+-241291 -1 3;
+#X obj -35 203 metro 2;
+#X text 29 540 creation arguments: midi_file_name;
+#X text 28 519 output only this track;
+#X text 143 317 parse this track to main window;
+#X msg 260 498 0;
+#X text 87 437 goto tick 68050;
+#X floatatom 109 699 5 0 0 0 note - -;
+#X floatatom 176 699 5 0 0 1 velocity - -;
+#X floatatom 752 618 15 0 0 0 last_tick - -;
+#X msg 156 394 verbose \$1;
+#X text -21 395 verbosity defaults to 1;
+#X text -97 2 1: choose a MIDI file to play;
+#X text 18 136 2: start playing it;
+#X obj 613 558 print ****;
+#X obj 280 138 spigot;
+#X obj 319 104 tgl 25 0 empty empty loop -45 12 0 12 -4160 -257985
+-258113 0 1;
+#X msg -148 90 read \$1;
+#X floatatom 156 370 5 0 0 0 - - -;
+#X obj 156 351 hradio 15 1 0 4 empty empty verbosity 0 -6 0 12 -62784
+-241291 -1 0;
+#X obj 24 239 - 1;
+#X text 689 673 note off events;
+#X obj 280 538 midifile wowo.mid;
+#X obj 536 254 ctlout 123;
+#X msg 536 224 123;
+#X obj 280 638 route 144 145 146 147 148 149 150 151 152 153 154 155
+156 157 158 159;
+#X text 648 374 Martin Peach \, 2010;
+#X obj 109 674 unpack 0 0;
+#X obj 456 690 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 536 196 bng 15 250 50 0 empty empty all_notes_off 17 7 0 10
+-258113 -257985 -1;
+#X obj 720 558 t b b;
+#X floatatom -21 259 5 0 0 0 - - -;
+#X obj 558 558 bng 15 250 50 0 empty empty end 17 7 0 10 -258113 -257985
+-1;
+#X text 406 554 bangs at end of file:;
+#X obj -118 674 print note_on;
+#X obj -119 726 print note_off;
+#X obj 280 442 f;
+#X floatatom 298 416 9 0 0 0 loop_start_tick - -;
+#X obj 720 511 sel 1;
+#X floatatom 458 468 9 0 0 0 loop_end_tick - -;
+#X text 59 239 -1 = play all tracks;
+#X obj 752 596 f;
+#X obj 405 491 == 1e+09;
+#X text 28 572 MIDI messages are output as lists;
+#X text 116 637 select note on events:;
+#X obj 280 814 noteout 1;
+#X obj 351 814 noteout 2;
+#X obj 423 814 noteout 3;
+#X obj 494 814 noteout 4;
+#X text -73 744 select note on events:;
+#X obj 93 745 route 176 177 178 179 180 181 182 183 184 185 186 187
+188 189 190 191 192;
+#X floatatom 93 812 5 0 0 0 controller - -;
+#X floatatom 160 812 5 0 0 1 value - -;
+#X obj 93 787 unpack 0 0;
+#X obj -119 781 print controller;
+#X obj -21 859 ctlout 1;
+#X obj -27 833 f;
+#X obj -27 807 t b f;
+#X connect 0 0 33 0;
+#X connect 1 0 28 0;
+#X connect 2 0 1 0;
+#X connect 3 0 12 0;
+#X connect 4 0 33 0;
+#X connect 7 0 8 0;
+#X connect 8 0 33 0;
+#X connect 9 0 33 0;
+#X connect 10 0 33 0;
+#X connect 11 0 31 0;
+#X connect 12 0 33 0;
+#X connect 16 0 33 0;
+#X connect 21 0 33 0;
+#X connect 26 0 48 0;
+#X connect 27 0 26 1;
+#X connect 28 0 33 0;
+#X connect 29 0 21 0;
+#X connect 30 0 29 0;
+#X connect 31 0 10 0;
+#X connect 31 0 43 0;
+#X connect 33 0 36 0;
+#X connect 33 0 62 0;
+#X connect 33 1 6 0;
+#X connect 33 1 53 1;
+#X connect 33 1 54 0;
+#X connect 33 2 25 0;
+#X connect 33 2 42 0;
+#X connect 33 2 44 0;
+#X connect 35 0 34 0;
+#X connect 36 0 38 0;
+#X connect 36 0 46 0;
+#X connect 36 0 57 0;
+#X connect 36 1 58 0;
+#X connect 36 2 59 0;
+#X connect 36 3 60 0;
+#X connect 36 16 39 0;
+#X connect 38 0 18 0;
+#X connect 38 1 19 0;
+#X connect 39 0 47 0;
+#X connect 39 0 57 0;
+#X connect 39 1 58 0;
+#X connect 39 2 59 0;
+#X connect 39 3 60 0;
+#X connect 40 0 33 0;
+#X connect 41 0 35 0;
+#X connect 42 0 26 0;
+#X connect 42 1 53 0;
+#X connect 48 0 33 0;
+#X connect 49 0 48 1;
+#X connect 50 0 42 0;
+#X connect 51 0 54 1;
+#X connect 53 0 20 0;
+#X connect 54 0 50 0;
+#X connect 62 0 65 0;
+#X connect 62 0 66 0;
+#X connect 65 0 63 0;
+#X connect 65 0 69 0;
+#X connect 65 1 64 0;
+#X connect 65 1 68 1;
+#X connect 68 0 67 0;
+#X connect 69 0 68 0;
+#X connect 69 1 67 1;
+#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;
diff --git a/midifile/midifile.c b/midifile/midifile.c
index c36e80a..c0adebb 100644
--- a/midifile/midifile.c
+++ b/midifile/midifile.c
@@ -460,7 +460,7 @@ static void midifile_list(t_midifile *x, t_symbol *s, int argc, t_atom *argv)
written = midifile_write_variable_length_value(x->tmpFP, x->track_chunk[0].delta_time);
dt_written = 1;
}
- if (j == x->track_chunk[0].running_status) continue;/* don't save redundant status byte */
+ //if (j == x->track_chunk[0].running_status) continue;/* don't save redundant status byte */
if (j >= 0x80 && j <= 0xEF)x->track_chunk[0].running_status = j;/* new running status */
else if (j >= 0xF0 && j <= 0xF7)
{