Re: [LAD] Jack latency handling (Re: Software for recording digital audio?)

From: Robin Gareus <robin@email-addr-hidden>
Date: Fri Jun 25 2010 - 18:08:32 EEST

On 06/25/2010 01:23 PM, Kjetil S. Matheussen wrote:
>
> Robin Gareus:
>> >
>> > 0.49 has this feature implemented. Use the "-jt" option.
>> >
>> > It should be sample sync,
>>
>> Almost. It does not yet compensate for port-latency. It is important for
>> both effects that introduce latency as well as to keep physical I/O in
>> sync with apps.
>>
>> see jack_port_get_latency() and jack_port_get_total_latency()
>> at http://jackaudio.org/files/docs/html/group__PortFunctions.html
>>
>
> Thanks for the info! I also wonder, does jack compansate for
> latency when it mixes the outputs from ports (i.e. when several
> output ports are connected to a jack_capture port), so that
> the sound is in sync?

Jack2 (aka jack 1.9.6 SVN r4008) adds and sets the port-latencies of
connected [upstream] ports accordingly. The application itself is then
responsible for compensating accordingly.

Here's an example:

The "system_playback" port has a latency of 1024 frames and so is the
jack_buffersize (frames per period). "app1" is a simple jack application
that prints the _total_-port-latency of it's in & out ports every time
they change and announces a latency of 512 frames on its input port (The
individual port-latencies themselves can be displayed with `lack_lsp -l`).

Unconnected "app1" prints a total out-port latency of 0 and the in-port
latency which was configured when creating the port: 512.

Now:

app1 ---> play # app1: out-port latency:1024
          app1 # app1: in-port latency: 512
-=-=-=-

app1 - play # app1: out-port latency: 512
      \-> app1 # app1: in-port latency: 512

-=-=-=-

app1 -+-> play # app1: out-port latency: 1024
      \-> app1 # app1: in-port latency: 1536

Note that the scenario is different if the client announces 512 frames
latency on it's output port _instead_ of its input:

Unconnected "app2" prints an out-port latency of 512 and the in-port:0

app2 ---> play # app2: out-port latency:1536
          app2 # app2: in-port latency: 0
-=-=-=-

app2 - play # app2: out-port latency: 512
      \-> app2 # app2: in-port latency: 512

-=-=-=-

app2 -+-> play # app2: out-port latency: 1536
      \-> app2 # app2: in-port latency: 1536

If you want to test with jack1:
   http://rg42.org/_media/wiki/jtest.c
(NB. the test-app only announces an internal latency, it actually has
none. I'll throw in a buffer on the next cold rainy day.)

Anyway: Is there a simple LADSPA or LV2 host that sets port-latencies
correctly? Well, not many plugins announce their latency but neither
jack-rack nor lv2_jack_host set that value to to the jack-ports;
ardour does (fi. test w/ the multiband EQ 1197 from Steve Harris).
Check with `jack_lsp -l` or better: listen to it by adding a
phase-inverter into a bus.... and see if you can cancel the signals.

ciao,
robin

-- 
Robin Gareus                           mail: robin@email-addr-hidden
site: http://gareus.org/               chat: xmpp:rgareus@email-addr-hidden
blog: http://rg42.org/                 lab : http://citu.fr/
Public Key at http://pgp.mit.edu/
Fingerprint : 7107 840B 4DC9 C948 076D 6359 7955 24F1 4F95 2B42
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/listinfo/linux-audio-dev
Received on Fri Jun 25 20:15:04 2010

This archive was generated by hypermail 2.1.8 : Fri Jun 25 2010 - 20:15:05 EEST