[sdiy] MIDI State Machine diagram - please comment
ASSI
Stromeko at nexgo.de
Wed May 6 19:06:49 CEST 2009
On Mittwoch, 6. Mai 2009, johnspeth at yahoo.com wrote:
> http://mysite.verizon.net/jspeth/MIDI_FSM.pdf
>
> If you're interested, please look it over and comment. It
> represents *my* understanding of how MIDI works. It may be
> incorrect but I'd sure like to know if it's wrong or how the
> diagram can be improved. Keep in mind the scope of MIDI support is
> limited to what is drawn. I expect it to tolerate unsupported MIDI
> messages without any problems.
So you don't intend to support more than one MIDI channel, no PitchMod
and no CC (esp. Sustain)?
Conceptually it's easier to think of System Real Time as 1-byte
sidechannel data that can be split off in the receive buffer and
diverted to a separate state machine (or dropped, in your case). That
way you don't have to deal with it in every state of the "main" FSM.
As far as the main FSM goes, I would just have one dispatcher state
that forks off into a "collect 2 more bytes" state for all status
bytes except sysex, which just loops until EOX. Both these substates
need to terminate on encountering a status byte (which is not a
failure condition for SysEx). If the dispatcher state gets a non-
status byte, it prepends the last valid status (running status) or
drops the byte if it hasn't received one. That gets you properly
"normalized" three-byte MIDI messages that can then be parsed to your
heart's wishes ( which you can again model as an FSM if you want).
Only then would I deal with channel and message filters and construct
trigger and gate signals and the like.
Achim.
--
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk]>+
SD adaptations for KORG EX-800 and Poly-800MkII V0.9:
http://Synth.Stromeko.net/Downloads.html#KorgSDada
More information about the Synth-diy
mailing list