Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have this following asound.conf file, but when i play $ speaker-test it fails. How can you tell asound.conf that each and every time on restart of pc also use this sound card only?

"card 2: PCH [HDA Intel PCH], device 0: ALC892 Analog [ALC892 Analog]
  Subdevices: 1/1"??


$ aplay -l
**** List of PLAYBACK Hardware Devices ****
ALSA lib conf.c:1220:(parse_def) default is not a compound
ALSA lib conf.c:1686:(snd_config_load1) _toplevel_:2:13:Invalid argument
ALSA lib conf.c:3406:(config_file_open) /etc/asound.conf may be old or corrupted: consider to remove or fix it
card 1: Device [C-Media USB Audio Device], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: PCH [HDA Intel PCH], device 0: ALC892 Analog [ALC892 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: PCH [HDA Intel PCH], device 1: ALC892 Digital [ALC892 Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: PCH [HDA Intel PCH], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

$ cat /etc/asound.conf
    pcm.default {
        type hw # Kernel PCM
        card 2
        device 0 # Device number (default 0)
        #[subdevice] INT # Subdevice number, -1 first available (default -1)
        #mmap_emulation BOOL # enable mmap emulation for ro/wo devices

    }
    pcm.!default {
        type hw # Kernel PCM
        card 2
        device 0 # Device number (default 0)
        #[subdevice] INT # Subdevice number, -1 first available (default -1)
        #mmap_emulation BOOL # enable mmap emulation for ro/wo devices
    }

I tried this it works but how to avoid using the hw:2,0 but use some static string so that on reboot it does not get lost?

pcm.!default {
         type asym
         playback.pcm {
                 type plug
                 slave.pcm "hw:0,1"
         }
 }
share|improve this question

1 Answer 1

up vote 3 down vote accepted

To just change the default cards, replace that asound.conf with this:

defaults.pcm.card 2
defaults.pcm.device 0

To be independent from changing card numbers, use the card ID instead:

defaults.pcm.card PCH
defaults.pcm.device 0
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.