This project is built around least resistance principle basicly embed short code snippets into functions that acts like a pipeline from the UI.
***I really have global things all over the place unless it is local counters.****
It is fast to implement and fast to change without anything break. ***You can always pass parameters between functions later***
Regarding this specific problem you can't separate the changes you make from the structure of midi, a piano key can not be pressed twice without a release.
And that fact effect the editing of note logic if you want to keep the structure sane.
So basicly i tried to squeeze in alot of functionality as fast as possible and if i get stuck i go on with next thing.
Until i feel ready todo another iteration and straight the code up, and that usually work.
Of course such a refinement can go on forever, have not done any object oriented programming since smalltalk.
I have a feeling though that the abstraction of a project like this would be very hard to understand without some schematic.
Now this project just a pipeline stream of functions, without passing shit back and forth.
Sure there is some object structure holding the notes and some arrays, but many variables is stored in place using forms.
So the need for passing them is minimal, they are just fetched using getElementById.
But considering it really do not seem to cludge up on my computer, the approach can't be totally of the wall.
And what i find great is that anyone that wrote some lines in Basic can probably follow the program flow.