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 07-09-2014 11:05 PM

You know what? I give up. I got the one second of audio lag again today. There was nothing in my dmesg output as to why. At this point, I think I've exhausted all the options.

No worries; my new setup will be video over HDMI, audio from a Behringer UCA 202 USB sound card directly to speakers. It just makes it a bit more complicated if I want to hook other devices up to the TV.

EDIT: Hmm... the problem went away soon after I posted, suggesting that it's temporary. Still not something that I'm willing to deal with.

cwizardone 07-10-2014 01:35 AM

Quote:

Originally Posted by dugan (Post 5201480)
You know what? I give up...

Well, you took it a lot farther than I did. :)
A year or two ago I spent a good amount of time trying to get HDMI audio to work after reading the documentation from NVIDIA and elsewhere and finally threw in the towel. :scratch:
Kudos for all the effort you put into the project.
:hattip:

TobiSGD 07-10-2014 06:11 AM

Quote:

Originally Posted by dugan (Post 5201480)
At this point, I think I've exhausted all the options.

So, did you try it with Pulseaudio?

dugan 07-10-2014 11:15 AM

Quote:

Originally Posted by TobiSGD (Post 5201640)
So, did you try it with Pulseaudio?

No. Is it as simple as following the README on SlackBuilds.org, and then setting the following .asoundrc?

https://projects.archlinux.org/svnto...ulseaudio-alsa

TobiSGD 07-10-2014 11:30 AM

Should be. To be honest, I can't remember to even have a .soundrc on Slackware with Pulseaudio and I definitely don't have one now on Gentoo.

dugan 07-11-2014 01:57 AM

Got help from this thread. SOLVED] Proper pulseaudio setup for Slackware64-current They were:

Install alsa-plugins as well as pulseaudio

