Getting BPM track from a Midi file


    Oct 18 2007 | 10:27 pm
    Dear all,
    I'm looking for a solution to parse in Max a standard Midi file and obtain its BPM track, with any possible variation.
    I would like to do this when the file is loaded, without parse the whole file in real-time.
    Many thanks

    • Oct 18 2007 | 10:48 pm
      Set Tempo
      This meta event sets the sequence tempo in terms of microseconds per
      quarter-note which is encoded in three bytes. It usually is found in the
      first track chunk, time-aligned to occur at the same time as a MIDI
      clock message to promote more accurate synchronization. If no set tempo
      event is present, 120 beats per minute is assumed. The following
      formula's can be used to translate the tempo from microseconds per
      quarter-note to beats per minute and back.
      MICROSECONDS_PER_MINUTE = 60000000
      BPM = MICROSECONDS_PER_MINUTE / MPQN
      MPQN = MICROSECONDS_PER_MINUTE / BPM
      I assume the app that creates the MIDI file must insert this event.
      Anthony
      ----- Original Message -----
      From: Bruno Zamborlin
      Date: Thursday, October 18, 2007 5:28 pm
      Subject: [maxmsp] Getting BPM track from a Midi file
      >
      > Dear all,
      > I'm looking for a solution to parse in Max a standard Midi file and
      > obtain its BPM track, with any possible variation.
      >
      > I would like to do this when the file is loaded, without parse the
      > whole file in real-time.
      >
      > Many thanks
      > --
      > Bruno
      >
      > www.brunozamborlin.com
      > www.myspace.com/brunozamborlin
      >
    • Oct 19 2007 | 11:28 am
      Thank you Anthony.
      However, I'm looking for a solution to get the whole tempo track, not just the inizial BPM.
      I would like to fill an "envi" or "function" max object with the tempo track of the midi file I load.
      Should I write myself a parser in C or does it exist something I could use it?
      Thank again
    • Oct 19 2007 | 3:37 pm
      If you wanted to parse it yourself, then you would have to go
      through all the data and keep track of the change of events in
      relation to each other. Unfortunately Max does not have and handy
      object that lets you step through MIDI events. "Seq" is pretty
      limited. If you are adept at coding and can write your own
      externals then that is probably the way to go. Alternately
      one could do it is by using javascript file i/o.
    • Oct 19 2007 | 4:06 pm
      http://www.maxobjects.com/?
      PHPSESSID=ee4c00ac5819960883c12fb4d31be108&PHPSESSID=ee4c00ac5819960883c
      12fb4d31be108&request=midifile&operateur=AND&id_plateforme=0&Submit=OK
      psw.midifile-parser is what you are looking for
      hth
      /*j
      On 19.10.2007, at 13:28, Bruno Zamborlin wrote:
      >
      > Thank you Anthony.
      >
      > However, I'm looking for a solution to get the whole tempo track,
      > not just the inizial BPM.
      >
      > I would like to fill an "envi" or "function" max object with the
      > tempo track of the midi file I load.
      >
      > Should I write myself a parser in C or does it exist something I
      > could use it?
      >
      > Thank again
      > --
      > Bruno
      >
      > www.brunozamborlin.com
      > www.myspace.com/brunozamborlin