You are not logged in.

#1 2008-07-08 23:29:22

jamtat
Member
Registered: 2008-03-13
Posts: 224

solution: 2 sound cards; setting one as default

I've got 2 sound cards in my system: one onboard and one an add-in PCI card. I want to make the better card, the PCI card, the default. But the system seems to detect the onboard sound card first and wants to make it the default card.

I'm coming from Debian/Ubuntu where I had found a solution for this problem. I can't recall exactly what I did to get the PCI card selected as default, but it was probably by specifying modprobe order in /etc/modules. And I couldn't recall the URL of the page where I found that solution. To top it all off, what works under Ubuntu/Debian ain't necessarily gonna work under Arch.

So, I began searching the web for solutions for this problem, favoring results that dealt with Arch. I found a few things that seemed to be relevant but, on careful reading, I found them confusing. I couldn't find any very specific directions to do what I was trying to do under Arch. Instead, I found various bits and pieces of information that seemed relevant but that needed to be put in some comprehensible form. So, I resorted to some fiddling around, hoping I would stumble on a solution. I think I have stumbled onto the solution to the problem of making one of two sound cards be the system's default sound card--at least it appears to be working now on my system. This post will therefore be an attempt to put the necessary information into order, providing a routine that others who may be faced with this task may follow.

The steps are as follows: 1) install alsa-utils; 2) as root, run alsaconf; 3) appropriately edit the file /etc/modprobe.d/sound that alsaconf created in step 3; 4) reboot to find the card you wanted to be the default sound card actually selected as the system's default. An important note: I didn't use alsaconf to do any sound card configuration, though that is its job. The only real role alsaconf played in the routine I used was to create the /etc/modprobe.d/sound file (it seems to create that file after you successully run the command alsaconf). Perhaps the file could be simply created de novo (sudo touch /etc/modprobe.d/sound , set permissions appropriately) and there would be no need to even run alsaconf. I didn't try that, but anyone following these instructions might want to consider doing it this way. Please post your results in this thread if you manually create that file rather than using alsaconf for creating the file.

After I ran alsaconf, the /etc/modprobe.d/sound file contained only two lines, and those lines were specific to the onboard sound chip that I did NOT want to be the default sound card on my system. The lines looked like this:

alias snd-card-0 snd-intel8x0
alias sound-slot-0 snd-intel8x0

From documentation I had read, I understood that the zero (0) in these entries was an indication that this onboard Intel sound card would be the default card. If the /etc/modprobe.d/sound file had contained entries for both my cards (not sure why it didn't), then one set of entries (referring the system's default sound card) would have a zero associated with them, while the other set of two entries (referring to the non-default, second sound card) would have had a one (1) associated with them.

With this information in mind, I then managed to get information from my system (by using lsmod, I believe) on what was the module name for my second, PCI card--the one I wanted to be the system's default sound card. The module name is snd_ymfpci. Once I had that information, I manually added a second set of two lines to /etc/modprobe.d/sound so that the file looked as follows:

alias snd-card-0 snd_ymfpci
alias sound-slot-0 snd_ymfpci
alias snd-card-1 snd-intel8x0
alias sound-slot-1 snd-intel8x0

As you can see, the entries for the snd_ymfpci have a zero associated with them, while the built-in intel sound card entries have a one (1) associated with them. I wasn't at all sure that this would bring the desired results but I found that, once I rebooted the system, that the add-in PCI card was actually now the default card for the system, while the intel onboard card was non-default. Thus, I believe I've stumbled on a solution for making the system use one of two sound cards on the system as the default sound card.

Please feel free to add to or correct my instructions. I can't claim infallible expertise in this matter, so there could well be mistakes in either my understanding or in the steps I've spelled out here. Or perhaps there's just a simpler way to do this under Arch.

James

