View Issue Details

IDProjectCategoryView StatusLast Update
0009381ardourbugspublic2023-06-16 21:53
Reporteraggraef Assigned Tox42  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionno change required 
Product Version7.4 
Summary0009381: MIDI clock starts 1 quarter note late
DescriptionRunning the latest git version of Ardour. This will affect all external devices and programs syncing to MIDI clock from Ardour. The synced gear will start playback one quarter note too late.

Looking at the MIDI clock and note output from Ardour in aseqdump and kmidimon, it seems that the MIDI clock indeed starts one quarter note late. The attached log from aseqdump clearly shows this. In fact, the emitted Song Position Pointer message indicates an SPP of 4 (= 4/16 = 1 quarter note), which is consistent with the clock starting one beat late.

Is this by design? Or is there some setting in the preferences which does this? An obvious work-around is to start playback in Ardour 1 quarter note in advance, but this shouldn't be necessary IMHO.
Steps To ReproduceThe attached aseqdump log was created using the attached simple session with 4 quarter notes in one bar, using the Play Region option. MIDI clock generation is enabled in the preferences, and sync is set to internal. I captured the MIDI output from the MIDI track along with Ardour's MIDI clock output, to better see what's going on there.
TagsNo tags attached.

Activities

aggraef

2023-06-14 05:28

reporter  

aseqdump.txt (3,543 bytes)   
Waiting for data. Press Ctrl+C to end.
Source  Event                  Ch  Data
  0:1   Port subscribed            130:0 -> 134:0
 14:0   Note on                 0, note 60, velocity 64
 14:0   Song position pointer      value 4
 14:0   Continue
 14:0   Clock
 14:0   Note off                0, note 60, velocity 64
 14:0   Note on                 0, note 60, velocity 64
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Note off                0, note 60, velocity 64
 14:0   Note on                 0, note 60, velocity 64
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Note off                0, note 60, velocity 64
 14:0   Note on                 0, note 60, velocity 64
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Clock
 14:0   Note off                0, note 60, velocity 0
 14:0   Stop
 14:0   Control change          0, controller 64, value 0
 14:0   Control change          0, controller 123, value 0
 14:0   Control change          1, controller 64, value 0
 14:0   Control change          1, controller 123, value 0
 14:0   Control change          2, controller 64, value 0
 14:0   Control change          2, controller 123, value 0
 14:0   Control change          3, controller 64, value 0
 14:0   Control change          3, controller 123, value 0
 14:0   Control change          4, controller 64, value 0
 14:0   Control change          4, controller 123, value 0
 14:0   Control change          5, controller 64, value 0
 14:0   Control change          5, controller 123, value 0
 14:0   Control change          6, controller 64, value 0
 14:0   Control change          6, controller 123, value 0
 14:0   Control change          7, controller 64, value 0
 14:0   Control change          7, controller 123, value 0
 14:0   Control change          8, controller 64, value 0
 14:0   Control change          8, controller 123, value 0
 14:0   Control change          9, controller 64, value 0
 14:0   Control change          9, controller 123, value 0
 14:0   Control change         10, controller 64, value 0
 14:0   Control change         10, controller 123, value 0
 14:0   Control change         11, controller 64, value 0
 14:0   Control change         11, controller 123, value 0
 14:0   Control change         12, controller 64, value 0
 14:0   Control change         12, controller 123, value 0
 14:0   Control change         13, controller 64, value 0
 14:0   Control change         13, controller 123, value 0
 14:0   Control change         14, controller 64, value 0
 14:0   Control change         14, controller 123, value 0
 14:0   Control change         15, controller 64, value 0
 14:0   Control change         15, controller 123, value 0
aseqdump.txt (3,543 bytes)   

x42

2023-06-14 16:01

administrator   ~0027756

I cannot reproduce this with Ardour/ALSA. Are you using JACK? Can you provide the output of `jack_lsp -lc` ?

Keep in mind that Ardour applies latency compensation. Ardour sends the Mclk "start" message before starting to roll, so that by the time Ardour starts rolling at 1|1|0, the message is already at the MIDI output.
If that is not possible (e.g. jack-transport), then Ardour will queue up the next possible start location.

