Maybe I should do the same thing in a plugin?
No you should not. That’s just asking for troubles. The sending of Midi events is controlled by the clock of the (possibly) sound card. The timers used in Juce, which I assume you would use to time the events in a different thread is ultimately controlled by a different clock in the computers mother board. And they are not in sync and will never give you a stable, precis midi timing. It might work sufficiently for a while but is susceptible to break for any os update. Or juce update… ![]()
Have a look at this thread Inject notes to a synthesiser - Development - JUCE
It deals with the sending of midi events at precise timings and will hopefully give you a clue to solve your task.
