[CM] midifile import

Orm Finnendahl o.finnendahl at mh-freiburg.de
Thu Mar 19 05:22:42 PDT 2009


Hi Rick,

 I doublechecked the state of affairs and as far as I can see cm isn't
doing anything wrong.

There are two things in the exported file, cm doesn't like (I
erroneously thought the 2nd was related to the NoteOffs as NoteOns
with velocity 0):

1. The time signature has a length of 2

2. There is a midi meta event of unknown type (#x0F)

The meta event is displayed by Muse as a "comment" and is containing
ascii characters. I couldn't find any information in the web about
that meta event type. Neither could I find anything about the validity
of time signatures of length 2 (the midi file format specs I have
actually quite clearly state the opposite but that might be outdated).

The fact that Rosegarden *can* import the file doesn't necessarily
mean that the file is adhering to the standard. I will wait about
comments from the Muse developers.

In order to avoid trouble with those files in my work, I changed the
respective functions to be less strict about 2 byte time signatures
(using sensible defaults and issuing a warning) and adding a "comment"
meta event type and the respective handler functions, params etc.

If anybody is interested, let me know.

Yours,
Orm


Am Mittwoch, den 18. März 2009 um 10:25:59 Uhr (-0500) schrieb Rick Taube:
> Hi are you saying you cant import a file because cm is doing something  
> wrong?
> 
> noteOn with zero velocity is valid midi and cm is explicity checking  
> for  so should parse it :
> [...]
>                       (or (= s +ml-note-off-opcode+)
>                         (and (= s +ml-note-on-opcode+)
>                              (= 0 (channel-message-data2 m))))
> 
> time signatures are four bytes and im pretty sure cm is writing and  
> reading this correctly, ie it should signal an error if it doesnt read  
> 4 bytes:
> [...]
> 		 ((= byte +ml-file-time-signature-opcode+)
> 		  (let ((len (read-variable-quantity fp)))
> 		    (unless (= len 4)
> 		      (err "unexpected time signature length: ~s" len))
> 
> if you cant import the file and the file is valid send it to me along  
> with your import statement.
> if its not valid then whatever app wrote it should be fixed, if its Cm  
> then send me the code so i can see whats going wrong
> 
> btw there is a cm function
> (midi-file-print ...)
> 
> that will print exactly what is in a valid file, you can pass it  
> a :track value for level 1 files.
> 
> 
> 
> > Hi,
> >
> > using the midifile functions of cm2 to import a file exported from
> > the Muse Sequencer I ran into the following problems:
> >
> > 1. The time signature Meta event has length 2, which throws an error
> >   (bytes 3 and 4 are simply left out).
> >
> > 2. NoteOffs are coded as NoteOns with velocity 0.
> >
> > Rosegarden can deal with these things so I'm unsure whether Muse
> > exports are valid or not (even if I couldn't find anything about 2
> > byte time signatures anywhere). As the changes are considerably small
> > I wanted to let you know and would vote for being less strict about
> > the time signature format and reinterpreting the NoteOn/Velocity 0
> > into NoteOff Messages (as this is common practice in communication
> > between devices anyway).
> >
> > Below are the respective outputs of the MIDI Track Data (in Hex) of
> > the same sequence in both forms to see the difference.
> >
> > Yours,
> > Orm
> >
> > BTW: I also left a message on muse-devel (hope that doesn't start
> > flames ;-)
> >
> > with NoteOff as NoteOn/Velocity0:
> >
> > ;dtime noteon      pitch  velo
> > 00      90           1B    7F
> > 83 00                1B    00
> > 00                   2B    7F
> > 00                   28    7F
> > 83 00                2B    00
> > 00                   28    00
> > 00                   36    7F
> > 00                   34    7F
> > 83 00                36    00
> > 00                   34    00
> >
> > with NoteOff explicitely:
> >
> > ;dtime note-on/off pitch velo
> > 00      90           1B   7F
> > 83 00   80           1B   7F
> > 00      90           2B   7F
> > 00                   28   7F
> > 83 00   80           2B   7F
> > 00                   28   7F
> > 00      90           36   7F
> > 00                   34   7F
> > 83 00   80           36   7F
> > 00                   34   7F
> >
> > _______________________________________________
> > Cmdist mailing list
> > Cmdist at ccrma.stanford.edu
> > http://ccrma-mail.stanford.edu/mailman/listinfo/cmdist
> 
> _______________________________________________
> Cmdist mailing list
> Cmdist at ccrma.stanford.edu
> http://ccrma-mail.stanford.edu/mailman/listinfo/cmdist



More information about the Cmdist mailing list