I've just tested with with a MIDI loopback cable: delta time is in samples. It is a bit jittery and since it's a USB device (running at 48kHz - clock messages should be sent in 1000 sample intervals).
[....]
+      492816          NoteOn chn  1 3c 40
+          48           Start
+           1           Clock
+         831           Clock
+        1028           Clock
+        1019           Clock
+         993           Clock
+         976           Clock
+        1024           Clock
+         976           Clock
+        1023           Clock
+         976           Clock
+        1025           Clock
+         976           Clock
+        1023           Clock
+         975           Clock
+        1026           Clock
+         975           Clock
+        1025           Clock
+         977           Clock
+        1022           Clock
+        1025           Clock
+         976           Clock
+        1072           Clock
+         880           Clock
+        1074           Clock
+         973         NoteOff chn  1 3c 40
+          47          NoteOn chn  1 3c 40
+          49           Clock
+         897           Clock
+         975           Clock
+        1024           Clock
+         978           Clock
+        1024           Clock
+         972           Clock
+        1027           Clock
+         975           Clock
+        1025           Clock
+         977           Clock
+        1021           Clock
+         980           Clock
+        1023           Clock
+         976           Clock
+        1024           Clock
+         975           Clock
+        1024           Clock
+        1022           Clock
+         981           Clock
+         973           Clock
+        1022           Clock
+        1027           Clock
+         945           Clock
+        1069         NoteOff chn  1 3c 40
+          31          NoteOn chn  1 3c 40
+          50           Clock
+         895           Clock
+         976           Clock
+         978           Clock
+        1021           Clock
+        1025           Clock
+         977           Clock
+         976           Clock
+        1023           Clock
+         976           Clock
+        1025           Clock
+         976           Clock
+        1024           Clock
+         977           Clock
+        1071           Clock
+         976           Clock
+        1025           Clock
+         928           Clock
+        1073           Clock
+         943           Clock
+        1024           Clock
+         976           Clock
+        1026           Clock
+         973           Clock
+        1024         NoteOff chn  1 3c 40
+          47          NoteOn chn  1 3c 40
+          80           Clock
+         849           Clock
+        1025           Clock
+         979           Clock
+        1020           Clock
+         976           Clock
+        1025           Clock
+         974           Clock
+        1026           Clock
+         975           Clock
+        1021           Clock
+        1029           Clock
+         973           Clock
+        1072           Clock
+         930           Clock
+         974           Clock
+         993           Clock
+        1057           Clock
+         944           Clock
+        1022           Clock
+         977           Clock
+        1024           Clock
+         976           Clock
+        1023           Clock
+        1026         NoteOff chn  1 3c 00
+          48           Clock
+         927           Clock
+         988           Clock
+        1013           Clock
+         976           Clock
+        1023           Clock
+         976           Clock
+        1024           Clock
+        1021           Clock
+         981           Clock
+        1022           Clock
+         929           Clock
+        1024           Clock
+        1021           Clock
+         994           Clock
+         977           Clock
+        1024           Clock
+         975           Clock
+        1024           Clock
+         975           Clock
+        1023           Clock
+         977           Clock
+         831            Stop

aggraef

2023-06-14 17:24

reporter   ~0027757

Yes, I'm running Jack (Jack2 to be precise), and using a2jmidid to hook up Ardour's MIDI clock output port to other apps such as Pd.

I'd try with ALSA, but in that case I have no idea how to send the MIDI clocks from Ardour to another ALSA MIDI app, without having to fiddle around with actual real-world MIDI loopback cables. ;-)

This can't be a latency compensation issue, the MIDI clocks start rolling an entire quarter note late. Unfortunately, aseqdump doesn't print any timestamps, so this isn't obvious from the log I posted. But I can see in kmidimon that the first note plays, then nothing happens for almost a quarter note, then a few ticks before the second note I get the SPP message, and then the MIDI clocks start rolling at the exact same time the note off from the previous note and the note on from the second note. Thus the timing is exactly what I'd expect it to be, it's just that the MIDI clocks start an entire quarter note late. :(

