here's an old sequencer i did with data structures...not sure if it ever really worked properly, but it might give you some ideas. http://puredata.hurleur.com/sujet-445-logic-audio-style-matrix-editor