You are not logged in.

#1 2020-06-24 12:10:57

rafaelmalheiros
Member
Registered: 2020-01-03
Posts: 3

ALSA HDMI Audio

Hi,
I just installed Arch, but ALSA does not work when connect using HDMI to my 1050 Ti.
If I install PulseAudio and pavucontrol, it works fine, but as the Installation Guide says that all I need to do to use ALSA is unmute the channels, I want to know what I'm doing wrong.

It works on headphones.

My goal is to have kbd shortcuts to change from HDMI (TV) to Headphones and set volume.

cat /proc/asound/version
Advanced Linux Sound Architecture Driver Version k5.7.5-arch1-1.
❯ cat /proc/asound/devices
  1:        : sequencer
  2: [ 1- 3]: digital audio playback
  3: [ 1- 7]: digital audio playback
  4: [ 1- 8]: digital audio playback
  5: [ 1- 9]: digital audio playback
  6: [ 1-10]: digital audio playback
  7: [ 1-11]: digital audio playback
  8: [ 1- 0]: hardware dependent
  9: [ 1]   : control
 10: [ 0- 0]: digital audio playback
 11: [ 0- 0]: digital audio capture
 12: [ 0- 3]: digital audio playback
 13: [ 0- 2]: digital audio capture
 14: [ 0- 0]: hardware dependent
 15: [ 0]   : control
 16: [ 2- 0]: digital audio capture
 17: [ 2]   : control
 33:        : timer
❯ cat /proc/asound/cards
 0 [Generic        ]: HDA-Intel - HD-Audio Generic
                      HD-Audio Generic at 0xfe200000 irq 16
 1 [NVidia         ]: HDA-Intel - HDA NVidia
                      HDA NVidia at 0xfe080000 irq 47
 2 [C920           ]: USB-Audio - HD Pro Webcam C920
                      HD Pro Webcam C920 at usb-0000:00:10.1-2, high speed
❯ cat /proc/asound/pcm
00-00: ALC887-VD Analog : ALC887-VD Analog : playback 1 : capture 1
00-02: ALC887-VD Alt Analog : ALC887-VD Alt Analog : capture 1
00-03: ALC887-VD Digital : ALC887-VD Digital : playback 1
01-03: HDMI 0 : HDMI 0 : playback 1
01-07: HDMI 1 : HDMI 1 : playback 1
01-08: HDMI 2 : HDMI 2 : playback 1
01-09: HDMI 3 : HDMI 3 : playback 1
01-10: HDMI 4 : HDMI 4 : playback 1
01-11: HDMI 5 : HDMI 5 : playback 1
02-00: USB Audio : USB Audio : capture 1
❯ aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)
default:CARD=Generic
    HD-Audio Generic, ALC887-VD Analog
    Default Audio Device
sysdefault:CARD=Generic
    HD-Audio Generic, ALC887-VD Analog
    Default Audio Device
front:CARD=Generic,DEV=0
    HD-Audio Generic, ALC887-VD Analog
    Front output / input
surround21:CARD=Generic,DEV=0
    HD-Audio Generic, ALC887-VD Analog
    2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=Generic,DEV=0
    HD-Audio Generic, ALC887-VD Analog
    4.0 Surround output to Front and Rear speakers
surround41:CARD=Generic,DEV=0
    HD-Audio Generic, ALC887-VD Analog
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=Generic,DEV=0
    HD-Audio Generic, ALC887-VD Analog
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=Generic,DEV=0
    HD-Audio Generic, ALC887-VD Analog
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=Generic,DEV=0
    HD-Audio Generic, ALC887-VD Analog
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
hdmi:CARD=Generic,DEV=0
    HD-Audio Generic, ALC887-VD Digital
    HDMI 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
hdmi:CARD=NVidia,DEV=4
    HDA NVidia, HDMI 4
    HDMI Audio Output
hdmi:CARD=NVidia,DEV=5
    HDA NVidia, HDMI 5
    HDMI Audio Output

Offline

#2 2020-06-24 14:39:03

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

Re: ALSA HDMI Audio

You need to find out which of the 6 potential HDMI devices is the one that actually has the screen/HDMI adapter connected (a method to discover that without plain trial and error is described here: https://bbs.archlinux.org/viewtopic.php … 9#p1767509 ) to and then change your default device for ALSA accordingly, but...

rafaelmalheiros wrote:

My goal is to have kbd shortcuts to change from HDMI (TV) to Headphones and set volume.

Do you expect to be able to do that on the fly? Or are you fine with having to completely restart all applications ? If the former you've just found one of the primary reasons for pulseaudio's existence, if the latter you can do that with ALSA but you'd have to swap out config files on hotkey press (... and restart all your applications).

This is fairly trivial to implement from a pulse viewpoint though https://www.freedesktop.org/wiki/Softwa … #index40h3 has a script that roughly does this, if you need to logically adjust this to limit between the possible cards it chooses from you should post/check

pacmd list-sinks

and adjust accordingly

for alsa you'd have a file like ~/.asoundrc-analog

defaults.pcm.!card "Generic"
defaults.ctl.!card "Generic"

and ~/.asoundrc-hdmi

defaults.pcm.!card "Nvidia"
defaults.pcm.device $insertidentifiedALSAdevicenrhere$

defaults.ctl.!card "Nvidia"
defaults.ctl.device $insertidentifiedALSAdevicenrhere$


#And probably configure a softvol plugin, because a HDMI doesn't have a volume control by default...

and then rename/copy paste/symlink the active file to ~/.asoundrc

Last edited by V1del (2020-06-24 15:04:20)

Offline

#3 2020-06-25 18:50:52

rafaelmalheiros
Member
Registered: 2020-01-03
Posts: 3

Re: ALSA HDMI Audio

V1del wrote:

Do you expect to be able to do that on the fly? Or are you fine with having to completely restart all applications? If the former you've just found one of the primary reasons for PulseAudio existence, if the latter you can do that with ALSA but you'd have to swap out config files on hotkey press (... and restart all your applications).

Yes, I expect to be able to do it on the fly. So, I'll use PulseAudio. Thanks for your help.

Offline

Board footer

Powered by FluxBB