Your problem is that musicTime
is not computed correctly.
A timer is not guaranteed to execute at exactly the desired time; it might be delayed by some random amount. So by adding up the desired delay, any errors will accumulate.
To get the current time, do not use relative time offsets but ask the system for an absolute time stamp.
In the case of the Sequencer, use getMicrosecondPosition
or getTickPosition
.