Here's the output of `jack_lsp -lc` (yeah, I have a lot of USB MIDI devices hooked up to this machine, including a mioXM box).

~~~
system:capture_1
   PulseAudio JACK Source:front-left
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 256 256 ] frames
system:capture_2
   PulseAudio JACK Source:front-right
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 256 256 ] frames
system:playback_1
   PulseAudio JACK Sink:front-left
    port playback latency = [ 512 512 ] frames
    port capture latency = [ 0 0 ] frames
system:playback_2
   PulseAudio JACK Sink:front-right
    port playback latency = [ 512 512 ] frames
    port capture latency = [ 0 0 ] frames
PulseAudio JACK Source:front-left
   system:capture_1
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 256 256 ] frames
PulseAudio JACK Source:front-right
   system:capture_2
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 256 256 ] frames
a2j:Midi Through [14] (capture): Midi Through Port-0
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 0 0 ] frames
a2j:Midi Through [14] (playback): Midi Through Port-0
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 0 0 ] frames
a2j:APC mini mk2 [24] (capture): APC mini mk2 APC mini mk2 Contr
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 0 0 ] frames
a2j:APC mini mk2 [24] (playback): APC mini mk2 APC mini mk2 Contr
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 0 0 ] frames
a2j:APC mini mk2 [24] (capture): APC mini mk2 APC mini mk2 Notes
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 0 0 ] frames
a2j:APC mini mk2 [24] (playback): APC mini mk2 APC mini mk2 Notes
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 0 0 ] frames
a2j:AG06/AG03 [36] (capture): AG06/AG03 MIDI 1
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 0 0 ] frames
a2j:AG06/AG03 [36] (playback): AG06/AG03 MIDI 1
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 0 0 ] frames
a2j:MPK mini Plus [40] (capture): MPK mini Plus MIDI 1
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 0 0 ] frames
a2j:MPK mini Plus [40] (playback): MPK mini Plus MIDI 1
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 0 0 ] frames
a2j:MPK mini Plus [40] (capture): MPK mini Plus MIDI 2
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 0 0 ] frames
a2j:MPK mini Plus [40] (playback): MPK mini Plus MIDI 2
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (capture): mioXM DIN 1
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (playback): mioXM DIN 1
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (capture): mioXM DIN 2
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (playback): mioXM DIN 2
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (capture): mioXM DIN 3
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (playback): mioXM DIN 3
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (capture): mioXM DIN 4
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (playback): mioXM DIN 4
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (capture): mioXM HST 1
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (playback): mioXM HST 1
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (capture): mioXM HST 2
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (playback): mioXM HST 2
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (capture): mioXM HST 3
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (playback): mioXM HST 3
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (capture): mioXM HST 4
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (playback): mioXM HST 4
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (capture): mioXM HST 5
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (playback): mioXM HST 5
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (capture): mioXM HST 6
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (playback): mioXM HST 6
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (capture): mioXM HST 7
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (playback): mioXM HST 7
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (capture): mioXM HST 8
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (playback): mioXM HST 8
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (capture): mioXM Preset Selector
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (playback): mioXM Preset Selector
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (capture): mioXM RSV 1
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (playback): mioXM RSV 1
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (capture): mioXM RSV 2
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (playback): mioXM RSV 2
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (capture): mioXM RSV 3
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (playback): mioXM RSV 3
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 0 0 ] frames
a2j:STARRYPAD [48] (capture): STARRYPAD MIDI 1
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 0 0 ] frames
a2j:STARRYPAD [48] (playback): STARRYPAD MIDI 1
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 0 0 ] frames
a2j:QmidiNet [128] (capture): port 0
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 0 0 ] frames
a2j:QmidiNet [128] (playback): port 0
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 0 0 ] frames
a2j:QmidiNet [128] (capture): port 1
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 0 0 ] frames
a2j:QmidiNet [128] (playback): port 1
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 0 0 ] frames
a2j:QmidiNet [128] (capture): port 2
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 0 0 ] frames
a2j:QmidiNet [128] (playback): port 2
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 0 0 ] frames
a2j:QmidiNet [128] (capture): port 3
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 0 0 ] frames
a2j:QmidiNet [128] (playback): port 3
    port playback latency = [ 0 0 ] frames
    port capture latency = [ 0 0 ] frames
