[sdiy] Tips for writing a MIDI parser wanted
Jason Tribbeck
Jason.Tribbeck at ascom.com
Tue Mar 24 12:10:51 CET 2009
Hi,
> What do you think? Am I on the right track? Anything I need to know?
> Anything I'm forgetting?
I'd say that broadly that's correct - there's a couple of things you may
need to worry yourself about though.
Firstly, MIDI doesn't need the command byte to be resent if it's the
same. This means that if you have two note-on events on the same
channel, this could be done as either 5 or 6 bytes:
91 40 50 4d 50
Is the same as:
91 40 50 91 4d 50
So, you'll need to keep track of the current command byte value.
Secondly, sysex would need to be checked. If you don't support sysex,
then this is easy (especially as you need to keep track of the current
command byte) - just throw everything away when you get a sysex until
the next control byte.
In essence, I'd do something like:
- If byte is command byte, store new command byte, zero data byte
counter
- If current command byte is "interesting", store data byte
- If I have enough data bytes for the command, process the sequence and
zero data byte counter
--
Jason Tribbeck
More information about the Synth-diy
mailing list