Delay when sending midi to a jack device from host

Optimize your system for ultimate performance.

Moderators: MattKingUSA, khz

Post Reply
User avatar
sysrqer
Established Member
Posts: 2595
Joined: Thu Nov 14, 2013 11:47 pm
Has thanked: 377 times
Been thanked: 170 times
Contact:

Delay when sending midi to a jack device from host

Post by sysrqer »

Spent quite a while on #ardour trying to solve this but it seems that it's not Ardour that's causing the issue. Basically if I send midi to a Jack device, like Hydrogen, the audio output from the device is not synced with the host. I noticed this by recording the audio from Hydrogen in to Ardour (after sequencing it from ardour) and seeing a small delay, about 1024 samples which happens to be the buffer setting I have set. If I change the buffer the delay just gets smaller.

I have tried with qtractor and the same thing happens. I tried using the sequencer in Hydrogen and then recording the output in to Ardour (also disconnecting the midi connection from Ardour to Hydrogen) and it records perfectly. The problem isn't Hydrogen itself, I also tried with Drumkv1 and I get the same 1024 samples delay in the audio.

I am using Cadence session autostarted on login and alsa permanently bridged to Jack dbus.
User avatar
sysrqer
Established Member
Posts: 2595
Joined: Thu Nov 14, 2013 11:47 pm
Has thanked: 377 times
Been thanked: 170 times
Contact:

Re: Delay when sending midi to a jack device from host

Post by sysrqer »

Is there anyone that can help me diagnose this somehow?

I have tried uninstalling cadence and jack2dbus and installing qjackctl and jack2. The first time I ran this with the default settings the delay disappeared. Then I rebooted and the delay is back.
tramp
Established Member
Posts: 2439
Joined: Mon Jul 01, 2013 8:13 am
Has thanked: 11 times
Been thanked: 557 times

Re: Delay when sending midi to a jack device from host

Post by tramp »

The problem is, when you connect ardour with jack to output midi data, ardour receive the audio data from hydrogen in the next jack calback. That introduce the one buffer delay. Every client get just one calback per buffer and in this setup ardour was already called. Midi and audio data flow in the same calback.
On the road again.
User avatar
sysrqer
Established Member
Posts: 2595
Joined: Thu Nov 14, 2013 11:47 pm
Has thanked: 377 times
Been thanked: 170 times
Contact:

Re: Delay when sending midi to a jack device from host

Post by sysrqer »

So it is normal and to be expected then? What you're saying makes sense but it's strange that so many people I ask about it say this doesn't happen to them. I will forget about it and work around then in that case, thank you.
User avatar
raboof
Established Member
Posts: 1865
Joined: Tue Apr 08, 2008 11:58 am
Location: Deventer, NL
Has thanked: 52 times
Been thanked: 80 times
Contact:

Re: Delay when sending midi to a jack device from host

Post by raboof »

sysrqer wrote:So it is normal and to be expected then? What you're saying makes sense but it's strange that so many people I ask about it say this doesn't happen to them. I will forget about it and work around then in that case, thank you.
What might be confusing people is that this only happens when you have cycles in your JACK graph.

This should really be more prominently visible in the various patchbay applications.
Post Reply