Duration of midi file

Apr 8, 2006 at 6:41am

Duration of midi file

Does anybody know a way of finding out the length of a midifile without
having to play through it? (i.e. something akin to sfinfo~ for midi
files)

I’m working on a patch that converts a midi-file to a bitmasked
buffer~. Currently I’m playing through the file in real-time, but it
there’s a faster way, it’d be nice…

thanks,

Peter McCulloch

#25299
Apr 8, 2006 at 10:03am

I do this with jit.qt.movie. Quicktime reads and plays midi files so you
can read them into jit.qt.movie, ask the right questions, et voila!

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P message 407 67 29 196617 stop;
#P flonum 305 194 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 305 163 27 196617 / 1.;
#P newex 305 132 123 196617 route duration timescale;
#P message 254 68 146 196617 read , gettimescale , getduration;
#P message 350 68 29 196617 stop;
#P newex 253 101 125 196617 jit.qt.movie @autostart 0;
#P comment 349 196 100 196617 duration in seconds;
#P connect 7 0 1 0;
#P connect 1 1 4 0;
#P connect 3 0 1 0;
#P connect 2 0 1 0;
#P connect 5 0 6 0;
#P connect 4 0 5 0;
#P connect 4 1 5 1;
#P window clipboard copycount 8;

Cheers,
Gary Lee Nelson
TIMARA Department
Oberlin College
http://www.timara.oberlin.edu/GaryLeeNelson

#74360
Apr 9, 2006 at 8:16am

Java ? You may use the javax.sound.midiFileFormat class, then request
its microsecondsLength (long) field/property. I’m about to put it in my
MidiConverter object, in order to make it a kind of [mfinfo], for those
who don’t own Jitter (as Gar says, you may also use jit.qt.movie for
this…)

f.e

#74361
Apr 9, 2006 at 2:51pm

Any chance you have a java applet that plays type 1 midi files?

Cheers,
Gary Lee Nelson
TIMARA Department
Oberlin College
http://www.timara.oberlin.edu/GaryLeeNelson

#74362

You must be logged in to reply to this topic.