theoretically you can’t solve this over a class compliant USB MIDI interface
but lets take one step back
Id like to change this statement slightly…
modern OS’s do not put MIDI at low priority, they put USB serial traffic as ‘low priority’, which happens to include midi.
the reason is ,this is what we usually want… imagine write a file to a USB drive, we don’t care about it being written in bursts, we dont want out computer locking up whilst that file is written - so, arguably USB midi chose the wrong protocol (see below)
“Ah, but what about USB soundcards” , I hear you cry, very true these are sample accurate , and have to be - they work because they use USB isosynchronous protocol. in this protocol you don’t push bits of data at it, you have a time based delivery protocol.
(this is how things like E-RM all work, they basically use this isosynchronous protocol, which by the way can be used for anything not just sound)
why not use isosynchronous for standard USB Midi? well because its low volume data, and its also a more complex protocol, so they chose not to use it, to make it easy for manufactures to adopt - so now we are stuck with the standard
“But my computer works fine with USB midi”… yup thats why I said “theoretically”
in theory you need a real time OS to do audio properly, but desktops today have so much spare processing power, that if we configure them correctly (and don’t overload them) , we have no issues with them doing audio.
the same is partly true of USB midi , if you make sure your computer is setup to have plenty of IO and CPU capacity, and you don’t overload it… then it will work fine too, the issue is… you only need one rogue process or one rogue device, and suddenly your perfect sync can be go. (note: unlike audio, you have to be careful with all IO, and not use CPU)
this is why people have different experiences, even those that have powerful setups, can still can get issues , whilst others with more modest system have no issue… you are only as good as your weakest link.
of course then there is ‘expectation’, this can be a bit like ‘pixel peeking’ in digital photography, the more you look for the perfect timing, the more elusive it becomes… whilst someone else sitting back, more relaxed about it, will be happy with a bit of jitter/drift (after all real musicians drift/jitter too )
last note, bare in mind , midi is serial… so if you send thousands of messages , you can delay a clock signal! (even over din/without a computer)
I did go through a phase of really getting wound up , trying to perfect sync… and reduce latency, but these days I try to just get something I’m ‘happy with’, and spend time playing rather than zooming in on audio timelines trying to get things to align to the grid.
sometimes I succeed, and I freely admit at other times I dont and fall back into worrying about micro timing