[sdiy] Tips for writing a MIDI parser wanted

Matthew Smith matt at smiffytech.com
Wed Mar 25 01:24:29 CET 2009


Quoth johnspeth at yahoo.com at 2009-03-25 01:05...
> I think the advice you've gotten from everyone has been good 
> advice.  Here's my 2 cents: In my opinion, MIDI parsing begs
> to be treated with a state machine coding approach.
> Taking into account all that you can research about MIDI and
> paying particular attention to the pitfalls described in the
> other responses, I suggest you draw a state machine of all
> MIDI incoming byes and how they shall be parsed.
> It will be a good model that you can code from.
> 
> I'm an embedded SW engineer and have been saved from buggy 
> spaghetti code many times by starting with with good written
> state machine models.  For me, drawing state machines
> is a many-times-through iterative process but the code
> that results has always been worth the effort.

I'd second this (or third it - I'm sure someone else mentioned State
Machines but can't find the post now.)

I started working on MIDI code about a month ago.  With feedback
received from this list, I started drawing up an FSM (Finite State
Machine, not Flying Spaghetti Monster ;-))  It's rare for me to do any
software design on paper but, for something like this, the visualisation
makes it all MUCH easier to understand - and see what's been missed.

Now hoping to find the time to translate it all back into C.

Cheers

M

-- 
Matthew Smith
Smiffytech - Technology Consulting & Web Application Development
Business:      http://www.smiffytech.com/
Blog/personal: http://www.smiffysplace.com/
LinkedIn:      http://www.linkedin.com/in/smiffy
Skype:         msmiffy
Twitter:       @smiffytech



More information about the Synth-diy mailing list