I think Lindon meant that in Note On, you would play your artificial note, storing its ID into a variable, then call Synth.attachNote()
Yes I think I meant the same. I'll just go ahead and implement it, then we can discuss what I did wrong :)
If the per-note event ID array model is not a good fit for your project for any reason
That's the entire point of having an ID attached to an event, there should be no use case where the event ID can't be used for note identification - it's far more robust than note-number or MIDI channel (read MPE) identification, so there is absolutely no reason to switch to another data model (except you have a very narrow use case and can trim some overhead).
The issue you had at the beginning of the post was an outlier because of how the internals of the sampler module work(ed) and I'm sure there are other edge cases like this lurking in the shadows but in general you should always rely on the ID for, well, IDentifying any event.
it doesn't work if a simple chord causes parallel note-on execution that overwrites your artificial note ID unless you have proper storage (per-note array, x per-channel for MPE).
Have you checked out the snippet from the docs I posted (the chord script)? This will still work with messages at the same timestamp.