Persistent device naming, alsa
Linux for blind general discussion
blinux-list at redhat.com
Wed Sep 15 09:23:24 UTC 2021
On Tue, 14 Sep 2021, Linux for blind general discussion wrote:
> I have a USB audio device that I use for system sounds via pulse, and speech.
> In my default.pa, I have
> set-default-sink alsa_output.usb-C-Media_Electronics_Inc._USB_Audio_Device-00.analog-stereo
> I also have onboard audio, to which my surround speakers are connected.
> For my mpv, I can use this line in ~/.config/mpv/mpv.conf:
> audio-device=pulse/alsa_output.pci-0000_00_1f.3.analog-stereo
> That's the onboard card.
> I also use pianobar, which uses libao, to produce its audio. The problem is that
> dev=hw:0
> changes on each boot. I need a way to specify a device by it's name somewhere, so that I can call it in application, even if it's hw ID changes.
> What can I do there?
You can set an option for the ALSA modules for your cards to specify the
card number, so that it doesn't change.
Put the following in a file in /etc/modprobe.d ending in .conf (e.g.
/etc/modprobe.d/alsa.conf):
options snd-usb-audio index=0
You may need to set the other one to 1 as it will likely be detected
first.
There is a good discussion of setting default soundcards and the various
ways it can be done at
https://wiki.archlinux.org/title/Advanced_Linux_Sound_Architecture#Set_the_default_sound_card
HTH,
Geoff.
More information about the Blinux-list
mailing list