This of course still misses important things like amplitude envelopes, so notes will never end on their own. Those will be added as part of audio processing.
This will serve as an example implementation for polyphonic modulation.