I bought an USB sound card. I'd like to set up my Linux desktop so that it prefers the USB device, if it is plugged in and automatically switches as the device is (un)plugged. Is it possible, and how?
|
|
Find your card with
To get valid ALSA card names, use
and then create
Replace "card 1" with the number or name of your card determined above. Alternatively, you can change ordering of your cards so your USB card will be card 0 and it will work without editing |
|||||||||||||||||
|
|
this is the method for selecting default sound card in Alsa. You may want to install Alsa for this method to work if you are using Pulse Audio.
will list your sound modules .The output of the command will be like this (eg):
you can pretty easily understand which one is your usb sound card from above.
edit this alsa-base.conf in such a way that your preferred card has an index =-2 / 0 and the other card has index =-1 / 1 (stick with -2 and -1 )
in this case usb device is preferred device. if you are having two differnt cards with same name from the output, like this:
issue this command to find out which is which:
then edit modules in this way:
a reboot may be necessary.so you might have to manually switch over your sound cards. |
|||||||||||||||||||||
|
|
I also couldnt get output from my USB device. My
I have tried both answer described here which didnt help (with many index combination and lot of restart). I think problem was my USB device initialize after boot-up. Whatever, so my working solution is blacklisting other 2 sound device by updating
|
|||
|
|
|
The answer from Matija Nalis only half worked for me (alsamixer changed default, but other things like aplay and firefox stubbornly stuck with the wrong default). This example from the debian wiki worked for me (on CentOS-6 laptop):
For the record: ALSA is poorly documented, and especially this very simple stuff like selecting which card to use is way too hard. Worse, it seems to change between systems. Also, I got that "Generic_1" tag from aplay -l where it comes up as "card 1" in the list. Other people seemed to be using it, so I did the same... what it means I cannot say. |
|||
|
|
|
While you can change the default alsa card by editing .asoundrc or the system asound.conf there are a couple of significant issues with this approach. It's fragile, and requires application restarts to be honored. If you want to switch cards on the fly then you really need to use a soundserver that abstracts the applications from the soundcard correctly such as pulseaudio. |
|||||
|
|
Here is a variant of Matija Nalis and Tel's answers. This is what worked for me: ~/.asoundrc
(Odroid C0, Debian Jessie, HDMI audio as card 0 and USB Sound Card as card 1 according to aplay -l) Note: other methods did not work for me, as /proc/asound/modules does not exist and there is no hdmi audio module to blacklist or put to low priority, it is embedded into the kernel. It seems I would have had to recompile the kernel without hdmi audio support to disable it completely. |
|||||||||
|
protected by Community♦ Aug 18 '16 at 0:36
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?