[Jack-Devel] I'm confused about latency

Robin Gareus robin at gareus.org
Fri Apr 5 13:13:00 CEST 2019


On 4/5/19 11:27 AM, Alexandre BIQUE wrote:

> To get back to the port's latency configuration here a simple case:
> 
> [HW Input] -> [App] -> [HW Output]
> 
> Should the App set its input and output port latency to 0?

No, it should propagate latencies. But in this simple case it's not
relevant at all.

A better example is

  [HW Input] -> [App1] -> [App2] -> [HW Output]

Each App is interested in two things:

 - how long has it been since the data read from a port arrived at the
edge of the graph (capture, from hw-input)
 - how long will it be until the data written to a given port will
arrive at the edge of the graph (playback, to hw-output)


App1 should read the HW input *capture*-latency from its input port, add
its own latency and inform App2 about the sum by setting the capture
latency of App1's output port.

Likewise, App2 should add its latency to the *playback* latency of its
output port and forward that to App1 by setting the playback latency of
App2's input port.

Please see
http://jackaudio.org/api/group__LatencyFunctions.html#ga7a8f181fcec32945db7b8e06ee1ca94b
That outlines above algorithm


One example use-case is Overdubs: e.g. App1 plays back, App2 adds some
latent effect (e.g. a Limiter). A musician listens to HW output, sings
along into the HW-input and App1 records it. The recording should be in
sync with the playack.

> And internally the application would use the hw input latency and hw
> output latency.

Yes, the port latencies, which may or may not be related to hardware.

-=-

As for absolute alignment, that's jack-transport or jack-time, which
provides a clock based on the soundcard's oscillator. -- unrelated to
the operating-system's time.

http://jackaudio.org/api/group__TimeFunctions.html

Hope that helps,
robin



More information about the Jackaudio mailing list