Time shift?

After recording a midi track into an audio track I observed a time shift of ~40 ms, which is shown here:

i.e. the audio signal is shifted by -40 ms relative to the midi notes.

The same I observed when recording midi data into a midi track. Does anyone know why this happens? Is it some latency issue?

The short answer is yes, it is some sort of latency issue, specifically latency compensation issue.

The longer answer is that Ardour is trying to compensate for some latency that is reported somewhere, possibly incorrectly compensating for audio IO latency when you are recording one track to another, or possibly your MIDI synth plugin is reporting it’s latency incorrectly causing Ardour to compensate incorrectly for the actual latency. It is a bit more difficult to tell exactly where the problem lies without some more detailed testing though.

Two questions:

  1. Does the latency change if you change your audio card buffer settings?

  2. Does the latency change or maybe even disappear if you use a different synth plugin?


Actually I just noticed something that could explain it, it looks like you have three inputs routed to your audio track(I would expect a single input for a mono audio track from the output of your MIDI track for what you seem to be doing), is it possible you still have a physical input from your sound card routed there? If so can you remove all inputs except from the MIDI track and try again and see if that corrects it?


“If so can you remove all inputs except from the MIDI track and try again and see if that corrects it?”

That’s not the problem. Now it works with 3 or 2 inputs. I can’t reproduce it at the moment (restarted Ardour)… strange. I’ll do some more test over the weekend. Thank you!

Note that if you use a USB audio/MIDI interface, the latency will change every time it is used. This is a feature of the USB2 audio interface class design.

I don’t think I ever realized before that USB interface latency changed every time. Is that on the order of the 1ms USB frame, or multiple frames?

Just did some tests again: Send midi track (see pic below) contains the QMidiArp which is synchronized to the tempo of Ardour. The notes are recorded to Track Piano Midi. While recording they seems to have the right quantization, but after stopping the recorded notes are shifted to the left.

The offset changes with buffer size of Jack and is close to zero at 128.

For audio it was independent of the buffer size now and it was always correct. So latency correction seems to work here?Don’t know what was wrong yesterday though …