PulseAudio JACK Sink:front-left
   system:playback_1
    port playback latency = [ 512 512 ] frames
    port capture latency = [ 0 0 ] frames
PulseAudio JACK Sink:front-right
   system:playback_2
    port playback latency = [ 512 512 ] frames
    port capture latency = [ 0 0 ] frames
~~~

aggraef

2023-06-14 18:15

reporter   ~0027758

It seems that a2jmidid is the culprit. Ardour just doesn't like it, and even says so with a red flashing "No Align" LED.

With jack2 and its built-in seq Jack MIDI driver everything works fine.

Sorry for the false alarm, this ticket can be closed. Case of PEBCAK. :)

x42

2023-06-14 20:01

administrator   ~0027759

It seems that a2j does not correctly set port-latencies. They are all zero. Physical playback ports should report at least the buffersize.
I don't see any Ardour connections in the list though, so it's hard to determine if there is some additional issue.

aggraef

2023-06-14 21:19

reporter   ~0027760

Oops, sorry, here's a more complete log.
jack_lsp.txt (15,104 bytes)   
system:capture_1
   PulseAudio JACK Source:front-left
   pure_data_0:input0
   ardour:physical_audio_input_monitor_enable
	port playback latency = [ 0 512 ] frames
	port capture latency = [ 256 256 ] frames
system:capture_2
   PulseAudio JACK Source:front-right
   pure_data_0:input1
   ardour:physical_audio_input_monitor_enable
	port playback latency = [ 0 512 ] frames
	port capture latency = [ 256 256 ] frames
system:playback_1
   PulseAudio JACK Sink:front-left
   pure_data_0:output0
   ardour:Click/audio_out 1
   ardour:Master/audio_out 1
   qsynth:left
	port playback latency = [ 512 512 ] frames
	port capture latency = [ 0 256 ] frames
system:playback_2
   PulseAudio JACK Sink:front-right
   pure_data_0:output1
   ardour:Master/audio_out 2
   qsynth:right
	port playback latency = [ 512 512 ] frames
	port capture latency = [ 0 256 ] frames
