[Ardour-Dev] how to precisely align the audio output of a Jack MIDI client in Ardour?
Markus Grabner
mg.2849 at w42.at
Sat Nov 11 14:21:44 PST 2017
Am Freitag, 10. November 2017, 16:36:07 CET schrieb Robin Gareus:
> c'est la vie. It's arguably a bug or design mistake that jack does not
> set port-latencies when it splits the graph to include the split [1] or
> vice-versa that it doesn't delay signal "in the wire" for internal
> connections [2].
I agree that it's a bug, but I don't see anything in the design of jack which
would prevent fixing this, although I believe only option [2] (internal delays)
could be a generic solution for arbitrarily complex connection graphs.
Actually I found another instance of this issue in my audio setup. I initially
stated that I managed to compensate latencies of my devices, but I only
checked it for each device separately. Now after our conversation, I repeated
the tests with both devices simultaneously, and indeed latency compensation
was incorrect.
Let me describe my setup in some more detail:
*) a Focusrite Saffire PRO 14 for microphone and line input and for monitor and
headphone output
*) a Line6 PODxt Live for guitar recording, guitar monitoring, effects
processing, and reamping
*) Zita-ajbridge for conversion between the Focusrite sampling rate (I choose
48000Hz) and the weird hard-coded sampling rate of the Line6 device
(39062.5Hz)
The reamping feature is particularly cool :-), it allows recording the clean
guitar sound while hearing the processed signal, then mixing and cutting the
clean signal (still hearing the processed signal), and finally, when satisfied
with the mix, processing the entire clean guitar track and recording the
processed signal into a regular audio track.
I determined the latencies with Jack_delay, and recording a series of pulses
in either of the following configurations (connections are from top to bottom)
confirmed frame-accurate latency compensation:
1.) Ardour track (playback)
2.) Focusrite in (Firewire)
3.) Focusrite out (6.35mm jack)
4.) audio cable
5.) Focusrite in (6.35mm jack)
6.) Focusrite out (Firewire)
7.) Ardour track (capture)
and
1.) Ardour track (playback)
2.) zita-j2a (sample rate conversion 48000Hz -> 39062.5Hz)
3.) Line6 in (USB)
4.) Line6 internal effect processing
5.) Line6 out (USB)
6.) zita-a2j (sample rate conversion 39062.5Hz -> 48000Hz)
7.) Ardour track (capture)
However, if both signal paths (through the Focusrite and Line6 devices) are
active simultaneously, only the larger latency (involving the sample rate
conversions) is compensated correctly, while the signal traveling through the
Focusrite arrives too early (due to the smaller latency along its path).
So even if simultaneous reamping and playback/recording of other signals is
not really a relevant use case, it is at least inconvenient to work with since
I would have to disconnect and reconnect Jack ports whenever I switch between
recording and reamping (such that Jack only sees a single signal path, and
latencies can be compensated correctly).
What can we do about this? I think it can't be solved outside of jack if
parallel paths in the connection graph have different latencies. But if jack
reports the maximum latency of all paths a client is connected to (as it
already does), it is sufficient to internally delay the signal on the "faster"
path if two paths with different latency arrive at the same node.
I understand that Jack is optimized for low latency operation, but iMO out-of-
the-box support for complex recording setups with frame-accurate latency
compensation would be a very useful addition to its feature set. It's
certainly not a quick fix, but I don't see a reason why it can't be done, and
clients like Ardour wouldn't even have to be changed. What do you think about
it?
Kind regards,
Markus
P.S.: I'm a C++ software developer in my daytime job and willing to help
implementing this (or any other suitable) proposal.
P.P.S.: This discussion transformed from an Ardour question into an (almost)
pure Jack issue. Shall we continue on the Jack mailing list?
More information about the Ardour-Dev
mailing list