[LAU] Testing JACK and PA latency

Fons Adriaensen fons at linuxaudio.org
Thu Sep 19 10:46:05 UTC 2013


On Thu, Sep 19, 2013 at 08:04:04PM +1000, Patrick Shirkey wrote:

> > 1. Measure the round-trip latency of your sound card (with an
> > external analog loop).
> >
> 
> Can I use jack_delay running on a second computer connected to the
> external i/o of the first computer to get this value?

You'd measure something different...

But you could use two computers as follows:

A = computer with jack, PA, audacity
B = second computer with sound card, jack and jack_delay.

1. Measure the round-trip latency on B, with an external
   analog loop. 

2. Connect B -> A, A -> B, run complete chain on A.

3. Measure again on B, subtract the value from (1).
 
> >   jack_delay -> pa_source -> audacity -> pa_sink -> jack_delay.
> >
> 
> Does this look reasonable?
> 
>   1023.978 frames     21.333 ms total roundtrip latency
> 	extra loopback latency: 1023 frames
> 	use 511 for the backend arguments -I and -O
>   1023.976 frames     21.333 ms total roundtrip latency
> 	extra loopback latency: 1023 frames
> 	use 511 for the backend arguments -I and -O
>   1023.977 frames     21.333 ms total roundtrip latency
> 	extra loopback latency: 1023 frames
> 	use 511 for the backend arguments -I and -O

Don't know - I'm by no means a PA expert... and I don't know
your Jack period size. Given PA's reputation I'd expect more: 
1024 samples would mean that PA imposes almost the same RT-
requirements on apps as Jack does, and it was designed *not*
to do that...  But maybe the jack <-> PA interface doesn't
use the same amount of buffering that PA normally adds.

Note that the value measured is modulo 2^16 samples, but I
wouldn't expect anything more than a second, so this probably
irrelevant.


> > 3. If pa_source and pa_sink are a single Jack client (probably not),
> >    subtract one period from the result of (2).
> 
> Can you explain that with the data above?
 
If they are a single Jack client you create a loop in Jack's 
processing graph, this adds one period to the measurement.


> > 4. Add the two values.
> >
> 
> I would like to provide an app for this task. Do you think it would be
> worthwhile to extend jack_iodelay for this purpose?

Don't see how. You need to do two measurements anyway, no matter 
how it's done, then add or substract.

Ciao,

-- 
FA

A world of exhaustive, reliable metadata would be an utopia.
It's also a pipe-dream, founded on self-delusion, nerd hubris
and hysterically inflated market opportunities. (Cory Doctorow)



More information about the Linux-audio-user mailing list