I followed this guide to set the default device like this:
create /etc/asound.conf with following:
defaults.pcm.card 1 defaults.ctl.card 1
But I have the problem that the ALSA card numbers are not deterministic across reboots.
So I followed this guide to change the name of my USB sound cards to something predictable. Essentially it says:
Create a file in /lib/udev/rules.d/ with a name like 85-my-usb-audio.rules and contents like the following:
DEVPATH=="/devices/pci0000:00/0000:00:12.2/usb1/1-4/1-4.3/1-4.3:1.0/sound/card?", ATTR{id}="MyDev_A"
Using the devices Use the ID string where you would otherwise use the card number, such as
aplay -D default:MyDev_A something.wav
And then I changed my /etc/asound.conf
to:
defaults.pcm.card MyDev_A
defaults.ctl.card MyDev_A
I also tried
defaults.pcm.card "MyDev_A"
defaults.ctl.card "MyDev_A"
But when running for example aplay
, I get errors:
ALSA lib conf.c:1207:(parse_value) card is not a string ALSA lib conf.c:1887:(_snd_config_load_with_include) _toplevel_:2:0:Invalid argument ALSA lib conf.c:3650:(config_file_open) /etc/asound.conf may be old or corrupted: consider to remove or fix it ALSA lib conf.c:3572:(snd_config_hooks_call) function snd_config_hook_load returned error: Invalid argument ALSA lib conf.c:4026:(snd_config_update_r) hooks failed, removing configuration aplay: device_list:281: control open (0): Invalid argument