[CM] midifile import

Heinrich Taube taube at uiuc.edu
Wed Mar 18 08:25:59 PDT 2009


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



More information about the Cmdist mailing list