Improved Jack Latency Testing with jack_delay

The Audacity loopback method I have been using seemed rather laborious and not as scientific as it could be. I discovered a little tool called jack_delay, written by Fons Adriaensen. A lot of great information about latency and how to test it using jack_delay can be found in this page of the Linux Audio Wiki.

jack_delay takes two arguments: an input Jack device (-I), and an output Jack device (-O). It plays tones on the output, captures them back on the input, and uses the time difference to measure the latency of devices with very high accuracy.

I re-ran some tests on Raspbian (kernel 4.19.118-v7l+) using jack_delay to send to the system:capture_1 device and receive from the system:playback_1 device:

HiFiBerry DAC+ ADC Pro48k12851.100 frames (1.0ms)
HiFiBerry DAC+ ADC Pro48k25650.416 frames (1.0ms)
HiFiBerry DAC+ ADC Pro96k12850.393 frames (0.5ms)
HiFiBerry DAC+ ADC Pro96k25650.459 frames (0.5ms)
Sabrent USB48k128451-453 frames (9.4ms)
Sabrent USB48k256498-500 frames (10.4ms)
Device latency using local loopback, excluding buffer overheads (jack_delay -E)

These results are in line with, while far more accurate than, my previous Audacity results of 4ms (using 2ms buffer) for the HiFiBerry and 12 ms (using 5ms buffer) for the Sabrent. It’s nice to see that the HiFiBerry device latency is extremely consistent and low at both 48khz and 96khz (the Sabrent does not support 96khz).

I also re-ran some round-trip loopback tests using jack_delay sending to the JackTrip send_1 device, and receiving on the receive_1 device:

HiFiBerry DAC+ ADC Pro48k1282098-2482 frames (~48ms)
HiFiBerry DAC+ ADC Pro48k2563122-3890 frames (~73ms)
HiFiBerry DAC+ ADC Pro96k1282356-2740 frames (~26ms)
HiFiBerry DAC+ ADC Pro96k2563635-4659 frames (~43ms)
Sabrent USB48k1282226-2737 frames (~52ms)
Sabrent USB48k2563543-4824 frames (~87ms)
Round-trip loopback, including buffer overheads

These are also consistent with my previous results. This method excludes 1 ADC and 1 DAC conversion compared to a full round-trip. To calculate one-way latency, one can just add device latency, and divide the total by two:

DeviceHzFPPOne-way Latency
HiFiBerry DAC+ ADC Pro48k1281170 frames (24ms)
HiFiBerry DAC+ ADC Pro48k2561778 frames (37ms)
HiFiBerry DAC+ ADC Pro96k1281300 frames (14ms)
HiFiBerry DAC+ ADC Pro96k2562099 frames (22ms)
Sabrent USB48k1281467 frames (31ms)
Sabrent USB48k2562341 frames (49ms)
Approximate one-way latency using JackTrip

Note that this is over an AT&T Fiber Internet connection with 6-7ms round-trip ping times to my JackTrip hub server, which is pretty close to ideal conditions. But when using a HiFiBerry at 96k/128, you should be able to stay beneath 25ms even for connections with up to 17ms round-trip ping times.

Leave a Reply