[linux-audio-dev] MIDI files contain strange byte sequences ?

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: [linux-audio-dev] MIDI files contain strange byte sequences ?
From: Benno Senoner (sbenno_AT_gardena.net)
Date: Fri Aug 08 2003 - 23:07:18 EEST


Hi,
I'm just writing some MIDI file ( SMF 0/1) loading routines and
while the file structure is quite simple I came across some MIDI files
(mainly .KAR (=midi + embedded lyric events)) where there are some
byte sequences that do not make sense to me.
(attaching a short hexdump at the end of mail).

Basically I read the MTrk shown below and after the
ff 01 TEXT meta event which contains the text 'Reset Volume'
there are sequences of 00 07 7f till the next ff 01 text event
'Reset Pan'.
But the midi file spec says that after each event (the Reset Volume text)
you need to read the deltatime (0 in this case) and then read the status byte
in that case 7 means running status active thus another
text event should follow.
so you interpret ff 7 as META_CUE event of length 127.
But this does not make sense since there are no 127 bytes following.
That way the midi reader gets lost and aborts.

If you look at the data after 'Reset Pan' same problem: sequences
of 00 0a 40 till the next event.

So I ask if some MIDI expert could shed some light if I missed something.
timidity seems to cope fine with these events.
(reads the file correctly and plays the lyrics too).

many thanks for your hints.

Benno.

00026e0: 004d 5472 6b00 0001 b400 ff21 0100 00ff .MTrk......!....
00026f0: 0304 4261 7373 00c1 2700 b107 6400 b10a ..Bass..'...d...
0002700: 402e c123 8142 b10a 4000 5b40 0007 0085 @..#.B..@.[@....
0002710: f810 ff01 0c52 6573 6574 2056 6f6c 756d .....Reset Volum
0002720: 6500 077f 0007 7f00 077f 0007 7f00 077f e...............
0002730: 0007 7f00 077f 0007 7f00 077f 0007 7f00 ................
0002740: 077f 0007 7f00 077f 0007 7f00 077f 0007 ................
0002750: 7f00 ff01 0952 6573 6574 2050 616e 000a .....Reset Pan..
0002760: 4000 0a40 000a 4000 0a40 000a 4000 0a40 @..@..@..@..@..@
0002770: 000a 4000 0a40 000a 4000 0a40 000a 4000 ..@..@..@..@..@.
0002780: 0a40 000a 4000 0a40 000a 4000 0a40 8140 .@..@..@..@..@.@
0002790: ff01 1052 6573 6574 2045 7870 7265 7373 ...Reset Express
00027a0: 696f 6e00 0b7f 000b 7f00 0b7f 000b 7f00 ion.............
00027b0: 0b7f 000b 7f00 0b7f 000b 7f00 0b7f 000b ................
00027c0: 7f00 0b7f 000b 7f00 0b7f 000b 7f00 0b7f ................
00027d0: 000b 7f00 ff01 1152 6573 6574 2050 6974 .......Reset Pit
00027e0: 6368 2057 6865 656c 00e1 0040 0000 4000 ch Wheel...@..@.
00027f0: 0040 0000 4000 0040 0000 4000 0040 0000 .@..@..@..@..@..
0002800: 4000 0040 0000 4000 0040 0000 4000 0040 @..@..@..@..@..@
0002810: 0000 4000 0040 0000 4000 ff01 1652 6573 ..@..@..@....Res
0

-------------------------------------------------
This mail sent through http://www.gardena.net


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Fri Aug 08 2003 - 23:18:03 EEST