Btw: I'm using the gnome environment. There seems to be a conflict, or at least some friction, between alsa's sound controls and those of the gnome desktop environment. It's a separate problem, but is there some way I can make gnome's sound controls (e.g., gnome's volume control) override alsa's? So far I've found myself using alsamixer to make any real adjustments to the sound.

Last edited by jamtat (2008-07-09 16:13:09)

Offline

#2 2008-07-09 20:21:44

lldmer
Member
From: Amsterdam
Registered: 2008-05-17
Posts: 119

Re: solution: 2 sound cards; setting one as default

Seems nice:) (I haven't tried it though.) Maybe you could post it on the wiki under alsa or something? It might be easier to find for people, cause I think this might be useful for quit some people.


For lack of better words: chair, never, toothbrush, really. Ohw, and fish!

Offline

#3 2008-07-10 08:36:49

pauldonnelly
Member
Registered: 2006-06-19
Posts: 776

Re: solution: 2 sound cards; setting one as default

lldmer wrote:

Seems nice:) (I haven't tried it though.) Maybe you could post it on the wiki under alsa or something? It might be easier to find for people, cause I think this might be useful for quit some people.

Yes indeed. Some time ago I had a USB audio interface that I had to unplug before boot in order to get my sound in the proper order. Not an issue at the moment since I'm running without a desktop, but I'll definitely be trying this when I set one up agian.

Offline

#4 2008-07-10 10:43:22

KimTjik
Member
From: Sweden
Registered: 2007-08-22
Posts: 715

Re: solution: 2 sound cards; setting one as default

I've written some post about it somewhere, but there's other ways of setting a default card. What I use at the moment (in XFCE):

The output of  cat /proc/asound/cards:

user ~  $   cat /proc/asound/cards
0 [CMI8738        ]: CMI8738-MC6 - C-Media CMI8738
                      C-Media CMI8738 (model 55) at 0x9c00, irq 17
1 [NVidia         ]: HDA-Intel - HDA NVidia
                      HDA NVidia at 0xfe020000 irq 20
2 [U0x46d0x8d7    ]: USB-Audio - USB Device 0x46d:0x8d7
                      USB Device 0x46d:0x8d7 at usb-0000:00:02.0-8, full speed
3 [default        ]: USB-Audio - USB Audio DAC   
                      Burr-Brown from TI               USB Audio DAC    at usb-0000:00:02.0-5, full s

I want to switch between sound-device "CMI8738" and "default" ("default" is a system label not set by me; it's a bit confusing but as you see the system has given the other USB-Audio device another unique label). You could also use the ID numbers, but the drawback of that is that it might change if you plug and unplug USB-Audio devices, hence the unique label is a better choice.

I choose to make a directory like this: /usr/sound. In sound I've to files, could be more if I wanted to switch between other cards as well. First file, named by me "asound_usb":

pcm.!default {
  type hw
  card default
}
  ctl.!default {
  type hw
  card default
}

Another named "asound_pci":

pcm.!default {
  type hw
  card CMI8738
}
  ctl.!default {
  type hw
  card CMI8738
}

The idea is to copy the preferred file to /etc/asound.conf. Hence I made two simple scripts in /bin. "alsa_usb":

#!/bin/sh
cp /usr/sound/asound_usb /etc/asound.conf && /etc/rc.d/alsa restart

And another "alsa_pci":

#!/bin/sh
cp /usr/sound/asound_pci /etc/asound.conf && /etc/rc.d/alsa restart

Writing in terminal from root "alsa_usb" or "alsa_pci" will switch default sound-device. Nothing fancy but pretty handy in my view. If someone prefer to have a desktop entry in /usr/share/applications you could use gksu for example. One I named "alsa_switch_usb.desktop":

[Desktop Entry]
Type=Application
Name=Alsa switch - USB
Comment=Eget skript
Icon=sonata-stock_volume-max.png
Exec=gksu -u root alsa_usb
Terminal=false
StartupNotify=false
Categories=Application;AudioVideo;

Another "alsa_switch_pci.desktop":

[Desktop Entry]
Type=Application
Name=Alsa switch - PCI
Comment=Eget skript
Icon=sonata-stock_volume-max.png
Exec=gksu -u root alsa_pci
Terminal=false
StartupNotify=false
Categories=Application;AudioVideo;

I don't know whether this is an ugly solution or not. Whatever the case is it works very well... for me. wink The asound.conf works of course as a permanent setting, I just prefer the switch option.

Last edited by KimTjik (2008-07-10 10:50:31)

Offline

#5 2009-08-10 17:13:52

jamtat
Member
Registered: 2008-03-13
Posts: 224

Re: solution: 2 sound cards; setting one as default

Well, I'm back to square one with this issue. I did a pacman -Syu last night, then rebooted. Everything seemed to be working ok except sound. I checked /etc/modprobe.d/sound and it's exactly the same as the content I posted above. But the PCI card is no longer the default. Rather, the system sees the onboard card as card 0 and the PCI card as card 1 (as cat /proc/asound/cards reveals). I also tried manually doing what KimTjik suggested (creating an /etc/asound.conf file, setting its content to specify the PCI card I want to be the default, then restarting alsa). That did not work for me. Seeking a new solution for this problem. Will report back on any progress.

James

Offline

#6 2009-08-10 17:50:46

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: solution: 2 sound cards; setting one as default

jamtat wrote:

I'm coming from Debian/Ubuntu where I had found a solution for this problem. I can't recall exactly what I did to get the PCI card selected as default, but it was probably by specifying modprobe order in /etc/modules.

Udev wiki wrote:

A general solution is to specify the module load order yourself by listing the modules in the MODULES array in rc.conf.[1]

The above is the standard advice in these situations. I have to admit I only skimmed your first post, so I'm not completely sure if you tried this yet. smile

[1]http://wiki.archlinux.org/index.php/Ude … _Each_Boot

Offline

#7 2009-08-10 18:27:14

jamtat
Member
Registered: 2008-03-13
Posts: 224

Re: solution: 2 sound cards; setting one as default

tomk wrote:

The above is the standard advice in these situations. I have to admit I only skimmed your first post, so I'm not completely sure if you tried this yet. smile

[1]http://wiki.archlinux.org/index.php/Ude … _Each_Boot

I think I tried rearranging modprobe entries before posting but I can't remember for certain. But I can confirm, after trying it just now, that this method does not cause the preferred PCI sound card to show up in the system as card 0: despite the fact that I've specified in rc.conf that the PCI module (snd-ymfpci) should be loaded before the onboard module (snd-intel8x0), cat /proc/asound/cards nonetheless shows card 0 as the onboard sound card, while card 1 is the PCI add-in card I'd like to be the default. It would appear that the wiki entry is wrong and does not apply to sound cards--unless there's some other modfication on my system that's interfering with modprobe ordering.

I suppose I could try the second option suggested at the wiki, i.e., making a udev entry that associates /dev/dsp with the PCI card and /dev/dsp1 with the onboard sound card. Does that sound like a way of addressing this issue?

Thanks,
James

Offline

#8 2009-08-10 19:02:06

jamtat
Member
Registered: 2008-03-13
Posts: 224

Re: solution: 2 sound cards; setting one as default

http://raftaman.net/?p=343 and http://alsa.opensrc.org/index.php/Udev seem to offer bases for creating udev rules. The alsa entry is a bit confusing to me, though: do my cards really have all those dev files associated with them? How would I find out which are relevant?

DRIVERS=="HDA Intel", KERNEL=="dsp*", NAME="dsp1"
DRIVERS=="HDA Intel", KERNEL=="adsp*", NAME="adsp1"
DRIVERS=="HDA Intel", KERNEL=="audio*", NAME="audio1"
DRIVERS=="HDA Intel", KERNEL=="mixer*", NAME="mixer1"
DRIVERS=="HDA Intel", KERNEL=="pcmC*D0c", NAME="snd/pcmC1D0c"
DRIVERS=="HDA Intel", KERNEL=="pcmC*D0p", NAME="snd/pcmC1D0p"
DRIVERS=="HDA Intel", KERNEL=="pcmC*D1c", NAME="snd/pcmC1D1c"
DRIVERS=="HDA Intel", KERNEL=="pcmC*D1p", NAME="snd/pcmC1D1p"
DRIVERS=="HDA Intel", KERNEL=="pcmC*D2c", NAME="snd/pcmC1D2c"
DRIVERS=="HDA Intel", KERNEL=="controlC*", NAME="snd/controlC1"
DRIVERS=="EMU10K1_Audigy", KERNEL=="dsp*", NAME="dsp"
DRIVERS=="EMU10K1_Audigy", KERNEL=="adsp*", NAME="adsp"
DRIVERS=="EMU10K1_Audigy", KERNEL=="audio*", NAME="audio"
DRIVERS=="EMU10K1_Audigy", KERNEL=="dmmidi*", NAME="dmmidi"
DRIVERS=="EMU10K1_Audigy", KERNEL=="admmidi*", NAME="admmidi"
DRIVERS=="EMU10K1_Audigy", KERNEL=="amidi*", NAME="amidi"
DRIVERS=="EMU10K1_Audigy", KERNEL=="midi*", NAME="midi"
DRIVERS=="EMU10K1_Audigy", KERNEL=="mixer*", NAME="mixer"
DRIVERS=="EMU10K1_Audigy", KERNEL=="controlC*", NAME="snd/controlC0"
DRIVERS=="EMU10K1_Audigy", KERNEL=="hwC*D0", NAME="snd/hwC0D0"
DRIVERS=="EMU10K1_Audigy", KERNEL=="hwC*D2", NAME="snd/hwC0D2"
DRIVERS=="EMU10K1_Audigy", KERNEL=="midiC*D0", NAME="snd/midiC0D0"
DRIVERS=="EMU10K1_Audigy", KERNEL=="midiC*D1", NAME="snd/midiC0D1"
DRIVERS=="EMU10K1_Audigy", KERNEL=="midiC*D2", NAME="snd/midiC0D2"
DRIVERS=="EMU10K1_Audigy", KERNEL=="pcmC*D0c", NAME="snd/pcmC0D0c"
DRIVERS=="EMU10K1_Audigy", KERNEL=="pcmC*D0p", NAME="snd/pcmC0D0p"
DRIVERS=="EMU10K1_Audigy", KERNEL=="pcmC*D1c", NAME="snd/pcmC0D1c"
DRIVERS=="EMU10K1_Audigy", KERNEL=="pcmC*D2p", NAME="snd/pcmC0D2p"
DRIVERS=="EMU10K1_Audigy", KERNEL=="pcmC*D2c", NAME="snd/pcmC0D2c"
DRIVERS=="EMU10K1_Audigy", KERNEL=="pcmC*D3p", NAME="snd/pcmC0D3p"

james

Offline

#9 2009-08-10 19:32:04

jamtat
Member
Registered: 2008-03-13
Posts: 224

Re: solution: 2 sound cards; setting one as default

Something a bit more specific to creating udev rules for sound cards: http://lists.linuxaudio.org/pipermail/l … 22920.html . More recent, too. But this, coming from someone who is obviously quite technically adept at working with alsa and udev, doesn't sound too encouraging: "Conclusion; All told, a bit of a mixed bag of results but hopefully this may help someone to start a little further investigation and maybe we can make the udev/alsa combination do what is needed."

James

Offline

#10 2009-08-10 22:23:43

jamtat
Member
Registered: 2008-03-13
Posts: 224

Re: solution: 2 sound cards; setting one as default

I think I've resolved this (fingers crossed). If I'm right about that, there is no need for crafting udev rules for the sound cards. While researching this I came again across the Arch Wiki entry for alsa ( http://wiki.archlinux.org/index.php/ALSA ). Though I didn't read anything specifically about multi-card setups there, I did run across this, which seemed relevant:

File: /etc/modprobe.d/modprobe.conf (with module-init-tools 3.5-1 /etc/modprobe.conf)

options snd-intel8x0 index=0
options snd-pcsp index=1

I simply modified those directions for my system with its two sound cards. So, what I have is

options snd-ymfpci index=0
options snd-intel8x0 index=1

When I rebooted, the PCI card was card 0 and the onboard card was card 1, just what I'd wanted. It seems to me a change occurred that caused my system's sound setup to break. The change, apparently, is that the system stopped looking at the file named "sound" under /etc/modprobe.d/ and started looking for the file named /etc/modprobe.d/modprobe.conf . Once I entered the sound card priority I wanted within that file, the system seems to have started working again like I want it to.

James

PS I understand that sound cards tend to get swapped at boot time somewhat unpredictably, which is why I'm hesitant to say I found the solution to my problem. I rebooted 3 times so far (for testing) and each time the PCI card has come up as card 0. So I may have resolved the problem. If I prove wrong about that, i.e., if on some future reboot the system swaps cards again, I'll start looking for another solution and will post results here.

Last edited by jamtat (2009-08-10 22:26:28)

Offline

#11 2009-08-10 22:38:08

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,868

Re: solution: 2 sound cards; setting one as default

After a recent change only files with ".conf"  extension in /etc/modprobe.d/ are processed, files without that extension are ignored.
Iirc there is a warning during boot about this change.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#12 2009-08-10 23:52:40

jamtat
Member
Registered: 2008-03-13
Posts: 224

Re: solution: 2 sound cards; setting one as default

Lone_Wolf wrote:

After a recent change only files with ".conf"  extension in /etc/modprobe.d/ are processed, files without that extension are ignored.
Iirc there is a warning during boot about this change.

Thanks for the clarification. I saw the warning but it scrolled by so quickly that I couldn't read it (I tried several times).

James

Offline

Board footer

Powered by FluxBB