PulseAudio JACK Source:front-left
   system:capture_1
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 256 256 ] frames
PulseAudio JACK Source:front-right
   system:capture_2
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 256 256 ] frames
a2j:Midi Through [14] (capture): Midi Through Port-0
   ardour:physical_midi_input_monitor_enable
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
a2j:Midi Through [14] (playback): Midi Through Port-0
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
a2j:APC mini mk2 [24] (capture): APC mini mk2 APC mini mk2 Contr
   ardour:physical_midi_input_monitor_enable
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
a2j:APC mini mk2 [24] (playback): APC mini mk2 APC mini mk2 Contr
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
a2j:APC mini mk2 [24] (capture): APC mini mk2 APC mini mk2 Notes
   ardour:physical_midi_input_monitor_enable
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
a2j:APC mini mk2 [24] (playback): APC mini mk2 APC mini mk2 Notes
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
a2j:AG06/AG03 [36] (capture): AG06/AG03 MIDI 1
   ardour:physical_midi_input_monitor_enable
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
a2j:AG06/AG03 [36] (playback): AG06/AG03 MIDI 1
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
a2j:MPK mini Plus [40] (capture): MPK mini Plus MIDI 1
   ardour:physical_midi_input_monitor_enable
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
a2j:MPK mini Plus [40] (playback): MPK mini Plus MIDI 1
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
a2j:MPK mini Plus [40] (capture): MPK mini Plus MIDI 2
   ardour:physical_midi_input_monitor_enable
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
a2j:MPK mini Plus [40] (playback): MPK mini Plus MIDI 2
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (capture): mioXM DIN 1
   ardour:physical_midi_input_monitor_enable
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (playback): mioXM DIN 1
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (capture): mioXM DIN 2
   ardour:physical_midi_input_monitor_enable
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (playback): mioXM DIN 2
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (capture): mioXM DIN 3
   ardour:physical_midi_input_monitor_enable
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (playback): mioXM DIN 3
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (capture): mioXM DIN 4
   ardour:physical_midi_input_monitor_enable
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (playback): mioXM DIN 4
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (capture): mioXM HST 1
   ardour:physical_midi_input_monitor_enable
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (playback): mioXM HST 1
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (capture): mioXM HST 2
   ardour:physical_midi_input_monitor_enable
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (playback): mioXM HST 2
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (capture): mioXM HST 3
   ardour:physical_midi_input_monitor_enable
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (playback): mioXM HST 3
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (capture): mioXM HST 4
   ardour:physical_midi_input_monitor_enable
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (playback): mioXM HST 4
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (capture): mioXM HST 5
   ardour:physical_midi_input_monitor_enable
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (playback): mioXM HST 5
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (capture): mioXM HST 6
   ardour:physical_midi_input_monitor_enable
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (playback): mioXM HST 6
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (capture): mioXM HST 7
   ardour:physical_midi_input_monitor_enable
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (playback): mioXM HST 7
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (capture): mioXM HST 8
   ardour:physical_midi_input_monitor_enable
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (playback): mioXM HST 8
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (capture): mioXM Preset Selector
   ardour:physical_midi_input_monitor_enable
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (playback): mioXM Preset Selector
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (capture): mioXM RSV 1
   ardour:physical_midi_input_monitor_enable
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (playback): mioXM RSV 1
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (capture): mioXM RSV 2
   ardour:physical_midi_input_monitor_enable
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (playback): mioXM RSV 2
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (capture): mioXM RSV 3
   ardour:physical_midi_input_monitor_enable
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
a2j:mioXM [44] (playback): mioXM RSV 3
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
a2j:STARRYPAD [48] (capture): STARRYPAD MIDI 1
   ardour:physical_midi_input_monitor_enable
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
a2j:STARRYPAD [48] (playback): STARRYPAD MIDI 1
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
a2j:QmidiNet [128] (capture): port 0
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
a2j:QmidiNet [128] (playback): port 0
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
a2j:QmidiNet [128] (capture): port 1
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
a2j:QmidiNet [128] (playback): port 1
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
a2j:QmidiNet [128] (capture): port 2
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
a2j:QmidiNet [128] (playback): port 2
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
a2j:QmidiNet [128] (capture): port 3
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
a2j:QmidiNet [128] (playback): port 3
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
PulseAudio JACK Sink:front-left
   system:playback_1
	port playback latency = [ 512 512 ] frames
	port capture latency = [ 0 0 ] frames
PulseAudio JACK Sink:front-right
   system:playback_2
	port playback latency = [ 512 512 ] frames
	port capture latency = [ 0 0 ] frames
pure_data_0:input0
   system:capture_1
	port playback latency = [ 512 512 ] frames
	port capture latency = [ 256 256 ] frames
pure_data_0:input1
   system:capture_2
	port playback latency = [ 512 512 ] frames
	port capture latency = [ 256 256 ] frames
pure_data_0:output0
   system:playback_1
	port playback latency = [ 512 512 ] frames
	port capture latency = [ 256 256 ] frames
pure_data_0:output1
   system:playback_2
	port playback latency = [ 512 512 ] frames
	port capture latency = [ 256 256 ] frames
