You are not logged in.

#1 2016-08-01 02:57:26

sherrellbc
Member
Registered: 2014-05-26
Posts: 112

[SOLVED] Cannot change system default audio device

I feel as if there is so much documentation surrounding this problem that I would have been able to solve it.

So, I have an NVidia graphics card with two HDMI ports that I use to drive my two external monitors. I am trying to set the system default device to one of these monitors. I checked the output of aplay:

$aplay -L

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

I tried a

$speaker-test --D hdmi:NVidia -c 2

And successfully get audio through my left speaker.

So, I then followed the "Alternative Method" from the wiki to configure my global default device from "/etc/asound.conf".  I put the following in this configuration file:

pcm.!default {
    type hw
    card NVidia
}

ctl.!default {
    type hw
    card NVidia
}

Considering that my devices was defined as "Nvidia" per:

 
$ aplay -l | awk -F \: '/,/{print $2}' | awk '{print $1}' | uniq
PCH
NVidia

The only change this got me was that the "default" device was was dropped from the devices shown by aplay

$ aplay -L

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

I also tried setting "card 1" rather than "card NVidia", but this proved a failure as well. I then tried to install the AUR asoundconf package. Although it was successfully generating my local asoundconf file in my home directory it was doing nothing to change the system default sound device; the behavior is similar to that described above expect that the "default" device does not disappear -- it just does not change from "CARD=PCH".

Interestingly, the "device" numbers for my NVidia card seem to be inconsistent. The lowercase "L" parameter to aplay gives the same card number (.e.g. 1) but shows device numbers 3,7,8, and 9. The uppercase "L" parameter shows no card number but rather seems to define the card only with a name (e.g. "NVidia" -- shown above) and device numbers 0, 1, 2, and 3.

$ aplay -l

**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC1150 Analog [ALC1150 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 1: ALC1150 Digital [ALC1150 Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 8: HDMI 2 [HDMI 2]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 9: HDMI 3 [HDMI 3]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

tl;dr
I am able to get sound from the audio device -- I just am not able to set my system default to point to them.

Last edited by sherrellbc (2016-08-01 20:55:19)

Offline

#2 2016-08-01 09:01:33

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,452

Re: [SOLVED] Cannot change system default audio device

Find out which device number from aplay -l is the correct one and append that information to the asound definition. cycle through with

speaker-test -Dhw:1,$device -c2 

until you get the one that produces sound and add the appropiate device number to the pcm.!default and ctl.!default definitions e.g.

pcm.!default {
    type hw
    card NVidia
    device 3
}

ctl.!default {
    type hw
    card NVidia
    device 3
}

Offline

#3 2016-08-01 12:50:35

sherrellbc
Member
Registered: 2014-05-26
Posts: 112

Re: [SOLVED] Cannot change system default audio device

V1del wrote:

Find out which device number from aplay -l is the correct one and append that information to the asound definition. cycle through with

speaker-test -Dhw:1,$device -c2 

until you get the one that produces sound and add the appropiate device number to the pcm.!default and ctl.!default definitions

I posted in the OP how I did exactly this. The only difference between what I did and what you have here is that you included a "device" label. The device happens to be zero, which I assumed would be the default if not included. When I do a speaker test I just have to do

speaker-test -D hdmi:NVidia -c 2

Or even

speaker-test -D hdmi -c 2

To successfully get audio out of my monitors over HDMI.
I will try including the additional label to see if it makes a difference.

Offline

#4 2016-08-01 14:36:06

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,452

Re: [SOLVED] Cannot change system default audio device

The aplay -L values are more of a high level notion as far as I understand (they are PCMs with predefined values to get something to play, the "default" is a seperate PCM, which you'll have to define correctly, i.e. the hdmi PCM  is simply predefined to

pcm.hdmi {
   type hw
   card NVidia
   device 3
}

), to redefine the default card correctly you will/might have to use the lower level information printed by aplay -l the correct one I assume to be device 3 if simply speaker-test -Dhdmi is enough.

I only have a cursory knowledge of this, as I mainly use pulseaudio which implicitly takes care of these fine differences for me,  maybe someone else might be able to give so more apt details. Still there is a difference between aplay -l and aplay -L that is to be taken into consideration using

speaker-test -Dhdmi -c2

(you are accessing the predefined virtual device PCM) is different from

speaker-test -Dhw:1,3 -c2

(direct hardware access to the correct card without predefined "helper" values) and to redefine the default card (with the method mentioned in your posted wiki article) you will have to use the information from aplay -l as opposed to aplay -L

Last edited by V1del (2016-08-01 14:39:19)

Offline

#5 2016-08-01 20:57:10

sherrellbc
Member
Registered: 2014-05-26
Posts: 112

Re: [SOLVED] Cannot change system default audio device

V1del wrote:

Find out which device number from aplay -l is the correct one and append that information to the asound definition. cycle through with

speaker-test -Dhw:1,$device -c2 

until you get the one that produces sound and add the appropiate device number to the pcm.!default and ctl.!default definitions e.g.

pcm.!default {
    type hw
    card NVidia
    device 3
}

ctl.!default {
    type hw
    card NVidia
    device 3
}

This was the solution. It seemed to be taking a default device number, maybe 0, when unspecified in the configuration. The important note to take away from this, as you said, the information about hardware appears to be distinctly different between aplay -L and aplay -l.

For instance, both of these tests worked:

Card=NVidia, Device=0

speaker-test -D hdmi:NVidia,DEV=0 -c 2

and

Card=1, Device=3

speaker-test -D hw:1,3 -c 2

Last edited by sherrellbc (2016-08-01 20:59:17)

Offline

#6 2016-08-02 12:26:20

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,452

Re: [SOLVED] Cannot change system default audio device

Yes the "default" device defaults to using 2 channel dmix with hw:0,0 , with your redefinition you make the 2 channel dmix point to hw:1,3 Also note the $device label I used in my initial example was not to be written literally but be replaced by the values given in the aplay -l output that might have lead to the initial confusion.

Offline

#7 2016-08-02 12:45:33

sherrellbc
Member
Registered: 2014-05-26
Posts: 112

Re: [SOLVED] Cannot change system default audio device

V1del wrote:

Yes the "default" device defaults to using 2 channel dmix with hw:0,0 , with your redefinition you make the 2 channel dmix point to hw:1,3 Also note the $device label I used in my initial example was not to be written literally but be replaced by the values given in the aplay -l output that might have lead to the initial confusion.

Oh, sorry. There was no confusion. I was just restating what you said so others reading this thread in the future may find a "tl;dr" version.

Offline

Board footer

Powered by FluxBB