LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Getting sound from NVidia desktop video card to TV over HDMI (https://www.linuxquestions.org/questions/slackware-14/getting-sound-from-nvidia-desktop-video-card-to-tv-over-hdmi-4175509353/)

dugan 06-27-2014 03:28 AM

Getting sound from NVidia desktop video card to TV over HDMI
 
1 Attachment(s)
How do I get HDMI audio working? I'm connecting an NVidia GTX 760 video card to a TV over HDMI. Video is going over the HDMI cable; I'm trying to get audio over the HDMI cable too.

I've attached a screenshot of what I see in alsamixer if I press F6 to select the sound card built into the video card. As you can see, I can unmute the channels, but I can't set their volumes above zero.

I should mention that when I boot into Windows, audio over HDMI just works. I say this not to whine, but because I think it's relevant to troubleshooting.

Here's my aplay -l

Code:

**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC887-VD Analog [ALC887-VD Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 1: ALC887-VD Digital [ALC887-VD 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

And here's my aplay -L:

Code:

null
    Discard all samples (playback) or generate zero samples (capture)
default:CARD=PCH
    HDA Intel PCH, ALC887-VD Analog
    Default Audio Device
sysdefault:CARD=PCH
    HDA Intel PCH, ALC887-VD Analog
    Default Audio Device
front:CARD=PCH,DEV=0
    HDA Intel PCH, ALC887-VD Analog
    Front speakers
surround40:CARD=PCH,DEV=0
    HDA Intel PCH, ALC887-VD Analog
    4.0 Surround output to Front and Rear speakers
surround41:CARD=PCH,DEV=0
    HDA Intel PCH, ALC887-VD Analog
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=PCH,DEV=0
    HDA Intel PCH, ALC887-VD Analog
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=PCH,DEV=0
    HDA Intel PCH, ALC887-VD Analog
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=PCH,DEV=0
    HDA Intel PCH, ALC887-VD Analog
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=PCH,DEV=0
    HDA Intel PCH, ALC887-VD 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'm using the binary NVidia drivers, of course.

enorbet 06-27-2014 09:19 AM

Greetz
I have essentially the same card but I don't have anything I can plug HDMI into to test audio but I am very curious as to how this thread turns out since I expect to remedy that shortly. I do have an idea that I have yet to check out and that is I am wondering if the nVidia driver also normally supports the HDMI audio and therefore provides some sort of conflict with ALSA? I'm going to look through the rather comprehensive and helpful nVidia driver documentation to see if this is so and what switches might be applied. Perhaps you might wish to peruse those as well. In any case if I find something I'll write back but still depend on you since you can actually test it out. Good fortune.

cwizardone 06-27-2014 09:39 AM

Quote:

Originally Posted by enorbet (Post 5194909)
..I am wondering if the nVidia driver also normally supports the HDMI audio..

Yes, the nvidia drivers for Linux do support HDMI audio.
Unless someone has come up with a recent solution, setting up HDMI in Linux is not an easy task and not everything will work, e.g., some applications might be able to use HDMI and other may not.

dugan 06-27-2014 09:51 AM

Update.

I don't have it working yet, but these commands are all working and sending sound to the HDMI-connected TV:

Code:

aplay -D plughw:NVidia,3 /usr/share/sounds/alsa/Front_Center.wav
aplay -D plughw:NVidia,7 /usr/share/sounds/alsa/Front_Center.wav
aplay -D plughw:NVidia,8 /usr/share/sounds/alsa/Front_Center.wav
aplay -D plughw:NVidia,9 /usr/share/sounds/alsa/Front_Center.wav

I got them from here: http://ubuntuforums.org/showthread.php?t=1668737

Several guides have recommended setting a probe_mask option on the Intel driver. I haven't been able to investigate that yet, but here's what I get for grep valid /proc/asound/NVidia/eld*:

Code:

/proc/asound/NVidia/eld#0.1:eld_valid                1
Quote:

and not everything will work, e.g., some applications might be able to use HDMI and other may not.
The setup is of ALSA, so wouldn't it work with every application that outputs audio through ALSA?

NGIB 06-27-2014 09:55 AM

I've had some luck using Pulseaudio to control where the sound goes on my laptop with nvidia...

TobiSGD 06-27-2014 10:28 AM

Set up Alsa to use the HDMI output as default (info how to do that here).
Easier, but a sacrilege for some people: Just install Pulseaudio and let it route audio to whichever output you want, including changing the output on the fly.

ReaperX7 06-27-2014 01:19 PM

The best option is to just disable the onboard audio if possible. This will allow udev to detect only the HDMI processor and use the Intel HD Audio. It also helps if you have a PCI/PCIe audio card that uses a different chipset as well.

Yes, using PulseAudio is easier, but you should learn, at least, how to properly configure ALSA and dmix properly.

genss 06-27-2014 01:33 PM

.asoundrc in HOME
Code:

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

i think, and may be wrong, that this is direct routing
so if two sound sources have different sample/bit rate then only the first one will get through
expanding the config would sort that out, if it happens (i think its the ctl part, not sure)

PS flash may also not work
an udev rule to put nvidia interface as the first one (0) would fix that

edit: as per wiki that TobiSGD linked, this might work if the one above does not
Code:

defaults.pcm.card 1
defaults.pcm.device 3
defaults.ctl.card 1


dugan 06-27-2014 01:52 PM

Quote:

Originally Posted by ReaperX7 (Post 5195022)
The best option is to just disable the onboard audio if possible. This will allow udev to detect only the HDMI processor and use the Intel HD Audio.

I tried that approach. It didn't work, and I abandoned it before doing any analysis beyond "it didn't work."

NGIB 06-27-2014 01:56 PM

Quote:

Originally Posted by ReaperX7 (Post 5195022)
Yes, using PulseAudio is easier, but you should learn, at least, how to properly configure ALSA and dmix properly.

Some of us just want to use our computers rather than digging around and editing config files - which is why I mentioned that PulseAudio had worked for me...

Loomx 06-27-2014 02:46 PM

I have had the same issue; I found the first ~/.asoundrc file mentioned by genss in post #8 didn't work, but the second one did (with some tweaking):
Code:

defaults.pcm.card 0
defaults.pcm.device 3
defaults.ctl.card 0

I have it saved as ~/.asoundrc-hdmi so when I plug the hdmi cable in I just cp ~/.asoundrc-hdmi ~/.asoundrc

dugan 06-27-2014 02:51 PM

Quote:

Originally Posted by enorbet (Post 5194909)
I have essentially the same card but I don't have anything I can plug HDMI into to test audio but I am very curious as to how this thread turns out since I expect to remedy that shortly.

I won't be able to try out the recommendations until tonight (most likely tomorrow), but I do need to ask, enorbet: will your Slackware Box be an HTPC or a Steam Machine?

genss 06-27-2014 04:12 PM

Quote:

Originally Posted by Loomx (Post 5195063)
I found the first ~/.asoundrc file mentioned by genss in post #8 didn't work, but the second one did (with some tweaking):

device numbers are based off of aplay -l from the first post

card0 is whatever was initialized first on the system
every card has subdevices, like my card0 has "device 0: Multichannel [Multichannel]" and "device 1: Digital [Digital]"
udev, i think, is the one that initializes the cards but there is something about alsa configs (never digged deep enough)

dugan 06-27-2014 04:19 PM

NVidia (ftp://download.nvidia.com/XFree86/gp...dmi-audio.html) mentioned that chipsets are Card 0 and discrete cards are Card 1.

enorbet 06-27-2014 06:42 PM

Quote:

Originally Posted by dugan (Post 5195065)
I won't be able to try out the recommendations until tonight (most likely tomorrow), but I do need to ask, enorbet: will your Slackware Box be an HTPC or a Steam Machine?

I suppose the short answer is, as it is pretty much all the time, some mongrel :)

I'm using an old Olevia 27" HDTV for a monitor which, although it has an HDMI input, the docs say only the VGA input can be used for PC. It's a decent amount of screen real estate but it's resolution is no great shakes - limited to 1280 x 720. I am an avid gamer so I have many versions of Steam installed through PlayOnLinux but I also have Pipelight for streaming. I do have an interest in trying out the Steam OS after it gets dry behind the ears, but no rush on that as presently the only reason I have left to boot to Windows is for parts of audio recording/editing work. I do as much as I can with Ardour, and have since it first came out as Alpha software, but unfortunately some initial work still takes windows apps and plugins.


All times are GMT -5. The time now is 11:45 AM.