[seq] and information about ticks


    Oct 25 2019 | 11:42 pm
    I have a [seq] object playing a .midi file - is there any way to get any information about what is going on with the file's timing, specifically the information about ticks for each note? I know that you can send [seq] messages in ticks that alter the speed of playback, but I'm wondering how I can see the file's original timing information (in ticks). This seems like it's not possible with [seq], so I'm wondering if there's another way to get that information in MAX?

    • Oct 26 2019 | 4:26 am
      - open it with [filein] - search for "MThd " - if there is an MThd, go to bit 15 - if the first bit from 15 is "1", the files division is not set in PPQ but in SMPTE frames instead. - if the first bit is "0", from the next bit on (not sure how long?) this is the ppq number. take this number and do 60,000 / PPQ * BPM and you have the resolution/division in milliseconds. :)
    • Oct 26 2019 | 10:05 pm
      Is there an example patch you could include for how to do this? I'm not familiar with [filein]...
    • Oct 27 2019 | 12:44 am
      it is a very abstract thing but at the same also very straightforward to read in files as bits and bytes. with [filein] you could easily recreate everything what [seq] does, for example. in my opinion it is perfect for midi files. unfortunately it is sometimes a bit weird how midi specs are documented. https://www.csie.ntu.edu.tw/~r92092/ref/midi/ here trial and error used to be my best friends. i dont get the ppq part to work now without my music computer, but here is the first two "tests" #P window setfont "Sans Serif" 18.; #P window linecount 1; #P message 364 381 137 9109522 4d 54 72 6b; #P window setfont "Sans Serif" 9.; #P newex 364 349 78 9109513 prepend set; #P newex 364 302 59 9109513 zl group 4; #P newex 364 272 83 9109513 sprintf %0x; #P window setfont "Sans Serif" 18.; #P message 201 381 137 9109522 77 84 114 107; #P window setfont "Sans Serif" 9.; #P newex 201 349 78 9109513 prepend set; #P newex 201 302 59 9109513 zl group 4; #P comment 17 31 100 9109513 is it a midi file?; #P message 114 59 90 9109513 14 \, 15 \, 16 \, 17; #P message 17 59 50 9109513 0 \, 1 \, 2 \, 3; #P window setfont "Sans Serif" 18.; #P message 42 381 137 9109522 M T r k; #P window setfont "Sans Serif" 9.; #P newex 42 349 78 9109513 prepend set; #P newex 42 302 59 9109513 zl group 4; #P newex 42 272 59 9109513 itoa; #P message 515 41 50 9109513 read; #P newex 144 148 213 9109513 filein seq_sc.midi; #B color 5; #P comment 574 249 60 9109513 bang on EOF; #P comment 579 210 186 9109513 bang when "read" operation finished; #P button 557 247 15 0; #P button 557 213 15 0; #P comment 114 31 100 9109513 does it have tracks?; #P connect 5 0 7 0; #P connect 7 0 8 0; #P connect 8 0 9 0; #P connect 9 0 10 0; #P connect 12 0 5 0; #P connect 11 0 5 0; #P connect 6 0 5 0; #P connect 5 0 14 0; #P connect 14 0 15 0; #P connect 15 0 16 0; #P connect 5 0 17 0; #P connect 17 0 18 0; #P connect 18 0 19 0; #P connect 19 0 20 0; #P connect 5 2 1 0; #P connect 5 1 2 0; #P window clipboard copycount 21;
    • Oct 27 2019 | 8:24 pm
      Looks like your patch got mis-formatted or something, could you try again?