a2j:Pure Data [130] (playback): Pure Data Midi-In 1
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
a2j:Pure Data [130] (playback): Pure Data Midi-In 2
   ardour:MIDI Clock out
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
a2j:Pure Data [130] (capture): Pure Data Midi-Out 1
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
a2j:Pure Data [130] (capture): Pure Data Midi-Out 2
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
ardour:physical_audio_input_monitor_enable
   system:capture_1
   system:capture_2
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 256 256 ] frames
ardour:physical_midi_input_monitor_enable
   a2j:Midi Through [14] (capture): Midi Through Port-0
   a2j:APC mini mk2 [24] (capture): APC mini mk2 APC mini mk2 Contr
   a2j:APC mini mk2 [24] (capture): APC mini mk2 APC mini mk2 Notes
   a2j:AG06/AG03 [36] (capture): AG06/AG03 MIDI 1
   a2j:MPK mini Plus [40] (capture): MPK mini Plus MIDI 1
   a2j:MPK mini Plus [40] (capture): MPK mini Plus MIDI 2
   a2j:mioXM [44] (capture): mioXM DIN 1
   a2j:mioXM [44] (capture): mioXM DIN 2
   a2j:mioXM [44] (capture): mioXM DIN 3
   a2j:mioXM [44] (capture): mioXM DIN 4
   a2j:mioXM [44] (capture): mioXM HST 1
   a2j:mioXM [44] (capture): mioXM HST 2
   a2j:mioXM [44] (capture): mioXM HST 3
   a2j:mioXM [44] (capture): mioXM HST 4
   a2j:mioXM [44] (capture): mioXM HST 5
   a2j:mioXM [44] (capture): mioXM HST 6
   a2j:mioXM [44] (capture): mioXM HST 7
   a2j:mioXM [44] (capture): mioXM HST 8
   a2j:mioXM [44] (capture): mioXM Preset Selector
   a2j:mioXM [44] (capture): mioXM RSV 1
   a2j:mioXM [44] (capture): mioXM RSV 2
   a2j:mioXM [44] (capture): mioXM RSV 3
   a2j:STARRYPAD [48] (capture): STARRYPAD MIDI 1
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
ardour:MTC in
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
ardour:LTC in
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
ardour:MIDI Clock in
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
ardour:LTC-Out
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
ardour:Click/audio_out 1
   system:playback_1
	port playback latency = [ 512 512 ] frames
	port capture latency = [ 256 256 ] frames
ardour:Click/audio_out 2
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 256 256 ] frames
ardour:MMC in
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
ardour:MMC out
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
ardour:Scene in
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
ardour:Scene out
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
ardour:x-virtual-keyboard
   ardour:ACE Reasonable Synth/midi_in 1
	port playback latency = [ 528 528 ] frames
	port capture latency = [ 0 0 ] frames
ardour:MTC out
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
ardour:MIDI Clock out
   a2j:Pure Data [130] (playback): Pure Data Midi-In 2
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
ardour:Cue Control in
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
ardour:Master/audio_in 1
   ardour:ACE Reasonable Synth/audio_out 1
	port playback latency = [ 528 528 ] frames
	port capture latency = [ 0 0 ] frames
ardour:Master/audio_in 2
   ardour:ACE Reasonable Synth/audio_out 2
	port playback latency = [ 528 528 ] frames
	port capture latency = [ 0 0 ] frames
ardour:Master/audio_out 1
   system:playback_1
	port playback latency = [ 512 512 ] frames
	port capture latency = [ 0 0 ] frames
ardour:Master/audio_out 2
   system:playback_2
	port playback latency = [ 512 512 ] frames
	port capture latency = [ 0 0 ] frames
ardour:ACE Reasonable Synth/midi_in 1
   ardour:x-virtual-keyboard
	port playback latency = [ 528 528 ] frames
	port capture latency = [ 0 0 ] frames
ardour:ACE Reasonable Synth/audio_out 1
   ardour:Master/audio_in 1
	port playback latency = [ 528 528 ] frames
	port capture latency = [ 0 0 ] frames
ardour:ACE Reasonable Synth/audio_out 2
   ardour:Master/audio_in 2
	port playback latency = [ 528 528 ] frames
	port capture latency = [ 0 0 ] frames
ardour:ACE Reasonable Synth/midi_out 1
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
ardour:MIDI Control In
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
ardour:MIDI Control Out
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
ardour:mackie control in
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
ardour:mackie control out
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
ardour:auditioner/audio_out 1
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
ardour:auditioner/audio_out 2
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
qsynth:left
   system:playback_1
	port playback latency = [ 512 512 ] frames
	port capture latency = [ 0 0 ] frames
