Moode Forum
Is there a high resolution DAC/ADC HAT with extremely low latency ? - Printable Version

+- Moode Forum (https://moodeaudio.org/forum)
+-- Forum: Community (https://moodeaudio.org/forum/forumdisplay.php?fid=18)
+--- Forum: General Discussion (https://moodeaudio.org/forum/forumdisplay.php?fid=21)
+--- Thread: Is there a high resolution DAC/ADC HAT with extremely low latency ? (/showthread.php?tid=7748)



Is there a high resolution DAC/ADC HAT with extremely low latency ? - scaronpce - 05-22-2025

Hello Forum,

The "HiFiBerry DAC2 ADC Pro" that I am now using has Playback and Capture volumes and both are set to 0dB in the tests below.

The roundtrip latency for this device is measured at 44.1 and 48kHz, 16 bits, 2 channels.

The result is 4ms ... but the there is a builtin DSP on the Playback path of this device using a default "FIR interpolation with de-emphasis" program and I can't measure the real impact of this setup.

On my test system, "alsabat" could not calculate round trip latency using 32 bit streams : it reports "Could not detect signal. Too much background noise?" ;-) I hope the wiring did not melt ...

My questions:
 - On the RPi5, is there a HAT that will yield better than 4ms round trip latency ?
 - Can this be also measured using 32 bit streams ?
 
Data follows.

Regards,

The device can playback 16, 24, and 32 bit streams but allows only 16 or 32 bit capture streams:

Code:
    musical@moOde:~ $ alsabat -D hw:sndrpihifiberry -f cd -c 2  --roundtriplatency
    alsa-utils version 1.2.8
    [ ... ]
    Start round trip latency
    Entering playback thread (ALSA).
    Set period size: 52  buffer size: 104
    Get period size: 52  buffer size: 104
    Playing generated audio sine wave
    Entering capture thread (ALSA).
    Set period size: 52  buffer size: 104
    Get period size: 52  buffer size: 104
    Recording ...
    Test1, round trip latency 3ms
    Test2, round trip latency 3ms
    Test3, round trip latency 4ms
    Test4, round trip latency 3ms
    Test5, round trip latency 4ms
    Final round trip latency: 4ms
    Playback completed.
    Capture completed.

    Return value is 0
    musical@moOde:~ $ alsabat -D hw:sndrpihifiberry -f dat -c 2  --roundtriplatency
    alsa-utils version 1.2.8
    [ ... ]
    Start round trip latency
    Entering playback thread (ALSA).
    Set period size: 56  buffer size: 112
    Get period size: 56  buffer size: 112
    Playing generated audio sine wave
    Entering capture thread (ALSA).
    Set period size: 56  buffer size: 112
    Get period size: 56  buffer size: 112
    Recording ...
    Test1, round trip latency 4ms
    Test2, round trip latency 4ms
    Test3, round trip latency 4ms
    Test4, round trip latency 4ms
    Test5, round trip latency 4ms
    Final round trip latency: 4ms
    Playback completed.
    Capture completed.

    Return value is 0

For those trying to inject analog data in the Sonos ecosystem, we have a round trip of 99ms between this HAT and a Sonos Connect.

There is a review of the SonnOS Connect by Audio Science Review here that is strangely accurate for today's Sonos firmware.

The test conditions are:
  • The Connect outputs a Fixed stereo signal
  • Audio Delay is set to their minimum (75ms)
  • Volume Limit is Off (100%)
  • AutoPlay is ON (targetting itself)

Code:
    musical@moOde:~ $ alsabat -D hw:sndrpihifiberry -f S16_LE -r 48000 -c 2  --roundtriplatency
    alsa-utils version 1.2.8
    [ ... ]
    Start round trip latency
    Entering playback thread (ALSA).
    Set period size: 56  buffer size: 112
    Get period size: 56  buffer size: 112
    Playing generated audio sine wave
    Entering capture thread (ALSA).
    Set period size: 56  buffer size: 112
    Get period size: 56  buffer size: 112
    Recording ...
    Test1, round trip latency 99ms
    Test2, round trip latency 99ms
    Test3, round trip latency 99ms
    Test4, round trip latency 99ms
    Test5, round trip latency 99ms
    Final round trip latency: 99ms
    Playback completed.
    Capture completed.

    Return value is 0



RE: Is there a high resolution DAC/ADC HAT with extremely low latency ? - Nutul - 05-22-2025

I pardon.
4ms round-trip (2ms one-way...) is roughly like hearing someone speak at a 1m (3ft) distance, comparing the sound leaving the mouth and entering your ears.
You then talk numbers that are 20, 30 times bigger... what is the need for less than 4ms? Curious, just asking.


RE: Is there a high resolution DAC/ADC HAT with extremely low latency ? - scaronpce - 05-22-2025

Ah!

I see that my question is not asked properly.

If we have a DAC/ADC capable of 24 bits, we are beyond the limit of hearing (20*LOG(2^24) = 144,5dB).

The roundtrip should be minimal and likely reflect the circuit itself.

So, is there such a beast or some device can can do more than 16 bits reliably ?

Regards,


RE: Is there a high resolution DAC/ADC HAT with extremely low latency ? - Nutul - 05-22-2025

I am not aware of any HAT doing that; but nowadays USB DACs / ADCs do wonders... My Focusrite Scarlett 2i2 3rd Gen. samples at 24/192 with (IIRC) something in the realm of 14ms round-trip just leaving a DAW and returning to it.
It then depends of how heavy the software manipulation of the samples withing the DAW is, of course.


RE: Is there a high resolution DAC/ADC HAT with extremely low latency ? - scaronpce - 05-22-2025

Cool!

I do have a (third gen) Focusrite Scarlett 2i2 but I was not able to use alsabat on this device.

Below is the USB configuration used to recognize this device as index 7 without grabbing anything by default ;-)

Perhaps you can share the tricky part to have alsabat run a roundtrip on this device ?

Regards,


Code:
Documentation for kernel 6.12 Guide to using M-Audio Audiophile USB with ALSA and Jack — The Linux Kernel documentation. (https://www.kernel.org/doc/html/v6.12/sound/cards/audiophile-usb.html)

As noted on that page, “the device initialization made by the Alsa driver in default mode may result in a corrupted state of the device”.

The following configuration was added to /etc/modprobe.d/

# USB devices
# This configuration defines as the first USB audio card a fake device that is never enabled.
# In theory, the index of the first USB device is replaced by a value of -2 to prevent other
# drivers from grabbing index 0.This behavior is not clearly documented and is avoided here.

options    snd_usb_audio   vid=0x0000,0x1235 pid=0x0000,0x8210 device_setup=0x00,0x1D index=0,7 enable=0,1

# device_setup 0x1D defines an active digital source, 24 bits long samples, and 48.1-96kHz rate-range.



RE: Is there a high resolution DAC/ADC HAT with extremely low latency ? - Nutul - 05-22-2025

I have no experience about alsabat (neither about what it basically is, TBH) I just use my device with Audacity for self recording; nothing professional.

You still haven't answered my question, though... why is still 4ms vs 99ms so important...


RE: Is there a high resolution DAC/ADC HAT with extremely low latency ? - scaronpce - 05-22-2025

Well, if you are talking about actual hearing, 99ms is "considered bad. It can cause noticeable delay and negatively impact audio monitoring and processing in real-time", says Google. Some musician will notice 3ms, so your mileage may vary.

This being said, I am looking at the equipment itself. A roundtrip delay is the capture of the playback of a know file, usualy within the same device.

So 6ms that can be proven reliable is better than 4ms that works in a low bit depth.

Regards,


RE: Is there a high resolution DAC/ADC HAT with extremely low latency ? - Nutul - 05-22-2025

(05-22-2025, 09:35 PM)scaronpce Wrote: Well, if you are talking about actual hearing, 99ms is "considered bad. It can cause noticeable delay and negatively impact audio monitoring and processing in real-time", says Google. Some musician will notice 3ms, so your mileage may vary.

This being said, I am looking at the equipment itself. A roundtrip delay is the capture of the playback of a know file, usualy within the same device.

So 6ms that can be proven reliable is better than 4ms that works in a low bit depth.

Regards,

99ms is indeed unimaginable... 4 (round trip, that is, eventually after signal treatment) is absolutely no harm.
IMO you cannot hear a 4ms sound-processing delay the same way you cannot hear a 4ms delay when listening to a live performance where the musicians are spread over a more-than-1-meter-apart... think about it. Take all the time you need. Especially if all those bigger numbers are on the same table...


RE: Is there a high resolution DAC/ADC HAT with extremely low latency ? - Bogler - 06-13-2025

@scaronpce I'm about to pick up one of these DACs (saw it posted used in my area). Will be using on a RPi 3b. From my cursory research it seemed like most of the hats were pretty similar in performance. Probably more delta exists in terms of the DSP being applied and the horsepower of the Pi applying that DSP. Maybe turn that processing off (or conversely add a ton to it) and see if/how it changes any?


RE: Is there a high resolution DAC/ADC HAT with extremely low latency ? - scaronpce - 06-13-2025

In my case, I was interested in the ADC part and my preferred input source is an oscilloscope ;-).

This product is the only one I found with an ADC that would fit an RPi5.

If your focus is music, this is a great product. However, be aware the the DAC has a hidden (or at least undocumented) DSP processor implementing 'FIR interpolation with de-emphasis'.