I just noticed that the \midi event type seems to ignore \timingOffset. This is a bit of a disaster for me as I use \timingOffset a lot and also use hardware synths a lot.
Is there a technical reason for this, for example, does \timingOffset depend on some feature of OSC? Can anyone suggest a workaround? It’s not just a question of playing with \dur, since \dur affects the timing of the next event, not the current one.
Thanks for having a look! If you are not comfortable with making a PR, you could open an issue with your findings and include some code that seems to solve the problem. The main thing is that the issue gets reported.
Thanks. I meant that at the point in the code I was making the change, I wasn’t sure if the adjustment from the user-added value to take account of tempo has already been done or I needed to implement it myself.
If lag is in seconds, then you can’t just add timingOffset in beats.
Following the behavior of the schedBundle functions, the message sends should be scheduled: thisThread.clock.sched(timingOffset, { ... }). Scheduling is the only really correct way because the tempo could change.
What I’m not sure about is whether we support an array for timingOffset or not. If not (if it’s always expected to be a number), then you could schedule the entire do loop. If an array is permitted, then it would be necessary to schedule individual message sends separately.
Not exactly related, but on Windows note also that latency key doesn’t work with \midi Events.
I mention this because if you’re using MIDI on Windows and also need to “shift” timing a bit to make hardware devices sync up with the Server, then you need to use a workaround.