[linux-audio-dev] Basic MIDI question

Lee Revell rlrevell at joe-job.com
Mon Jul 24 21:09:02 UTC 2006


On Mon, 2006-07-24 at 22:57 +0200, Lars Luthman wrote:
> On Mon, 2006-07-24 at 16:38 -0400, Lee Revell wrote:
> > I've never been a MIDI expert but I'm now having to learn.  I have a
> > question about this excerpt of a MIDI file viewed with hexedit.
> > 
> > 00001BB0   22 80 3D 35  31 80 3A 39  0E 80 37 31  03 80 31 1F  ".=51.:9..71..1.
> > 00001BC0   81 0C 90 30  5B 00 90 3C  79 81 70 90  39 73 00 90  ...0[..<y.p.9s..
> > 00001BD0   36 69 4B 80  36 43 0A 80  3C 26 01 80  30 44 0A 80  6iK.6C..<&..0D..
> > 00001BE0   39 42 82 08  90 37 63 00  90 43 7B 81  70 90 3E 5E  9B...7c..C{.p.>^
> > 00001BF0   00 90 3A 66  08 80 37 30  02 80 43 32  31 80 3E 11  ..:f..70..C21.>
> > 
> > Take the sequence "80 3D 35  31 80 3A 39  0E 80 37 31  03 80 31 1F" in
> > the first line for example.  I know that 0x80 is note-off, and 0x3D are
> > note number and 0x35 the velocity of the note-off.  But what the heck is
> > the next byte, 0x31?  The MIDI standard says note-off is one status byte
> > followed by 2 data bytes!
> 
> That's the standard for MIDI that is sent realtime over a wire. When it
> is stored in a file you also need some sort of timestamp for each event.
> The extra byte is the number of clock ticks to wait before you play the
> event (since the last event).
> 

OK.  I was confused because I also see these timestamps when snooping
the MIDI output stream inside the kernel's MPU401 driver.  I guess I
assumed that aplaymidi would deliver the events with correct timing,
rather than passing the timestamps through.

I guess if I played back the same MIDI file with a full featured
sequencer, I would only see the actual MIDI events in the driver?

Also, why doesn't every event have a timestamp?  For example "81 0C 90
30  5B 00 90 3C  79 81 70"?  I guess multiple events can be scheduled in
one "tick"?

Lee




More information about the Linux-audio-dev mailing list