qsynth:right
   system:playback_2
	port playback latency = [ 512 512 ] frames
	port capture latency = [ 0 0 ] frames
a2j:FLUID Synth (Qsynth1) [131] (playback): Synth input port (Qsynth1:0)
	port playback latency = [ 0 0 ] frames
	port capture latency = [ 0 0 ] frames
jack_lsp.txt (15,104 bytes)   

aggraef

2023-06-14 21:48

reporter   ~0027761

This is weird. I just tried this again (in the original configuration using a2jmidid), and this time it worked every single time. The flashing red led is gone as well. Looks like the bug isn't that reproducible after all.

Feel free to close the ticket. I don't really understand what's going on there. I didn't even reboot the machine, just switched to Jack's built-in Jack MIDI bridge, and then back again to a2jmidid.

Could be the USB MIDI driver going wonky? I do have an awful lot of USB MIDI devices hooked up to this computer. And I *did* unplug my mioXM box and plugged it in again, maybe that helped. :)

x42

2023-06-15 15:14

administrator   ~0027764

Your guess is as good as mine.

I expect however that if you disconnect Ardour's master bus the issue returns.

The current implementation expects that worst-case playback latency is not zero (at least one track or bus must have a latency > 0).
Ardour's MidiClockTicker sends "start" only during pre-roll. Buffers are filled so that by the time Ardour starts rolling, data reaches the output.
If worst-case playback latency is zero, that step is skipped. -- Sadly this is not trivial to fix.

x42

2023-06-15 15:24

administrator   ~0027765

Actually the last sentence I wrote above is wrong. There is already special case for zero latency.

aggraef

2023-06-15 17:49

reporter   ~0027766

Hmm, can you point me to the code that deals with the zero latency case? So that in case the issue returns, I can have a look myself and fiddle with the code.

Anyway, thanks for taking the time to look into it. It's very unfortunate that I can't reproduce the issue any more. I hate Heisenbugs. :((

x42

2023-06-15 18:12

administrator   ~0027767

https://github.com/Ardour/ardour/blob/3e27df9040b61d8fd7571bfb413cf59cedb57d64/libs/ardour/ticker.cc#L174-L188

When there is no latency, at transport start <tt>_remaining_latency_preroll = worst_latency_preroll_buffer_size_ceil ();</tt>
In that case<tt>pre_roll</tt> is always 0 when <tt>MidiClockTicker::tick</tt> is called.

In that case "start" is sent later during the first process cycle:

<tt>start_sample = 0; end_sample = n_samples; </tt>

The MIDI Clock port has zero latency: <tt>_mclk_out_latency.max == 0 </tt>

and hence <tt>_beat_pos == 0</tt> and <tt>_next_tick ==0</tt>
which leads to <tt>send_start_event (..)</tt>

aggraef

2023-06-16 21:53

reporter   ~0027782

Cool, thanks for the pointer!

Issue History

Date Modified Username Field Change
2023-06-14 05:28 aggraef New Issue
2023-06-14 05:28 aggraef File Added: aseqdump.txt
2023-06-14 05:28 aggraef File Added: single-bar_2023-06-14_071513.ardour-session-archive
2023-06-14 16:01 x42 Note Added: 0027756
2023-06-14 17:24 aggraef Note Added: 0027757
2023-06-14 18:15 aggraef Note Added: 0027758
2023-06-14 20:01 x42 Note Added: 0027759
2023-06-14 21:19 aggraef Note Added: 0027760
2023-06-14 21:19 aggraef File Added: jack_lsp.txt
2023-06-14 21:48 aggraef Note Added: 0027761
2023-06-15 15:14 x42 Note Added: 0027764
2023-06-15 15:24 x42 Note Added: 0027765
2023-06-15 15:24 x42 Assigned To => x42
2023-06-15 15:24 x42 Status new => resolved
2023-06-15 15:24 x42 Resolution open => no change required
2023-06-15 17:49 aggraef Note Added: 0027766
2023-06-15 18:12 x42 Note Added: 0027767
2023-06-16 21:53 aggraef Note Added: 0027782