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

2010-06-25 Thread Kjetil S. Matheussen


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?




> but I'm not sure whether the last
> block (the one that received a stop message from jack transport)
> should be recorded? For now it's recorded. If that's wrong,
> I'll fix it in the next release.

While it's safe to just record it, i don't think it should be.
http://jackaudio.org/files/docs/html/group__TransportControl.html reads:

jack_transport_stop() [..] takes effect on the _next_ process cycle.

jack_transport_query() [..] If called from the process thread, pos
corresponds to the first frame of the _current_ cycle and the state
returned is valid for the entire cycle.

IOW: As soon as the app sees a stopped transport in the process loop it
is exactly at, or already a bit later than the actual end.



Thank you very much. This also confirms what I though was most likely.

___
Linux-audio-dev mailing list
Linux-audio-dev@lists.linuxaudio.org
http://lists.linuxaudio.org/listinfo/linux-audio-dev


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

2010-06-25 Thread Paul Davis
On Fri, Jun 25, 2010 at 7:23 AM, Kjetil S. Matheussen
 wrote:

> 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?

no, JACK doesn't implement any policy with regards to latency
compensation. it considers its role as providing the information
necessary for clients to keep their own data correctly aligned.

currently it doesn't do that very well, but this will change whenever
i get to implement the new design i posted about on the jack mailing
list about 2-3 months ago.
___
Linux-audio-dev mailing list
Linux-audio-dev@lists.linuxaudio.org
http://lists.linuxaudio.org/listinfo/linux-audio-dev


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

2010-06-25 Thread Robin Gareus
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: ro...@gareus.org
site: http://gareus.org/   chat: xmpp:rgar...@ik.nu
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@lists.linuxaudio.org
http://lists.linuxaudio.org/listinfo/linux-audio-dev


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

2010-06-25 Thread Florian Faber
On 06/25/10 17:08, Robin Gareus wrote:

> 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`).

Is there a mechanism that also allows to add the internal latency of the
sound interface, like in CoreAudio?


Flo
-- 
Machines can do the work, so people have time to think.
public key DA43FEF4  x-hkp://wwwkeys.eu.pgp.net
___
Linux-audio-dev mailing list
Linux-audio-dev@lists.linuxaudio.org
http://lists.linuxaudio.org/listinfo/linux-audio-dev


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

2010-06-25 Thread Paul Davis
On Fri, Jun 25, 2010 at 1:03 PM, Florian Faber  wrote:
> On 06/25/10 17:08, Robin Gareus wrote:
>
>> 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`).
>
> Is there a mechanism that also allows to add the internal latency of the
> sound interface, like in CoreAudio?

the -I and -O flags for the backend(s) add these values. JACK cannot
determine them by itself, so you need to run jdelay or get the data
from some other source, and then add it.
___
Linux-audio-dev mailing list
Linux-audio-dev@lists.linuxaudio.org
http://lists.linuxaudio.org/listinfo/linux-audio-dev