Asound.conf does nothing

Required Information

DietPi version
G_DIETPI_VERSION_CORE=9
G_DIETPI_VERSION_SUB=8
G_DIETPI_VERSION_RC=0
G_GITBRANCH=‘master’
G_GITOWNER=‘MichaIng’

Distro version
bookworm 0

Kernel version
Linux DietPi 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr 3 17:24:16 BST 2023 aarch64 GNU/Linux

Architecture
arm64

SBC model
RPi 4 Model B (aarch64)

Power supply used
IFI power supply 5volt 3 ampere

SD card used
SanDisk ultra 32 gb

I appears my asound.conf is not loading. Any changes I make in it don’t do anything. Possibly a user error my side. Not sure.
Current asound config located in /etc/asound.conf

pcm.!default {
        type hw
        card 0
        device 0
}

ctl.!default {
        type hw
        card 0
}

aplay -l gives this

**** List of PLAYBACK Hardware Devices ****
card 0: AUDIO [SMSL USB AUDIO], device 0: USB Audio [USB Audio]
  Subdevices: 0/1
  Subdevice #0: subdevice #0

I can change asound to anything and or rubbish but it doesn’t have any effect. The music still plays though which suggest to my alsa loads a generic config somewhere. Don’t know how this works.

journalctl -xe | grep alsa gives this

Oct 27 16:25:11 DietPi systemd[1]: alsa-state.service - Manage Sound Card State (restore and store) was skipped because of an unmet condition check (ConditionPathExists=/etc/alsa/state-daemon.conf).
░░ Subject: A start job for unit alsa-state.service has finished successfully
░░ A start job for unit alsa-state.service has finished successfully.
Oct 27 16:25:11 DietPi systemd[1]: Starting alsa-restore.service - Save/Restore Sound Card State...
░░ Subject: A start job for unit alsa-restore.service has begun execution
░░ A start job for unit alsa-restore.service has begun execution.
Oct 27 16:25:11 DietPi alsactl[356]: alsa-lib parser.c:2783:(load_toplevel_config) Unable to find the top-level configuration file '/usr/share/alsa/ucm2/ucm.conf'.
Oct 27 16:25:11 DietPi alsactl[356]: alsa-lib main.c:1541:(snd_use_case_mgr_open) error: failed to import hw:0 use case configuration -2
Oct 27 16:25:11 DietPi systemd[1]: Finished alsa-restore.service - Save/Restore Sound Card State.
░░ Subject: A start job for unit alsa-restore.service has finished successfully
░░ A start job for unit alsa-restore.service has finished successfully.

thx for any help/tips…

willem

Probably something @MichaIng could help with

I ran some tests and defenitely something has changed suddenly today. Yesterday my dac displayed the samplerate of the the actual song playing sometimes 96khz / 24 or even 192khz and now it re-samples everything to 44khz / 16 bit. Don’t know what has happened to the config I’m afraid.

regards

willem

Found out one more thing. When I go to the dietpi-config and I select dac (hw:0,0) and hit submit It actually removes my /etc/asound.conf first and then creates a standard asound.conf

[ SUB1 ] DietPi-Set_hardware > soundcard (hw:0,0)
[ INFO ] DietPi-Set_hardware | Checking for required APT packages: alsa-utils
[ INFO ] DietPi-Set_hardware | Resetting all sound card settings...
[  OK  ] DietPi-Set_hardware | rm /etc/asound.conf
[  OK  ] DietPi-Set_hardware | rm /var/lib/alsa/asound.state
Found hardware: "USB-Audio" "USB Mixer" "USB152a:85dd" "" ""
Hardware is initialized using a generic method
[  OK  ] DietPi-Set_hardware | sed --follow-symlinks -Ei -e /^[[:blank:]]*(dtoverlay=(allo-|applepi-dac|dionaudio-|googlevoicehat-soundcard|hifiberry-|i-sabre-q2m|iqaudio-|justboom-|rpi-dac)|dtparam=i2s)/d -e s/^[[:blank:]]*(hdmi_drive(:[01])?=.*$)/#\1/ /boot/config.txt
[  OK  ] DietPi-Set_hardware | Desired setting in /boot/config.txt was already set: dtparam=audio=off
[  OK  ] DietPi-Set_hardware | eval echo 'blacklist snd_bcm2835' > /etc/modprobe.d/dietpi-disable_rpi_audio.conf
[  OK  ] DietPi-Set_hardware | sed --follow-symlinks -Ei /root=/s/[[:blank:]]*snd_bcm2835.enable_[^[:blank:]]*([[:blank:]]*$)?//g /boot/cmdline.txt
[ INFO ] DietPi-Set_hardware | Applying new sound card settings...
[  OK  ] DietPi-Set_hardware | Desired setting in /boot/dietpi.txt was already set: CONFIG_SOUNDCARD=hw:0,0
[  OK  ] DietPi-Set_hardware | alsactl -g store
[  OK  ] soundcard hw:0,0 | Completed

Oct 27 16:25:11 DietPi alsactl[356]: alsa-lib parser.c:2783:(load_toplevel_config) Unable to find the top-level configuration file ‘/usr/share/alsa/ucm2/ucm.conf’.

Joining the quiz;

Just a guess, I’m trying to understand. I think this is the cause, but wait for the pro. :wink:

yes this is how the script is designed actually.

:slight_smile:

Yes,…I’m seeing that and I start to understand it a bit but it doesn’t explain why it suddenly starts resampling which it did NOT do before…:slight_smile:

In addition: It might have something to do with /etc/asound.conf in relation to ~/.asoundrc which is the user specific config. But then again, I’ve never used ~/.asoundrc before and my /etc/asound.conf appeared to be loaded. or at least it didn’t re-sample my qobuz audio stream. I know that for a 100% sure as the dac itself indicates the sample frequency of the audio being played.

Uninstalled alsa-utils using dietpi-config
Installed alsa-utils using dietpi-config
selected hw:0,0 in dietpi-config (soundcard)
/etc/asound.conf was created with the defaulkt config

pcm.!default {
        type hw
        card 0
        device 0
}

ctl.!default {
        type hw
        card 0
}

nano ~/.asoundrc with the same config
editted both /etc/asound.conf and ~/.asoundrc card =1 (instead of 0)
sudo reboot
ALSA_DEBUG=1 aplay -l gives me

root@DietPi:~# ALSA_DEBUG=1 aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: AUDIO [SMSL USB AUDIO], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

one thing I just did. Uninstalled alsa-utils using dietpi-config and the music / playback still works.

Gents,…I’ve resolved the matter of the “re-sampeling” at least. In the upmpdcli.conf file I forgot to specify the quality parameter after I re-installed upmpdcli… :angry:…my bad. So that part is resolved. Still have the question about modifying /etc/asound.conf. What happens exactly in alsa if put in rubbish or remove the file completely? In other words. How can you check whether or not alsa takes your config into account or not.

thx in advance

reg

willem

Did some regression testing by out commented /etc/asound.conf completely. Nothing changes, sound exactly the same so I reckon it works like this. When alsa doesn’t find a module or config for my dac it automatically loads / uses the default kernel module and you can’t influence it in any which way. Not sure though but that’s how I think it works…

reg

w

This topic was automatically closed 178 days after the last reply. New replies are no longer allowed.