seq and tempo

    Jun 22 2017 | 5:21 pm
    I need to play a 10 minute long MIDI filetype 1 using MAX/MSP
    The original midi file was recorded at 112.5bpm in Reaper.
    I'm using the [seq] object, together with [tempo].
    When using [tempo 112.5 1 96] the file is being played far slower than the original, and is unusable. Weirdly, when using [tempo 120 1 96] it gets better, but there's slight inaccuracies in the tempo handling which offset the whole score by a 16th note after 1 minute... and it obviously gets even worse after when arriving at the end of the file.
    I also tried using the seq object without tempo, by playing at normal speed (start 1024), but i get the same results than with [tempo 120 1 96].
    I need timing on this project to be rock solid, as the MIDI composition needs to be tightly synchronized with video, and i would preffer not to rely on a DAW to play the MIDI file....
    Any ideas on what's happening?
    Thank you very much!

    • Jun 22 2017 | 8:21 pm
      I think the problem is that the timing of [seq] is based on milliseconds. So the timing data of MIDI files (based on beats and ticks) must be converted and accumulation of rounding/truncation errors may lead to drifting playback.
      Unfortunately Max doesn't have a perfect MIDI file player.
    • Jun 23 2017 | 9:03 am
      wow... if based on ms i can understand why all this is happening.
      I just discovered that if I uncheck the option "embed tempo/timesignature changes" when exporting MIDI from reaper, i can get better accuracy when playing using seq with message "start 1024", although it is still not perfect.
      Tried again using tempo, but the midi played is very unsynchronized when playing with settings [tempo 112.5 1 96], and better when using [tempo 120 1 96]... but still not usable in my situation....
      i hope i don't need to switch to a midi daw to do this properly!!!!
    • Jun 23 2017 | 2:10 pm
      Max NEVER had any serious Midi File Playback capabilities.
      Don't waist Your time, go for whatever other solutions, Max is not going to
      do what You want, at least not with seq or seq˜ objects, by all means not with type 1
      multitrack midi files.
      Sorry to say it this way, but that is my experience.
      Did You turn overdrive on ?
      What are You syncing midi playback to ? It is not obvious in the patch You posted.
    • Jun 23 2017 | 11:21 pm
      for playing midi (the nowadays officially obsolete) [detonate] object works somehow, but detonate sucks for exporting otoh because it can create only low resolution midi files.
      if you want a proper midiplayer in max/msp you must build that around [filein]. then you can interpret the ticks and bpm data from the file in any form of "realtime" you wish and play it with super high precision.
      while it is a shame that basic things like playing midi (or filehandling for that matter) are still a mess in max, one must also take into account that half the problem here is MIDI in general.
      MIDI always was a low resolution, bad timing, idiosynchratic organinized protocol (you will also run into trouble when you try to interchange midi tracks between certain DAWs, did you know that?) so if oyu have the chance, try to avoid it and create something better.
    • Jun 23 2017 | 11:34 pm
      It’s quite sad, that max don’t play midi-files in a reliable way, but I won’t give up.
      I just made a patch last week to play and record midifiles with seq. As long as the midifile is exported in 120BpM from the DAW, it’s somehow in sync, I can change the play tempo and have even the ability to record. The start is quantized to 4n in combination with global transport. This is a work in progress patch and is made for my special needs. Comments are desired.
    • Jun 24 2017 | 10:43 am
      how can i convince you from my [filein] religion?
    • Jun 24 2017 | 12:05 pm
      @source audio: i'm syncing with a video file by sending an OSC message to trigger play in madmapper. the OSC message is sent when i press the bang button which also starts playing MIDI, with some latency adjustment using delay. The MIDI data is sent to a pipe organ, and the video file is projection-mapped on the ceiling of an art-nuveau architecture by Antoni Gaudí.
      @ben sonic: i just tried your approach using transport.... and it works perfect!!! I didn't have the offset shift during the 10 minutes of duration of my midi file. Thank you very much!! i'm going to study how your player is done and adapt it to my needs... :-DDD happy now!
      @roman thilenius: the filein strategy you suggest sounds yummy.... if it wasn't because ben's patch is already working flawlessly, i guess that would have been the way to go. I agree with your comments regarding MIDI protocol outdated features... it's not the first time i find problems in managing aspects of MIDI data, and also not the first time i post MIDI related questions to this forum....
      Thank you everyone for your suggestions and help, this had been unvaluable, as always...