[RPi 4] Choppy Audio with HiFiBerry DAC2 Pro

  • I upgraded from 11.0.6 to 12 beta 1. I experience a regression. My hardware are Raspberry Pi 4B 8GB with Hifiberry DAC2 Pro. The regression are that the audio is (via the Hifiberrry) somewhat choppy throughout. Also with force_turbo=1 enabled. This did not happen on 11.0.6. I tested with a few addons. Anybody else experiencing something similar?

  • My hardware are Raspberry Pi 4B 8GB with Hifiberry DAC2 Pro.

    Please provide a full debug log.

    How to post a log (wiki)

    1. Enable debugging in Settings>System Settings>Logging
    2. Restart Kodi
    3. Replicate the problem
    4. Generate a log URL (do not post/upload logs to the forum)

    use "Settings > LibreELEC > System > Paste system logs" or run "pastekodi" over SSH, then post the URL link
  • Sorry, I should have investigated more. Busy days. It's not an issue with what the heading says. I now uploaded an album with actual files (wavpack lossless) to the devices SD card. It plays back flawlessly. I encountered the problem with web streaming based addons. And it's not very choppy sound. It's more small clicks and pops and tiny skips now and then. Rather subtle. But it didn't happen in 11.0.6.

    I play the same album as tested above from Spotify with the librespot addon. There's bin a few of the forementioned artifacts during this. And here is the log file (pastekodi).

    https://paste.libreelec.tv/tender-tetra.log

  • I now discovered that the cache-settings in advancedsettings.xml have been migrated to the GUI, so I thought this might be the problem. So I set the numbers I had in 11.0.6 correct. I also changed from wifi to wired connection to eliminate any problems that could stem from wifi. And I have force_turbo=1 enabled to eliminate issues with powersave. Bandwidth connection to the internet should not be a problem, I have atleast 60 - 90 Mbps download at worst. And I did not have any of those issues with LibreELEC 11.0.6, nor with any other device that I own.

    But I still have small clicks, pops and skips with streaming addons using 12 beta1 ...

    This is a new log:

    https://paste.libreelec.tv/many-javelin.log

  • Please test without the librespot addon and make sure you set the audio output device to ALSA in system->settings->audio.

    I suspect pulseaudio (which seems to get enabled by the librespot addon) might be the culprit.

    so long,

    Hias

  • I don't think it's related to that. I've tested with the YouTube addon and the Paradise Radio addon (I don't think those use pulseaudio?) setting my output to ALSA hifiberry. Still same choppy sound on 12 beta2. (Did not happen on 11.0.6.)

    The weird thing is that audio files streamed over local network (SAMBA) plays flawlessy with ALSA hifiberry.

    Also, if I change sound output to raspberry and use ALSA HDMI output to my TV, the output from the YouTube addon and the Paradise Radio addon plays back flawlessy.

    So the problem only occurs with 12 beta1,2 using streaming apps and audio output to ALSA hifiberry.

    New logfile testing with 12 beta2 using Pardise Radio addon:

    https://paste.libreelec.tv/glorious-gorilla.log

  • Good analysis! The Librespot add-on still creates warnings, and probably affects other add-ons, even when not in use.

    Remove that add-on for another test.

    Code
    2024-04-14 12:39:52.867 T:1072    debug <general>: Librespot: pactl load-module ('module-rtp-send', 'destination_ip=127.0.0.1', 'inhibit_auto_suspend=always', 'port=24642', 'source=librespot.monitor'): 15
    2024-04-14 12:39:52.880 T:1050    debug <general>: Sink changed
    2024-04-14 12:39:52.885 T:1072    debug <general>: Librespot: pactl suspend-sink ('librespot', '1'): 
    2024-04-14 12:39:52.885 T:1072    debug <general>: Librespot: pulseaudio modules loaded: ['14', '15']
    2024-04-14 12:39:52.885 T:1072    debug <general>: Librespot: ['librespot', '--bitrate', '320', '--device-type', 'tv', '--disable-audio-cache', '--disable-credential-cache', '--name', 'Librespot@himinbjorg', '--onevent', 'onevent.py', '--quiet', '--format', 'S24', '--dither', 'tpdf', '--initial-volume', '100']
    2024-04-14 12:39:52.886 T:1092    debug <general>: Librespot: onevent dispatcher started
    2024-04-14 12:39:52.887 T:1093    debug <general>: Librespot: librespot thread started
    2024-04-14 12:39:53.069 T:1093    debug <general>: Librespot: *** WARNING *** The program 'librespot' uses the Apple Bonjour compatibility layer of Avahi.
    2024-04-14 12:39:53.069 T:1093    debug <general>: Librespot: *** WARNING *** Please fix your application to use the native API of Avahi!
    2024-04-14 12:39:53.069 T:1093    debug <general>: Librespot: *** WARNING *** For more information see <http://0pointer.de/blog/projects/avahi-compat.html>
  • Good analysis! The Librespot add-on still creates warnings, and probably affects other add-ons, even when not in use.

    Remove that add-on for another test.

    It's still the same after uninstalling librespot addon and rebooting; choppy audio with hifiberry output, ok audio with HDMI output.

    Do you want me to do more tests? Supply more logfiles?

  • Can you play flawless internet radio on RPi OS? I'm asking to rule out network or HiFiBerry driver issues.

    I had a conversation with our Linux audio guru HiassofT . He suggested to make a clean installation on another microSD, just with a minimal amount of add-ons. If the issue persists, post another log from that system.

    I think the following is weird, but don't know whether it's relevant:

    Code
    Feb 27 18:26:06.217188 himinbjorg Boot[546]: ### Setting up sound card ###
    Feb 27 18:26:06.235771 himinbjorg kernel: uart-pl011 fe201000.serial: no DMA platform data
  • Can you play flawless internet radio on RPi OS? I'm asking to rule out network or HiFiBerry driver issues.

    I had a conversation with our Linux audio guru HiassofT . He suggested to make a clean installation on another microSD, just with a minimal amount of add-ons. If the issue persists, post another log from that system.

    I had another microSD card laying around. I thought it would be best to test 11.0.6 and 12 beta2 up against each other. (Formatting the card between installations, no upgrade.)

    I made a clean barebones installation, installing only the Paradise Radio addon for testing, setting that to FLAC as I had before. And setting the audio output to the hifiberry card (ALSA).

    I generated logfile after each test. The result was that there are no issues with 11.0.6, but on 12 beta2 audio is choppy. Logfiles:

    No problems:
    LibreELEC (official): 11.0.6 (RPi4.arm)
    LibreELEC:~ # pastekodi
    https://paste.libreelec.tv/main-dingo.log

    Choppy audio:
    LibreELEC (official): 11.95.2 (RPi4.aarch64)
    LibreELEC:~ # pastekodi
    https://paste.libreelec.tv/logical-cowbird.log

  • With your LibreELEC 12 beta 2 installation can you please try if this makes a different?

    Place these 2 line as the first 2 lines in your config.txt file:

    Code
    dtoverlay=
    dtoverlay=hifiberry-dacplus-pro

    and remove/comment out those lines:

    Code
    dtoverlay=hifiberry-dacplus
    core_freq_min=500

    Edited 2 times, last by HarryH (April 15, 2024 at 7:03 PM).

  • With your LibreELEC 12 beta 2 installation can you please try if this makes a different?

    Place these 2 line as the first 2 lines in your config.txt file:

    Code
    dtoverlay=
    dtoverlay=hifiberry-dacplus-pro

    and remove/comment out those lines:

    Code
    dtoverlay=hifiberry-dacplus
    core_freq_min=500

    Unfortunately, it did not help. Should I comment out "force_turbo=1" also?

    Generated a logfile with that setup, too:

    https://paste.libreelec.tv/driven-macaque.log

  • Unfortunately, it did not help. Should I comment out "force_turbo=1" also?

    Generated a logfile with that setup, too:

    https://paste.libreelec.tv/driven-macaque.log

    Edit: As I'am was writing HiassofT posted a possible solution. Please try his image first.

    Only for completeness:

    If you comment out the line, you can't make wrong. It's not default in LibreELEC. For troubleshooting purposes you can also comment out this line

    hdmi_enable_4kp60=1

    The first line forces that the ARM cores not going back to a lower frequency and stuck at the highest allowed clock rate. hdmi_enable_4kp60 forces the gpu_clock to 550MHz instead of 500MHz.

    If you doesn't depends on Bluetooth for keyboard/headphones or something like that, can you check with this line added ?:
    dtoverlay=disable-bt