[sdiy] MIDI state machine for arpeggiator
David Brown
davebr at earthlink.net
Sun Mar 1 06:30:49 CET 2009
I'm joining this late ... but your issue is running status. There is
a "high speed" mode in MIDI where you can drop the command byte and
just send data. In this case you are getting the first note on
command and then a string of two byte sequences ... note and
velocity. You can tell that the command byte is missing in that bit
8 is 0 for data. Your interpreter has to be smart enough to handle
this. Note that in this sequence of data, you can get real time
messages interleaved at any time. These are a small subset of single
byte commands. Your interpreter has to be able to sort these out as well.
Dave
At 05:25 PM 2/28/2009, Matthew Smith wrote:
>Quoth ASSI at 2009-02-28 21:37...
>>I don't know where you expect to get the MIDI data from and if you
>>can make certain assumptions, but if it's from a master keyboard or
>>sequencer you really need to implement running status (you get just
>>one status byte and then many note/velocity pairs) and recognize
>>that a NoteOn with Velocity=0 really is a NoteOff.
>
>I think I understand. Just to confirm, rather than what I thought
>was the stream:
>
>noteon-n1-v1 noteon-n2-v2 noteon-n3-v3
>
>...where n(n) is note number and v(n) is velocity.
>
>For the same channel we may actually see:
>
>noteon-n1-v1-n2-v2-n3-v3 ... etcetera
>
>...and with v(n)=0 as part of the note on stream representing a note off.
>
>>Your state machine is not robust in the sense that when a byte goes
>>missing it doesn't synchronize at the next command byte (it would
>>swallow it when waiting for velocity for instance).
>
>So each state > 0 needs to look out for another command byte?
>
>If my understanding is correct, it's still fairly simple stuff.
>
>Many thanks for your response, Achim.
>
>Cheers
>
>M
More information about the Synth-diy
mailing list