No way to select default/primary audio device, if more than one is installed

Bug #8107 reported by j^
76
This bug affects 2 people
Affects Status Importance Assigned to Milestone
alsa-lib (Ubuntu)
Fix Released
Medium
Martin Pitt

Bug Description

there is no way to select the default sound card if more than one soundcard is
installed. i have two cards installed, one onboard on the
motherboard(snd-intel8x0) and a pci card(snd-ice1712)
the onboard card is, by default loaded first and thus the default output,
the only way i know of to change the order is to put snd-ice1712 in /etc/modules,
which is not intuitive, nor acceptable as an interface.

Revision history for this message
Thomas Hood (jdthood) wrote :

I think that the solution to this is for applications to take notice
of what sound card it is they are actually talking to -- i.e., for them
to identify cards by their properties (such as the card i.d.) rather
than by the card index which, especially in a hotplug environment, may
be different on different occasions (just as a network card can turn up
as eth0 or eth1 on different occasions).

What we need to discuss is how best to enhance sound applications.
Should alsa-lib be enhanced somehow?

Revision history for this message
Matt Zimmerman (mdz) wrote :

The desktop is supposedly going to be standardizing on polypaudio; Jeff, does
polypaudio provide a UI for configuring which sound device it will use?

Revision history for this message
Jeff Waugh (jdub) wrote :

No, not yet. Possibly within the next release timeframe. I'd like to bounty a
few things related to this.

Revision history for this message
Thomas Hood (jdthood) wrote :

$ cat /proc/asound/cards
0 [CS46xx ]: CS46xx - Sound Fusion CS46xx
                     Sound Fusion CS46xx at 0x50100000/0x50000000, irq 11
$ aplay -Dhw:CS46xx /usr/share/sounds/ring.wav
      (plays)

Using libasound2 one can already specify sound card by ID rather than
by index.

Revision history for this message
Matt Zimmerman (mdz) wrote :

libesd provides a build which links with libasound, but we found it to be buggy
compared to the OSS build.

polypaudio currently doesn't seem to link with libasound.

Revision history for this message
Matt Zimmerman (mdz) wrote :

*** Bug 12101 has been marked as a duplicate of this bug. ***

Revision history for this message
Jeff Waugh (jdub) wrote :

*** Bug 10961 has been marked as a duplicate of this bug. ***

Revision history for this message
Jeff Waugh (jdub) wrote :

*** Bug 12489 has been marked as a duplicate of this bug. ***

Revision history for this message
Matt Zimmerman (mdz) wrote :

*** Bug 12717 has been marked as a duplicate of this bug. ***

Revision history for this message
Matt Zimmerman (mdz) wrote :

*** Bug 12835 has been marked as a duplicate of this bug. ***

Revision history for this message
Marc Poulhiès (marc-poulhies) wrote :

I found a workaround for this bug. Seems that the sound system will use the
first Alsa card, so I added in /etc/modutils/alsa-base things like:
options snd-usb-audio index=-2
options snd-cmipci index=1
options snd-emu10k1 index=0

If not, the first audio device would be the usbaudio, which is in fact a Webcam,
then the internal (cmipci) and finally the SB Live! Forcing indexes works fine,
except that every update of alsa-base seems to overwrite my changes (not a big
deal).
Hope this is not off topic and that it could help ppl to workaround this while
waiting for something better ;)

Marc

Revision history for this message
Philippe Landau (lists-mailry) wrote :

