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:
Device | Hz | FPP | Latency |
HiFiBerry DAC+ ADC Pro | 48k | 128 | 51.100 frames (1.0ms) |
HiFiBerry DAC+ ADC Pro | 48k | 256 | 50.416 frames (1.0ms) |
HiFiBerry DAC+ ADC Pro | 96k | 128 | 50.393 frames (0.5ms) |
HiFiBerry DAC+ ADC Pro | 96k | 256 | 50.459 frames (0.5ms) |
Sabrent USB | 48k | 128 | 451-453 frames (9.4ms) |
Sabrent USB | 48k | 256 | 498-500 frames (10.4ms) |
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:
Device | Hz | FPP | Latency |
HiFiBerry DAC+ ADC Pro | 48k | 128 | 2098-2482 frames (~48ms) |
HiFiBerry DAC+ ADC Pro | 48k | 256 | 3122-3890 frames (~73ms) |
HiFiBerry DAC+ ADC Pro | 96k | 128 | 2356-2740 frames (~26ms) |
HiFiBerry DAC+ ADC Pro | 96k | 256 | 3635-4659 frames (~43ms) |
Sabrent USB | 48k | 128 | 2226-2737 frames (~52ms) |
Sabrent USB | 48k | 256 | 3543-4824 frames (~87ms) |
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:
Device | Hz | FPP | One-way Latency |
HiFiBerry DAC+ ADC Pro | 48k | 128 | 1170 frames (24ms) |
HiFiBerry DAC+ ADC Pro | 48k | 256 | 1778 frames (37ms) |
HiFiBerry DAC+ ADC Pro | 96k | 128 | 1300 frames (14ms) |
HiFiBerry DAC+ ADC Pro | 96k | 256 | 2099 frames (22ms) |
Sabrent USB | 48k | 128 | 1467 frames (31ms) |
Sabrent USB | 48k | 256 | 2341 frames (49ms) |
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.