I am working on a music application, in Scala, to generate MIDI sequences in real time. The MIDI messages are being sent to another application (Ableton DAW) and possibly even external hardware. Accurate timing is very important for this use case, otherwise the resulting music will sound off-time.
I tried using java.util.Timer
to schedule notes on different sequences but apparently that timer can drift by hundreds of milliseconds.
What is the most accurate Timer to use in Scala (or Java) is this even a reasonable task to try to accomplish on the JVM? or maybe I'm going about this all wrong?