Just a very quick round up of some Flash MIDI links I found today:
http://www.alexisisaac.net/products/flashMidi
http://code.google.com/p/as3midilib/
http://code.google.com/p/midas3/
(it appears these guys are working on some kind of instrument built atop their midi stuff too…)
As far as generative music goes, this seems way advanced: http://supercollider.sourceforge.net/
Not really sure if it applies to what I’m thinking about, if it could be adapted to Flash at all…