You are not logged in.

#1 2013-11-13 20:26:34

replax
Member
Registered: 2011-02-12
Posts: 90

Setting the default ALSA Sound Device, wiki methods not working?

Hi!
I want to set my default audio device different from the current one, namely different from my default laptop analog output.

My laptop has two outputs, analog and HDMI, however, IF it is connected I want my default audio output to be my USB Dac.

aplay -l

**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: CX20590 Analog [CX20590 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 8: HDMI 2 [HDMI 2]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: U0x262a0x10e1 [USB Device 0x262a:0x10e1], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: U0x262a0x10e1 [USB Device 0x262a:0x10e1], device 1: USB Audio [USB Audio #1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

alternatively, it is also okay for the default to be set at boot time, as i shutdown my laptop when changing setups.
i tried the method with an alsa-base.conf file in /etc/modprobe.d/ and also the /etc/asound.conf file.

with the alsa-base.conf file, I get error msgs when executing even aplay -l, while the asound.conf method gives me:

speaker-test 1.0.27.2

Playback device is default
Stream parameters are 48000Hz, S16_LE, 1 channels
Using 16 octaves of pink noise
ALSA lib pcm_hw.c:1667:(_snd_pcm_hw_open) Invalid value for card
Playback open error: -19,No such device

my asound.conf:

pcm.!default {
        type plug
        slave.pcm {
                @func getenv
                vars [ ALSAPCM ]
                default "hw:0x262a:0x10e1"
        }
}

has anybody an idea on how to possibly fix this?
thanks a lot big_smile!

Offline

#2 2013-11-13 23:34:03

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: Setting the default ALSA Sound Device, wiki methods not working?

replax wrote:

USB Dac

Pulseaudio is probably convenient for you, to switch between audio devices.

In pure ALSA, I switch files to ~/.asoundrc

Offline

#3 2013-11-15 23:00:36

replax
Member
Registered: 2011-02-12
Posts: 90

Re: Setting the default ALSA Sound Device, wiki methods not working?

Thanks for the link you posted.
Unfortunately, i don't really get the advice posted there...

I figured out one thing by myself though, in my asound config the name of my DAC was wrong, I missed an 'U' in the front.

Still, I am not sure why i even have to do any config at all, really. Or maybe my expected behaviour is not the default.
I think of it like that: always use my laptop output as default, however: IF i plug in another audio device, it's got to have a reason why i plugged it, so change the default to the newly plugged in device.

Is there a way to do that?


ps. eg now it got somehow f'd up and i have TWO default devices. no idea how it did that/how that's possible.
aplay -L:

null
    Discard all samples (playback) or generate zero samples (capture)
pulse
    PulseAudio Sound Server
sysdefault:CARD=PCH
    HDA Intel PCH, CX20590 Analog
    Default Audio Device
front:CARD=PCH,DEV=0
    HDA Intel PCH, CX20590 Analog
    Front speakers
surround40:CARD=PCH,DEV=0
    HDA Intel PCH, CX20590 Analog
    4.0 Surround output to Front and Rear speakers
surround41:CARD=PCH,DEV=0
    HDA Intel PCH, CX20590 Analog
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=PCH,DEV=0
    HDA Intel PCH, CX20590 Analog
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=PCH,DEV=0
    HDA Intel PCH, CX20590 Analog
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=PCH,DEV=0
    HDA Intel PCH, CX20590 Analog
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
hdmi:CARD=PCH,DEV=0
    HDA Intel PCH, HDMI 0
    HDMI Audio Output
hdmi:CARD=PCH,DEV=1
    HDA Intel PCH, HDMI 1
    HDMI Audio Output
hdmi:CARD=PCH,DEV=2
    HDA Intel PCH, HDMI 2
    HDMI Audio Output
sysdefault:CARD=Audio
    SA9023 USB Audio, USB Audio
    Default Audio Device
front:CARD=Audio,DEV=0
    SA9023 USB Audio, USB Audio
    Front speakers
surround40:CARD=Audio,DEV=0
    SA9023 USB Audio, USB Audio
    4.0 Surround output to Front and Rear speakers
surround41:CARD=Audio,DEV=0
    SA9023 USB Audio, USB Audio
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=Audio,DEV=0
    SA9023 USB Audio, USB Audio
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=Audio,DEV=0
    SA9023 USB Audio, USB Audio
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=Audio,DEV=0
    SA9023 USB Audio, USB Audio
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=Audio,DEV=0
    SA9023 USB Audio, USB Audio
    IEC958 (S/PDIF) Digital Audio Output

therefore, mpd cannot play, neither can anything else besides apps which let you specify audio devices on the fly...

Last edited by replax (2013-11-15 23:02:40)

Offline

Board footer

Powered by FluxBB