Kodi Community Forum
[LINUX] HOW-TO get multi-channel HD sound output working over NVIDIA HDMI - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: General Support (https://forum.kodi.tv/forumdisplay.php?fid=111)
+---- Forum: Linux (https://forum.kodi.tv/forumdisplay.php?fid=52)
+---- Thread: [LINUX] HOW-TO get multi-channel HD sound output working over NVIDIA HDMI (/showthread.php?tid=59877)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30


- Kali - 2010-02-04

nvidia 195.36.03 is out (probably fix LPCM issue)


- myrison - 2010-02-04

Can you please remind me what was the LPCM issue that needed fixing? I'm still on 185.xx, so maybe I haven't had this issue.

However, I've been considering an upgrade if it would fix what appear to be incorrectly mapped FLAC channels when playing 7.1. I have only tested 1-2 7.1 files and I'm not sure if the mismapped channels were an XBMC/Linux problem or the fault of the test files.

I'll be using Alan's recently posted 7.1 files to do more testing to confirm where the problem lies. Alan, thanks for posting those.

Thanks.


- Kali - 2010-02-04

fix 190/195 LPCM Multi Channel bug, 185 didn't have this bug


- myrison - 2010-02-05

Thanks for confirming Kali.

So here is my situation, I'm running Alsa 1.0.21 with Alan's patch/upgrades applied. I have both the XBMC 9.11 stable version as well as a separate SVN version that I run (via xbmc-standalone on Ubuntu) to test newer builds. The last one I compiled (and currently use) was 27275, which supposedly includes those channel remapping changes.

For any 5.1 material (unless I've missed some), channel mapping remains fine. TrueHD, DTS, etc.

However, my channel maps for 7.1 are universally wrong. I've read the last few pages to try and figure out what I might need to do to get this mapping corrected but I'm not sure where to start. Would someone please point me in the right direction or tell me if you need more info to answer?

Encom posted something a few posts back about his recommended changes, but before I start mucking around with all of the files mentioned there, I wanted to ask if this is what should get 7.1 channel FLAC working correctly? (for example, TrueHD wasn't broken for me to start with, so I'm not sure that this fix would apply)

Do I need to upgrade my Alsa first for those recommended changes to work or will it work on 1.0.21 with Alan's patches as well?

Thanks for the help.


- BoyBastos - 2010-02-05

Alan,

Thank you for this guide.


- paoleary - 2010-02-06

Alan,

In post #30 of this thread, you give a partial solution to the lack of support for nVidia G210 and related cards audio-over-HDMI.

I've got a working ALSA patch for HDMI audio tested on an up-to-date Mythbuntu 9.10 system, to be used in conjunction with moep's sound.conf. It's a modified subset of the HD_AUDIO-9.10 package that's made the rounds.

If you can already see your device with `aplay -l', but can't get audio out to it, try moep's sound.conf first. The patches I made are more invasive than I'd like.

Hopefully this will help someone out.


- carlsberg - 2010-02-06

isnt there an easy way for this .. im kinda a noob in lunix :S
I mean like an ready to run patch ?


- paoleary - 2010-02-06

carlsberg Wrote:isnt there an easy way for this .. im kinda a noob in lunix :S
I mean like an ready to run patch ?

If you're talking to me--since Alan's guide is easy to follow--then the answer is no, I'm not going to make it easier right now. My goals are to (1) get my stuff working, and (2) eventually get enough information to Takashi Iwai so this can be fixed in an ALSA release. That'll help a lot more people. However, by getting some info out there for the adventurous, maybe we can cover all of the missing nVidia cards with HDMI audio. Meanwhile, if Alan wants to use the info, since he was the first one I know of to identify what needed to be changed, and simplify the process himself, he's more than welcome to.


Question :) - BoyBastos - 2010-02-07

alanwww1 Wrote:PART 3: SETTING UP THE SYSTEM THE PULSEAUDIO WAY


Now we load some custom pulseaudio config files to define hw:0,3 (your hdmi device) as the default hw sink. Here we also define the channel numbers and channel order. We can do it with the default.pa file.
Code:
wget http://pastebin.com/pastebin.php?dl=f14a2664c -O ~/.pulse/default.pa
dos2unix ~/.pulse/default.pa

You can tunde your setup changing this line in ~/.pulse/default.pa file
Code:
load-module module-alsa-sink device=hw:0,3 channels=6 channel_map=front-left,front-right,front-center,lfe,rear-left,rear-right

Now we set the default rate to 176400hz (It is a multiple of 44100 CD standard), 32bits, 6 channels, we set it in the daemon.conf file.
Code:
wget http://pastebin.com/pastebin.php?dl=f34e8526f -O ~/.pulse/daemon.conf
dos2unix ~/.pulse/daemon.conf

You can tune your setup by changing these lines in ~/.pulse/deemon.conf file.
Code:
default-sample-format = s32le
default-sample-rate = 176400
default-sample-channels = 6
; resample-method = src-sinc-medium-quality
With the last line uncommented you can set a higher quality default resampler. After that pulseaudio will start using a little bit more cpu for software mixing.
The available sampler options are (by man pulse-daemon.conf)
Code:
src-sinc-best-quality,  src-sinc-medium-quality,  src-sinc-fastest,  src-zero-order-hold,  src-linear, trivial, speex-float-N, speex-fixed-N, ffmpeg

Make a reboot with sudo reboot.

Now we set up Gnome to use pulseaudio. Do it like this:

Image


XBMC SETUP PULSEAUDIO WAY

Setting up xbmc for pulseaudio is pretty easy. We turn off crossfading for now, because there is a slight stuttering in sound while crossfading. If anyone can help what is the cause we could reenable this feature.
Image Image

Note that with pulseaudio we loose passthrough as it is not supported yet by pulseaudio. But as we have multichannel lpcm sound we can just decode the streams and pass it in lpcm format to the receiver.

We can do a little testing if xbmc really uses pulseaudio nativly or not. Install pulse audio volume control utility.
Code:
sudo apt-get install pavucontrol
Run the program from main menu and open xbmc minimalized (press alt+q after start)
Note that while it is playing GUI sounds it is using the Alsa-plugin module.
Image
Notice that i have also run a totem session which was also playing music. Software mixing works great.

If you start playing a music tracks with xbmc it should appear like this.
Image
This means xbmc nativly using pulseaudio not through an alsa plugin rerouted to pulse.

This utility is great because you can also tune channel volume levels with it:
Image

That's it we are done. I have to tell that sometimes specially when a new stream starts i can hear a very slight stuttering in sound. This settles as thestream continues. I'd very much appriciate if someone could help me to solve this little glitch in it.

REVERT CHANGES FROM PULSEAUDIO WAY
If you would like to revert back what we've don just do it as follows.

Code:
rm ~/.pulse/default.pa ~/.pulse/daemon.conf /etc/asound.conf


sorry am new to ubuntu and would like to know How do i do this edit?

You can tunde your setup changing this line in ~/.pulse/default.pa file
Code:
load-module module-alsa-sink device=hw:0,3 channels=6 channel_map=front-left,front-right,front-center,lfe,rear-left,rear-right

and this,

You can tune your setup by changing these lines in ~/.pulse/deemon.conf file.
Code:
default-sample-format = s32le
default-sample-rate = 176400
default-sample-channels = 6
; resample-method = src-sinc-medium-quality
With the last line uncommented you can set a higher quality default resampler. After that pulseaudio will start using a little bit more cpu for software mixing.
The available sampler options are (by man pulse-daemon.conf)
Code:
src-sinc-best-quality,  src-sinc-medium-quality,  src-sinc-fastest,  src-zero-order-hold,  src-linear, trivial, speex-float-N, speex-fixed-N, ffmpeg


ill just type it in? in terminal? thanks


- Shank - 2010-02-07

First thanks for this guide.

I seem to have one issue.

Running testfiles (.mkv) mapping of channels seem messed up.

6 channel DTS works fine. All speakers ok.

6 channel AAC no sound in center channel

6 channel AC3 no sound in center channel

Any Pointers what could be wrong?


- carlsberg - 2010-02-07

Should this also work with xbmclive installed to HD ?
Been trying it but it dont seem to work , i used the Alsa way .
And i have a Nvidia ion mini pc .


- coalfield - 2010-02-07

[quote=carlsberg]Should this also work with xbmclive installed to HD ?
Been trying it but it dont seem to work , i used the Alsa way .
And i have a Nvidia ion mini pc .[/QUOTE

I tried it on 9.11 Live and its killed my machine Sad oh dear... reinstall time Rolleyes

ERROR is:

'XBMC needs hardwareb accelerated OpenGL rendering. Install an appropriate graphics driver...'


- gribbler - 2010-02-07

coalfield Wrote:[quote=carlsberg]Should this also work with xbmclive installed to HD ?
Been trying it but it dont seem to work , i used the Alsa way .
And i have a Nvidia ion mini pc .[/QUOTE

I tried it on 9.11 Live and its killed my machine Sad oh dear... reinstall time Rolleyes

ERROR is:

'XBMC needs hardwareb accelerated OpenGL rendering. Install an appropriate graphics driver...'


Did you install the nvidia driver?


- Shank - 2010-02-08

Shank Wrote:First thanks for this guide.

I seem to have one issue.

Running testfiles (.mkv) mapping of channels seem messed up.

6 channel DTS works fine. All speakers ok.

6 channel AAC no sound in center channel

6 channel AC3 no sound in center channel

Any Pointers what could be wrong?

I suppose this issue is related to the issue with Nvidia Drivers 190/195? Could anyone provide the necessary steps to downgrade to Nvidia 185.XX?


My recipe for HDMI output on ION - W_v_W - 2010-02-08

HW: AT3N7A-I from ASUS
OS: FC12

First steps done from KDE to make life easier. Standalone mode described later.

1. Get rid of nouveau driver and install nVIDIA driver. (BTW, I've used 190.53 and it is OK) This procedure described at other topics and out of scope here. Just get X working using native driver. It seems that only native driver initialize HW right way to make sound work.

2 No tricks with ALSA and PULSE config files needed. All works from the box. You need just turn on correct output. (You can hear sound from analog, correct ?). Use, for example, pavucontrol utility and select required profile. Use "alsamixer -c0" and unmute all channels (mine called "S/PDIF 1"). Set desired volume. Use alsamixer without options and set desired volume too. You should hear sound over HDMI at this point.

3. Make changes permanent and system wide: a) save ALSA state by "alsactl store". b) make HDMI profile selected at boot time:
Code:
# echo "set-card-profile 0 output:hdmi-stereo" >> /etc/pulse/default.pa
. Your card may use other names for profile, or you'll prefer surround profile. You should check profile names using "pulseaudio -C" in interactive way.

From this point, I've configured KDM for autologin using XBMC standalone session. A "XBMC-standalone" script seems to be outdated and does not start pulseaudio, I've modifyed it this way:
Code:
#!/bin/sh
if which pulse-session; then
  pulse-session xbmc --standalone "$@"
else
        pulseaudio -D --start
  xbmc --standalone "$@"
fi

Hope, this will help for somebody. Look for full story :http://voleg.homelinux.org/HTPC/ (still in work).