Missing MIDI events in JACK clients
Version, Distribution, Desktop Environment: Master (77318477), Arch Linux, Sway
Description of Problem: MIDI events routed to some client get lost intermittently: this is noticeable when e.g. playing a MIDI keyboard plugged to a virtual instrument or recording MIDI tracks.
How Reproducible: in my case this can be reproduced in Ardour, when sending data to a MIDI device (either HW or SW, like VMPK), into a MIDI track, and trying to feed lots of short notes and record. You'll notice that some note on and note off events aren't recorded properly (note off are easier to spot as the track will show long notes even if you fed short ones)
Steps to Reproduce:
- run
ardour
throughpw-jack
(I usedPIPEWIRE_LATENCY=256/48000
) - create a MIDI track
- connect VMPK to the input of the MIDI track
- record the track
- while recording, feed lots of random short notes (through VMPK interface) for a while
- stop recording
- look at the recorded track, some notes are longer than expected (meaning note off event got missed)
Actual Results:
Looking at the recorded track, some notes are longer than expected (meaning note off event got missed). While missing note off events are easy to see, missing note on are harder to see with this method, over they can be experienced while e.g. playing on a midi keyboard connected to a virtual instrument for a while.
Expected Results:
No inconsistency in MIDI events in the recorded track, or when playing live, no missing note on/off.
In the screenshot above, the first MIDI track was recording using PipeWire as JACK backend, while the 2nd was recorded using a JACK server: this one doesn't have long notes as all notes off events are processed correctly.
Additional Info dump.json
Couldn't see anything relevant in the log with PIPEWIRE_DEBUG=3
.
I could only test this in my laptop, a Dell XPS 9570 with integrated sound interface (HDA Intel PCH), however, this can't be reproduced when using JACK instead of PipeWire. Also no Xruns were reported by PipeWire.
Interestingly, not all the clients are affected. Ardour is definitely one, and I could reproduce this on the linuxsampler LV2 plugin hosted by jalv (a standalone LV2 plugin host for JACK), while Rosegarden and ZynAddSubFX (standalone) seem to work fine.
For example, routing the same VMPK output into both Ardour MIDI track (and internal virtual instruments, such as LV2 ZynAddSubFX) and to an external instance of ZynAddSubFX shows that the latter is not affected by the issue itself, as you can see in the audio track recorded in the screenshot, where notes off are properly interpreted by the external instance, and so visible in the audio track as pauses.