You are not logged in.

#1 2021-04-06 20:32:21

x_driver
Member
Registered: 2019-02-05
Posts: 14

Default ALSA sound card, device, subdevice

Per the wiki I can set the default card to "card 1: NVidia."  What I can't seem to do is set a default device, i.e. "card 1:  NVidia, device 3."  After waking from suspend or rebooting, sometimes "device 3" is being used and other times it is "device 7."  Compare the 2 outputs of aplay -l below and you can see that originally device 7 is being used, then after a suspend cycle device 3 is being used. 

[family@HTPC ~]$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC892 Analog [ALC892 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 1: ALC892 Digital [ALC892 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: 0/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
card 1: NVidia [HDA NVidia], device 10: HDMI 4 [HDMI 4]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 11: HDMI 5 [HDMI 5]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 12: HDMI 6 [HDMI 6]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
[family@HTPC Downloads]$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC892 Analog [ALC892 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 1: ALC892 Digital [ALC892 Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0]
  Subdevices: 0/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
card 1: NVidia [HDA NVidia], device 10: HDMI 4 [HDMI 4]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 11: HDMI 5 [HDMI 5]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 12: HDMI 6 [HDMI 6]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

I also referenced the link below to try and set a device but no success.

https://alsa.opensrc.org/Asoundrc#Default_PCM_device

What am I missing in order to have the NVidia card use a persistent device?

Offline

#2 2021-04-06 20:51:25

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,668

Re: Default ALSA sound card, device, subdevice

You can additionally pass the "device" in alsa config, however if I'm interpreting this right the issue is that the actual device nvidia registers as the connected ALSA device shifts between suspension cycles.

You probably want to use something with more flexibility. Though I do find it weird that this can be random here if that is the case you probably don't get around using something that actively keeps track of the actual device connected like pipewire or pulseaudio

Last edited by V1del (2021-04-06 20:52:02)

Offline

#3 2021-04-06 21:05:53

x_driver
Member
Registered: 2019-02-05
Posts: 14

Re: Default ALSA sound card, device, subdevice

Trying everything I can to avoid pulseaudio.  I had been using Gnome and other desktop environments with pulse as a dependency and just wasn't happy with the results.  The computer is used exclusively as a home theater pc so passthrough audio is quite important.  Now it's just an Arch install with i3 as the window manager that runs Kodi.

I'd entertain pipewire.  I know it's new and not much else about it.

And yes, you are correct, the actual device that Nvidia registers as connected shifts between suspension cycles.  So sometimes, not always, after a suspend cycle I'll have to manually select either HDMI 0 or HDMI 1 from the audio menu within Kodi, both of which are on the same Nvidia card.

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: 0/1
  Subdevice #0: subdevice #0

Offline

#4 2021-04-16 18:17:52

x_driver
Member
Registered: 2019-02-05
Posts: 14

Re: Default ALSA sound card, device, subdevice

I installed pipewire.  On a reboot sound works great, just like it was before.  After a suspend cycle the behavior is a bit different.

* pipewire.service - Multimedia Service
     Loaded: loaded (/usr/lib/systemd/user/pipewire.service; enabled; vendor preset: enabled)
     Active: active (running) since Fri 2021-04-16 10:28:48 MST; 33min ago
TriggeredBy: * pipewire.socket
   Main PID: 551 (pipewire)
      Tasks: 2 (limit: 19112)
     Memory: 7.7M
        CPU: 3.288s
     CGroup: /user.slice/user-1000.slice/user@1000.service/session.slice/pipewire.service
             `-551 /usr/bin/pipewire

Apr 16 10:28:48 HTPC systemd[544]: Started Multimedia Service.
Apr 16 10:31:37 HTPC pipewire[551]: 'hdmi:1': playback open failed: Device or resource busy
Apr 16 10:31:37 HTPC pipewire[551]: 'hdmi:1': playback open failed: Device or resource busy
Apr 16 10:31:37 HTPC pipewire[551]: params Spa:Enum:ParamId:EnumFormat: 0:0 (follower format) Device or resource busy
Apr 16 10:31:37 HTPC pipewire[551]: (alsa_output.pci-0000_01_00.1.hdmi-stereo-37) suspended -> error (Start error: Device or resource >
Apr 16 10:32:04 HTPC pipewire[551]: 'hdmi:1': playback open failed: Device or resource busy
Apr 16 10:32:04 HTPC pipewire[551]: 'hdmi:1': playback open failed: Device or resource busy
Apr 16 10:32:04 HTPC pipewire[551]: params Spa:Enum:ParamId:EnumFormat: 0:0 (follower format) Device or resource busy
Apr 16 10:32:04 HTPC pipewire[551]: (alsa_output.pci-0000_01_00.1.hdmi-stereo-37) suspended -> error (Start error: Device or resource >

Running AlsaMixer the PipeWire Card shows

This sound device does not have any playback controls.

There is a change to aplay -l output, notice that all of the Subdevices show 1/1

[family@HTPC ~]$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC892 Analog [ALC892 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 1: ALC892 Digital [ALC892 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
card 1: NVidia [HDA NVidia], device 10: HDMI 4 [HDMI 4]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 11: HDMI 5 [HDMI 5]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 12: HDMI 6 [HDMI 6]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Any other suggestions on how to suspend and resume with the system "remebering" it's last state?

Offline

Board footer

Powered by FluxBB