Raspberry Pi 4 - no sound over USB Audio S/PDIF

  • Just installed Raspberry Pi OS on RPi4 and I have sound output over DigiHug USB Audio with both Analog Stereo Output and Digital Stereo (IEC958) Output device profile. The DAC is showing the right sampling rate 44.1kHz in both cases.

    I will check the USB firmware on LibreELEC but I have to write LE on the SD card again. :)

  • Please also check the following command on RPiOS (this uses the same audio parameters as kodi will use):

    Code
    speaker-test -t sine -c 2 -r 44100 -F S24_3LE -b 200000 -p 50000 -D iec958:CARD=Audio,DEV=0

    so long,

    Hias

  • Can you test with the latest nightly RPi4 build from here: Index of / ?

    If sound in kodi doesn't work then please run the speaker-test on LE as well (you have to stop kodi first with "systemctl stop kodi").

    so long,

    Hias

  • Hi Hias,

    I installed LibreELEC-RPi4.arm-10.0-nightly-20210422-a72cc4b.img.gz but unfortunately there is no change, the situation is exactly the same. No sound over DigiHug USB Audio S/PDIF, only with DigiHug USB Audio Analog where everything is resampled at 48kHz.

    I ran the speaker-test as you said, no success:

  • With LibreELEC 9.2.6 I have sound on "DigiHug USB Audio S/PDIF" but resampled at 48kHz, the same way as with "DigiHug USB Audio Analog" (tested with audio tracks at 44.1/16 and 96/24).

    Here is the log: http://ix.io/2WXq

    I also ran the speaker-test, no success:

    So, on LE 9.2.6 DigiHug USB Audio S/PDIF is working but the problem is that all audio files are resampled at 48kHz with "Best Match" output option.

  • Thanks for the log!

    LE 9.2 dmesg shows the same USB bandwidth issue as LE 10, the reason you get sound on LE 9.2 is that kodi falls back from the SPDIF to the Analog USB device (LE 10 fell back to HDMI).

    It's very puzzling why this would only fail on LE but not on RPiOS. I checked our kernel configs and couldn't spot any difference in the relevant USB/audio parts... I also did a quick test with my PCM2704 USB audio card (which supports 48kHz on Analog and 32-48kHz on SPDIF) and 44.1kHz via SPDIF worked just fine on LE 10.

    Can you post the output of "lsmod" on LE, and also dmesg and lsmod output on RPiOS?

    so long,

    Hias

  • Sorry, no idea.

    The RPiOS showed the same bandwidth error in dmesg so it'z puzzling why it would work on RPiOS but not LibreELEC.

    Might be worth checking if Kodi on RPiOS shows the same issue (but IIRC there are only older Kodi 18 versions available for RPiOS).

    Or you could try the latest LibreELEC nightly, it enables USB autosuspend (which was accidentally disabled before).

    If you use a current nightly build and have a 4k TV you probably need to add "force_turbo=1" to config.txt as the latest RPi kernel introduced an issue with 4k output that can lead to "no signal" on TV (we are currently waiting for a fix for that).

    so long,

    Hias

  • Or you could try the latest LibreELEC nightly, it enables USB autosuspend (which was accidentally disabled before).

    I tried now, everything is the same. No sound over DigiHug USB Audio S/PDIF. I don't know what to do, I still cannot use my Rpi4 because of this issue ... :(

  • speaker-test -t sine -c 2 -r 44100 -F S24_3LE -b 200000 -p 50000 -D iec958:CARD=Audio,DEV=0

    Hi Hias, can I run something similar under RPiOS but with 96kHz/24-bit, to check if it's working?

    I wasn't able to solve this problem, I have issues using Volumio. I can only stream 44.1/16, I get an error message when I try streaming 96/24. I tried also to stream a mp3 and I received the same error, very strange. FLAC, WAV and ALAC 44.1/16 are working also.

    I tried MoOde as well, the same problem as with Volumio. I just don't get it... :(

  • Hi Hias, can I run something similar under RPiOS but with 96kHz/24-bit, to check if it's working?

    Just change the "-r" option (that's the samplerate), eg to "-r 96000". "-F" set's the format, use "-F S16_LE" for 16bit, "-F S24_3LE" for 24bit. The buffer and period time parameters ("-b", "-p") are probably not important, I think you can drop these.

    I suspect the issue is very specific to your USB DAC in combination with the RPi4's USB controller. If you can reproduce that on stock RPiOS you might have a chance that one of the RPi devs looks into it - not much I can do about it.

    so long,

    Hias

  • Hi Hias! Believe it or not, I found the problem. You can see it in the attached picture.

    It's beyond my understanding, it didn't crossed my mind that this wireless keyboard could interfere with another USB device and cause such a problem. I used it in the last two years on my Rpi3 without any problems and when I bought the Rpi4 I've just hooked it in an USB port and left it there.

    A few minutes ago I said to try one more time the RPi4 from the ground, without HifiBerry Digi+ Pro attached and I also removed the keyboard dongle. I flashed Volumio in first place and when I tried to play a 96/24 FLAC the big surprise came up. It plays everything as it should on Volumio.

    I flashed LE 9.2.6, it's working perfect, no problems at all.

    I did a few tests and I tried all four RPi's USB ports with different combinations. Everytime I was inserting the keyboard dongle in the RPi the USB audio output was messed up.

    I don't know why this is happening and if this is normal but is good to know about this issue. Maybe it could be solved if it's related to the software.

    Thanks a lot for your effort in helping me and I'm really sorry for the time you lost but, as I said, it didn't crossed my mind.

  • Glad you finally found the culprit!

    USB can be "fun", there are ton of odd devices out there, and especially audio (and video/webcam) devices can easily break if other devices consume too much bandwidth. Which is probably what the keyboard is doing (for whatever reason, probably because it has a somewhat broken USB configuration...).

    so long,

    Hias