Add start-pulseaudio-x11 to ~/.config/openbox/autostart (because I'm using openbox)

Add to /etc/rc.d/rc.local:

Code:

if [ -x /etc/rc.d/rc.pulseaudio ]; then
        /etc/rc.d/rc.pulseaudio start
fi

Make /etc/rc.d/rc.pulseaudio executable and start it up

Add the following ~/.asoundrc

Code:

pcm.pulse {
    type pulse
}
ctl.pulse {
    type pulse
}
pcm.!default {
    type pulse
}
ctl.!default {
    type pulse
}

Pulseaudio is now working so transparently that I can't even tell if I'm outputting audio through Pulseaudio. I suppose that's a good problem to have. I'll post back if I get the lagging audio again, or if I manage to go for a week without it.

UPDATE: Hate to turn this into a Pulseaudio thread, but ugh... it turns out (ref) I need both a compat32 pulseaudio and a compat32 alsa-plugins to get audio in Wine now. I'll take care of that later.

UPDATE 2: Runner2 crashed immediately for what I strongly suspect is the same reason:

Code:

error 60: Error initializing output device.
FMOD error 31: FMOD was not initialized correctly to support this function.
Fatal error
Failed to load necessary sound data.  Game will exit. (437278 0x723acf08)

I'll try to take care of these tomorrow.

dugan 07-12-2014 12:00 AM

Tobi, were you able to get Bit Trip Runner2 working with Pulseaudio? I got this problem, and I can't fix it:

http://steamcommunity.com/app/218060...8810978055856/

Everything else I've tried (including other Steam games) works.

dugan 07-12-2014 12:29 AM

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. It also helps if you have a PCI/PCIe audio card that uses a different chipset as well.

Hey ReaperX7. The reason this doesn't work is because ALSA's default output device is card 0, device 0, or 0:0. The devices on my discrete NVidia card, as you saw from my aplay output, are 3, 7, 8 and 9, with 7 being the "valid" one (that's what my ELD info said, as mentioned upthread). If you have the motherboard's audio interface enabled, then the NVidia sound card is card 1, and its devices are 1:3, 1:7, 1:8 and 1:9. Disabling the motherboard sound card simply shifts the NVidia card's number to 0, giving you four audio devices: 0:3, 0:7, 0:8 and 0:9. None of these are 0:0, and you'll therefore get no audio output unless you do further tweaking.

You can then use the following .asoundrc to set device 0:7 as the default:

Code:

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

But then the audio will be going directly to the sound device and not through DMIX, so you'll only be able to play one sound at a time.

The simplest .asoundrc file that will send audio to dmix and then to 0:7 is:

Code:

pcm.ossmix {
    type dmix
    ipc_key 1024
    slave {
        pcm "hw:0,7"
    }
}
pcm.!default {
    type plug
    slave.pcm "ossmix"
}

I've found that that gives me stuttering audio in Warcraft 3, so I had to add the common period_size and buffer_size parameters. The bindings section is a common performance optimization (to only care about two channels):

Code:

pcm.ossmix {
    type dmix
    ipc_key 1024
    slave {
        pcm "hw:0,7"
        period_time 0
        period_time 1024
        buffer_size 8192
    }
    bindings {
        0 0
        1 1
    }
}
pcm.!default {
    type plug
    slave.pcm "ossmix"
}


dugan 07-12-2014 02:07 AM

UPDATE:

XRUN_DEBUG is turned on, of course.

OOOOOh, I got the audio lag again (with the above setup, no Pulseaudio), and this time I had stuff in my DMESG!

Code:

[ 2210.847854] ALSA: PCM: Lost interrupts? [Q] (stream=0, delta=422, new_hw_ptr=12276, old_hw_ptr=11854)
[ 2215.675804] snd_pcm_update_hw_ptr0: 276 callbacks suppressed

Later, I noticed that on a fresh boot, dmesg would contain the the recommendation I saw earlier for a larger bdl_pos_adj value.

If I started playing Google Play Music in Chromium, then my dmesg would be spammed with the above messages.

I was able to get the messages to disappear by adding the following to /etc/modprobe.d/snd-hda-intel.conf:

Code:

options snd-hda-intel enable_msi=1 bdl_pos_adj=64
(Notice that this is not the line I tried pasting in earlier from an Ubuntu ticket).

We'll see if this solves the delayed audio problem. I'm hopeful, because it gets rid of the "lost interrupt" warnings, and lost interrupts are obviously consistent with the symptoms.

TobiSGD 07-12-2014 10:43 AM

Quote:

Originally Posted by dugan (Post 5202654)
Tobi, were you able to get Bit Trip Runner2 working with Pulseaudio? I got this problem, and I can't fix it:

http://steamcommunity.com/app/218060...8810978055856/

Everything else I've tried (including other Steam games) works.

Sorry, I don't own that game. Pulseaudio works for my games and any other sound output without any problems.

enorbet 07-16-2014 11:32 AM

1 Attachment(s)
Quote:

Originally Posted by dugan (Post 5202661)
But then the audio will be going directly to the sound device and not through DMIX, so you'll only be able to play one sound at a time.

Hello Dugan. Hope you have been rewarded with at least some progress after all your hard work. The reason for quoting the above is that even though this may not help you on your present tack, I figure thorough and accurate data is important to a successful outcome to avoid blindly resorting to the time-wasting shotgun approach. So far it seems you have avoided such a fail. Maybe this might help keep that going.

I'm wondering where the idea above came from, or if it was ever true, what and when has it changed? I ask this because I've never worried about this issue, because as long as I can remember, it has never been an issue for me with Alsa. I don't even have pulseaudio installed but I have always been able to, for example, speak and hear on TeamSpeak 3 while at the same time hearing for example, Professor Putricide. declare "Hmmmm where did those come from?" in WOTLK. Upon a few occasions I have added XMMS2 or Aqualung, or even the typical flash players in browsers so that the raid can hear music while we hurl insults at Valanar.

I'm assuming this is what people mean by "multiple sound (sources) at the same time" and mine has always just worked. My system has 3 audio hardwares -

1] the HDMI built into my nVidia graphics card (though the audio portion of HDMI is blacklisted)

2] USB microphone section of Logitech webcam (though it still works just as well with a different Mic plugged into ======>>>>

3] Discrete semi-pro sound card ( ESI Juli@

I'm including the list in case alsa behaves differently with different hardware and notably mine has 4 discrete channels so has some onboard auto-mixing capability... however it is my understanding that essentially all sound cards have some level of internal mixing. I do use an .asoundrc but it is very basic and I can't see how it could be responsible for multi-source capability.

Hopefully this may help even if only something to check off and discard. Any other data I can provide to help if you want it, just say so. Linux is so uneven when it comes to audio in that some stuff is so advanced and/or solid and others are Rube Goldberg at best, so it's difficult to diagnose something as complex as full second delays. This can be more complicated by other Rube like devices like Flash in Browsers which is giving me fits since a Firefox "upgrade". So again, anything you need.....

genss 07-16-2014 11:55 AM

Quote:

Originally Posted by enorbet (Post 5204826)
I'm wondering where the idea above came from, or if it was ever true, what and when has it changed?

probably from me or teh internet, if i understand what the topic is

by direct i meant direct
alsa by default, without an .asoundrc, resamples everything to 48kHz
if you make it be direct it will fail when a request for a sample rate or bitrate is made that is different from the one currently being played
at least on my 2 cards (i remember older ones too)

example .asoundrc
Code:

pcm.!default{
type hw
card 0
}
ctl.!default{
type hw
card 0
}

to check what the card is currently doing:
watch cat /proc/asound/card0/pcm0p/sub0/hw_params
(for card0, subdevice 0)

notice that when playing a, for example, 96kHz track without an asoundrc, it will say 48kHz

dugan 07-16-2014 12:17 PM

Quote:

Originally Posted by enorbet (Post 5204826)
I'm wondering where the idea above came from, or if it was ever true, what and when has it changed?I do use an .asoundrc but it is very basic and I can't see how it could be responsible for multi-source capability.

May I see your .asoundrc file, please?

I can confirm that if I use an .asoundrc file to send audio to my NVidia card (which, and this is significant, is not card 0, device 0) and I do not specify that it goes through DMix, then running two MPlayer instances at the same time will result in the second one erroring out with "sound device busy."

TobiSGD 07-16-2014 01:18 PM

Quote:

Originally Posted by enorbet (Post 5204826)
3] Discrete semi-pro sound card ( ESI Juli@

I'm including the list in case alsa behaves differently with different hardware and notably mine has 4 discrete channels so has some onboard auto-mixing capability...

That is exactly why it works for you, dmix is not needed for audio-cards that have mixing capabilities in the hardware.
Quote:

however it is my understanding that essentially all sound cards have some level of internal mixing.
Many cards, especially cheap and onboard audio-cards, only have software mixing capabilities, read: Alsa has to do the mixing, hence dmix must be used.

genss 07-16-2014 03:38 PM

problem is in the resampling part of mixing
mixing two inputs that have the same format is just add-ing them together with saturation

funny, i tried now playing two songs with the same format and got a "device busy"
i distinctly remember it working on my previous card (and that was a crap one)
interesting

anyway
i agree, proper hw mixing is rarely found in non-professional hardware
envy based cards being the only exception i found so far (ICE series has been continued as envy, they renamed after VIA bought them)


All times are GMT -5. The time now is 02:02 PM.