i removed my tv card, restarted, and have still no sound.
do i need to reconfigure something ?
(this is not concerning the gstreamer package only,
it's the whole system sound.)

Revision history for this message
Scott Robinson (scott-ubuntu) wrote :

Created an attachment (id=2102)
Example .asoundrc where the second soundcard is the default.

Revision history for this message
Scott Robinson (scott-ubuntu) wrote :

The workaround I use to use a ~/.asoundrc specifying my second soundcard as the
default. Almost all (polypaudio being a notable exception, see Bug 13407)
programs respect and use the "default" soundcard.

The other issue this doesn't solve is programs still using OSS, and accessing
the dsp devices.

The nice thing about this solution is it's completely user-space.

Revision history for this message
Matt Zimmerman (mdz) wrote :

In order to use that solution, we'd need to switch from libesd0 to libesd-alsa0
(we intentionally went the other way originally, due to stability problems with
libesd-alsa0). Are you using libesd-alsa0 successfully now?

Revision history for this message
Wouter Stomp (wouterstomp-deactivatedaccount) wrote :

It would be great if it would also be possible to use them both at once instead
of selecting one. This way you can have your favorite music playing on one
through your stereo speakers, and have all the other sounds on the other from
your pc's speakers.

Revision history for this message
Robert North (0rayrr602) wrote :

My preferred soloution would be to add a file to /etc/modprobe.d/
that spcifies options to be applied when loading the ALSA modules.

One option defines the order in which ALSA devices are numbered.
By default, the default ALSA device is zero.

By setting this option you not only define the defalut device for ALSA devices,
but also the defalults for the simulated OSS devices.

To get my cards in the correct order, I used the following:

options snd_cs46xx index=0 # Videologic Sonic Fury card. (Default)
options snd_intel8x0 index=1 # Motherboard Nforce sound.

For reference, see for example:
 The "Troubleshooting" on this website:
    http://wiki.debian.net/?ALSA

Revision history for this message
Matt Zimmerman (mdz) wrote :

See http://udu.wiki.ubuntu.com/AudioInfrastructure for the outcome of
discussions at Ubuntu Down Under on this subject

Revision history for this message
Martin Pitt (pitti) wrote :

*** Bug 16201 has been marked as a duplicate of this bug. ***

Revision history for this message
Martin Pitt (pitti) wrote :

Now there is at least a place where this can be changed graphically:

control-center (1:2.11.2-0ubuntu3) breezy; urgency=low

  * debian/patches/23_default_soundcard_selector.patch:
    - Add a default sound card selector to gnome-sound-properties.
    - Use the ALSA library to enumerate available cards and to get the default
      card.
    - Use set-default-soundcard to actually change ~/.asoundrc.
    - Deactivate the combo box if set-default-soundcard is not available, no
      sound card is installed, or ~/.asoundrc cannot be modified (custom
      configuration).

 -- Martin Pitt <email address hidden> Wed, 25 May 2005 16:15:59 +0200

I will add hotplug support soon, i. e. that a dialog pops up when a new
soundcard is added.

Revision history for this message
Matt Zimmerman (mdz) wrote :

*** Bug 16801 has been marked as a duplicate of this bug. ***

Revision history for this message
adolfotregosa (adolfotregosa) wrote :

yeah, in kubuntu theres is no way of telling the default sound card. Please, add a simple applet to choose the default sound card!!

Revision history for this message
Martin Pitt (pitti) wrote :

Please file a new bug for the KDE applet issue (against kdemultimedia)

Revision history for this message
Karl Hegbloom (karl.hegbloom) wrote :

Here's something that potentially may be part of a good general solution:

  http://alsa.opensrc.org/Default_device_from_environment_variable

Revision history for this message
a-r-k-i-b-o-t-t (arkibott-ray) wrote :

I don't use the KDE and kubuntu Versions.

I got the Problem with my Feisty 7.04 with actual updates and a onboard and a soundcard (terratec) in the machine.

The sound output jumps sometimes between the devices. The Things i set up in the gnome system config doesn't fix this Problem.

Revision history for this message
hapubun (sdeal2) wrote :

creat a shortcut to dsp1 in folder gksudo nautilus /dev name the shortcut to dsp then set the permissions to root readonly, audio read&write , others readonly then reboot then u should here sound on the login screen to know it works hope this helps this fix my audio problems on Ati AGP HD 3650 Video card on iwill-xp333-r ALI chipset mother board

prob onboard sound on ati video card

usb speakers quick fix !!!

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.