[Rpi4] No audio over HDMI

Required Information

  • DietPi version:
G_DIETPI_VERSION_CORE=8
G_DIETPI_VERSION_SUB=18
G_DIETPI_VERSION_RC=2
G_GITBRANCH='master'
G_GITOWNER='MichaIng'
G_LIVE_PATCH_STATUS[0]='not applicable'
  • Distro version: bookworm 0
  • Kernel version: 6.1.21-v8+
  • Architecture: arm64
  • SBC model: RPi 4 Model B (aarch64)
  • Power supply used: Official Rpi4

PROBLEM DESCRIPTION

No sound over HDMI.
I am using the KMS video stack, which means in config.txt I have:
dtoverlay=vc4-kms-v3d

I can see these devices available:

root@dietpi:~# aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)
sysdefault
    Default Audio Device
hw:CARD=vc4hdmi0,DEV=0
    vc4-hdmi-0, MAI PCM i2s-hifi-0
    Direct hardware device without any conversions
plughw:CARD=vc4hdmi0,DEV=0
    vc4-hdmi-0, MAI PCM i2s-hifi-0
    Hardware device with all software conversions
sysdefault:CARD=vc4hdmi0
    vc4-hdmi-0, MAI PCM i2s-hifi-0
    Default Audio Device
hdmi:CARD=vc4hdmi0,DEV=0
    vc4-hdmi-0, MAI PCM i2s-hifi-0
    HDMI Audio Output
dmix:CARD=vc4hdmi0,DEV=0
    vc4-hdmi-0, MAI PCM i2s-hifi-0
    Direct sample mixing device
hw:CARD=vc4hdmi1,DEV=0
    vc4-hdmi-1, MAI PCM i2s-hifi-0
    Direct hardware device without any conversions
plughw:CARD=vc4hdmi1,DEV=0
    vc4-hdmi-1, MAI PCM i2s-hifi-0
    Hardware device with all software conversions
sysdefault:CARD=vc4hdmi1
    vc4-hdmi-1, MAI PCM i2s-hifi-0
    Default Audio Device
hdmi:CARD=vc4hdmi1,DEV=0
    vc4-hdmi-1, MAI PCM i2s-hifi-0
    HDMI Audio Output
dmix:CARD=vc4hdmi1,DEV=0
    vc4-hdmi-1, MAI PCM i2s-hifi-0
    Direct sample mixing device

Also, in dietpi-config I have:

Sound card          : [rpi-bcm2835-hdmi-plug]
Auto-conversion     : [On] Automatic software conversions

…which results on this /etc/asound.conf:


pcm.!default {                                                                                                 
        type plug                                                                                              
        slave.pcm {                                                                                            
                type hw                                                                                        
                card 0                                                                                         
                device 0                                                                                       
        }                                                                                                      
}                                                                                                              
                                                                                                               
ctl.!default {                                                                                                 
        type hw                                                                                                
        card 0                                                                                                 
}

With speaker-test, I can manually do this and there is sound:

speaker-test -Dsysdefault

…But since programs try to use ALSA Default instead of Sysdefault, sound only works in speaker-test.

EDIT: Deleting /etc/asound.conf, audio works normally.
So there is a problem with the dietpi-config generated /etc/asound.conf

Let’s ping our developer @MichaIng to have a look into the case.