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


- bitlisz - 2010-01-06

Finally i get some TrueHD resources.
TrueHD 7.1 playback was fine, but I find that in TrueHD 5.1, 48/24
4 channels are mixed (I can hear only):
2 - Rear Left <-> 4 - Center
3 - Rear Right <-> 5 - LFE

(I have)
But during these speaker test are ok, good mapped:
speaker-test -Dhdmi -c6 -r48000 -FS32_LE
speaker-test -Dhdmi -c6 -r96000 -FS32_LE
speaker-test -Dhdmi -c6 -r192000 -FS32_LE
speaker-test -Dhdmi -c8 -r48000 -FS32_LE
speaker-test -Dhdmi -c8 -r96000 -FS32_LE
speaker-test -Dhdmi -c8 -r192000 -FS32_LE
(on -FS32_LE with high freq i get sometimes "Write error: -32...")

How can i fix this?

______________________
Also i noticed that when i start movie the there is an error with audio device init,
I have to switch to some another audio, like ac3, and back, then its ok.

UPDATE: If i switched off navigation sound than this error not occured...


- pbjr - 2010-01-07

bitlisz Wrote:Finally i get some TrueHD resources.
TrueHD 7.1 playback was fine, but I find that in TrueHD 5.1, 48/24
4 channels are mixed (I can hear only):
2 - Rear Left <-> 4 - Center
3 - Rear Right <-> 5 - LFE

(I have)
But during these speaker test are ok, good mapped:
speaker-test -Dhdmi -c6 -r48000 -FS32_LE
speaker-test -Dhdmi -c6 -r96000 -FS32_LE
speaker-test -Dhdmi -c6 -r192000 -FS32_LE
speaker-test -Dhdmi -c8 -r48000 -FS32_LE
speaker-test -Dhdmi -c8 -r96000 -FS32_LE
speaker-test -Dhdmi -c8 -r192000 -FS32_LE
(on -FS32_LE with high freq i get sometimes "Write error: -32...")

How can i fix this?

______________________
Also i noticed that when i start movie the there is an error with audio device init,
I have to switch to some another audio, like ac3, and back, then its ok.

UPDATE: If i switched off navigation sound than this error not occured...

Hi,

Same issue as well with 7.1 audio. I was able to modify the /etc/asound.conf file to fix it for 7.1, but once you do that it screws up 5.1 sources.

I have since given up on Linux for my BD MKV's. A recent update to MakeMKV now allows saving the HD Audio. I have since pre-ordered a HDi BD Dune 3.0. I'll be able to bitstream HD Audio to my receiver (no need to convert to flac) and also be able to play BD ISO's and Folders with full menus as well. Still love my XBMC. I think nvidia and alsa will fix the audio issues. I really hope for the day we can bitstream HD on Linux (getting jealous of those ATI windows guys).

PBjr.


- bitlisz - 2010-01-07

pbjr Wrote:Hi,

Same issue as well with 7.1 audio. I was able to modify the /etc/asound.conf file to fix it for 7.1, but once you do that it screws up 5.1 sources.

I have since given up on Linux for my BD MKV's. A recent update to MakeMKV now allows saving the HD Audio. I have since pre-ordered a HDi BD Dune 3.0. I'll be able to bitstream HD Audio to my receiver (no need to convert to flac) and also be able to play BD ISO's and Folders with full menus as well. Still love my XBMC. I think nvidia and alsa will fix the audio issues. I really hope for the day we can bitstream HD on Linux (getting jealous of those ATI windows guys).

PBjr.

This HDMI on ION just started a while ago and it seems They are really working on the fixes:
The "whole" story"

This is about the channel map issue
So this issue can be solved temporary if I make another remap?
Strange thing if I play 5.1 flac/wav/wma/ogg... the channel map correct...problem only with ddtruehd 5.1...but have to test again.
UPDATE:
It seems i have similar same problem like this, so maybe xbmc related:
Ticket #7196 (new Bugs) - AAC 5.1 Audio sent to wrong channels

So the leftover only DTS-HD...at least these are always contains the full rate DTS core.


- peterkant - 2010-01-07

bitlisz Wrote:please test with 7.1 linear pcm audio:
speaker-test -D hw:0,3 -t wave -c 8 -f cd
or
speaker-test -Dhdmi -c6 -r192000 -FS32_LE

I will try tonight, but in the meantime I've done a fresh install with the final build (Live), while keeping my home directory so that I don't need reenter my settings and re-scan the whole library (> 500 movies, > 1000 episodes).

Interesting to mention, everything worked right out of the box. And I mean EVERYTHING. Lirc, 5.1 over HDMI, SMB, etc. All those lousy little things that in the past took me a day or two to make it work after an install. So, there seems to be no need to use alanwww1's method anymore, at least with the Live install to the HDD, on an acer revo 1600. My kudos to the XBMC team, it looks like the stable build is... well, stable! great job.

Nvidia drivers version this time are 190.53

I don't have a 7.1 sound install but I'll try with the speaker test and see if my receiver displays the proper input (7.1)


- myrison - 2010-01-07

peterkant Wrote:Interesting to mention, everything worked right out of the box. And I mean EVERYTHING. Lirc, 5.1 over HDMI, SMB, etc. All those lousy little things that in the past took me a day or two to make it work after an install.

Go buy a lottery ticket today. Big Grin


- pbjr - 2010-01-07

bitlisz Wrote:This HDMI on ION just started a while ago and it seems They are really working on the fixes:
The "whole" story"

This is about the channel map issue
So this issue can be solved temporary if I make another remap?
Strange thing if I play 5.1 flac/wav/wma/ogg... the channel map correct...problem only with ddtruehd 5.1...but have to test again.
UPDATE:
It seems i have similar same problem like this, so maybe xbmc related:
Ticket #7196 (new Bugs) - AAC 5.1 Audio sent to wrong channels

So the leftover only DTS-HD...at least these are always contains the full rate DTS core.

Thanks for the background links. I'll check back on them for updates.


- bitlisz - 2010-01-08

I tested again samples and found these:

- DDTrueHD 5.1 channels mixed: check this sample (I will reupload if deleted)
4 channels are mixed:
2 - Rear Left <-> 4 - Center
3 - Rear Right <-> 5 - LFE
I think this is related to XBMC, have to test with MPlayer too.

- apple hd movie with 6ch AAC channels are mixed in the same way
to check you can download from their sites 1080p trailers (like "Avatar" or "Where the Wild Things are") but check with mediainfo for: AAC, 6 channels, 48.0 KHz

- All video with Dolby Digital Plus played with a lot of skips, hdmi reinits

- no sound with hd-mov video from Panasonic camera: PCM at 256 Kbps, 1 channel, 16.0 KHz

- xbmc freezed when playing any dts audio cd from wav (44,1kHz DTS)
have to test with dts cd *.dts file and dts audio cd disc

Good news it seems wma/flac/wav/ogg 5.1 works fine.
DDTrueHD 7.1, also DD (any AC3), DTS / DTS96/24.


- myrison - 2010-01-08

myrison Wrote:Guys -

I posted a few weeks back thanking Alan for this guide and I just as well do it again as I'm still running well on 99% of my files. Thanks Alan. Big Grin

The one exception is related to flv files, which are almost entirely trailers downloaded for movies. I get no audio from these files. This happens whether I play them with VLC, XBMC, etc.

Here is a snippet of my XBMC debug log that indicates issues with PulseAudio... Given that I'm supposed to be using Alsa, I'm not sure if this is meaningful, but it's the only possible clue I can find in my logs.

The audio encoded in this file is mp3, and mp3s work fine if played by themselves, so I think it's related to the flv extension, not to the audio format... though I could be wrong. Smile

Has anyone else run into this or do you have any clues on getting sound from flv files to work? I've marked a few lines below in red that I believe are relevant...

So as it turns out, this was related to audio with a lower sample rate than my receiver could support.

Code:
Format                           : MPEG Audio
Format version                   : Version 2
Format profile                   : Layer 3
Duration                         : 30s 615ms
Bit rate mode                    : Constant
Bit rate                         : 48.0 Kbps
Channel(s)                       : 1 channel
[color=red][b]Sampling rate                    : 22.05 KHz
[/b][/color]

I experimented with changing "hdmi" to "plughw:hdmi" in xbmc but found that with plughw:hdmi I could get this audio to play correctly, but it broke support for multi-channel uncompressed PCM and TrueHD. I don't understand the configuration well enough to know why this happens, but I ultimate gave up and decided I'd much rather have the ability to play TrueHD & LPCM than mono audio from youtube videos (mainly movie trailers in this case).

For the trailers I really want, I'm just going to resample the audio and keep the files as trying to fix this problem in Linux has proven well beyond my skills! If on the off chance someone else has addressed this in a more effective way, please chime in.


Channel mapping. - Den4t - 2010-01-09

Hi !

As many users i have problems with channel mappings, after some experiments i
found solution for me, bun not test it actively.
First, adding some code to ALSADirectSound.cpp, for right mapping 8 chan. flac & pcm:
else if (strstr(strAudioCodec, "DMO") || strstr(strAudioCodec, "FLAC") || strstr(strAudioCodec, "PCM"))
{
if(iChannels == 6)
deviceuse = "xbmc_win51:'" + EscapeDevice(deviceuse) + "'";
else if(iChannels == 5)
deviceuse = "xbmc_win50:'" + EscapeDevice(deviceuse) + "'";

>>this 2 lines added - new mapping in xbmc asound.conf
>> else if(iChannels == 8)
>> deviceuse = "xbmc_win71:'" + EscapeDevice(deviceuse) + "'";

}

this mapping in xbmc asound.conf file:
pcm.xbmc_win71 {
@args.0 SLAVE
@args.SLAVE {
type string
default "default"
}
type route
slave {
pcm $SLAVE
channels 8
}
ttable {
0.0= 1
1.1= 1
2.4= 1
3.5= 1
4.2= 1
5.3= 1
6.6= 1
7.7= 1
}
}

For right 5.1 AAC mapping i use this one, instead of original:
pcm.xbmc_aac51 {
@args.0 SLAVE
@args.SLAVE {
type string
default "default"
}
type route
slave {
pcm $SLAVE
channels 6
}
ttable {
0.0= 1
1.1= 1
2.4= 1
3.5= 1
4.2= 1
5.3= 1
}
}

and of course, i use alsa patch and system alsa mapping from this thread,
thanks Alan !


- myrison - 2010-01-09

Den4t Wrote:Hi !

As many users i have problems with channel mappings, after some experiments i
found solution for me, bun not test it actively.
First, adding some code to ALSADirectSound.cpp, for right mapping 8 chan. flac & pcm:
else if (strstr(strAudioCodec, "DMO") || strstr(strAudioCodec, "FLAC") || strstr(strAudioCodec, "PCM"))
{
if(iChannels == 6)
deviceuse = "xbmc_win51:'" + EscapeDevice(deviceuse) + "'";
else if(iChannels == 5)
deviceuse = "xbmc_win50:'" + EscapeDevice(deviceuse) + "'";

>>this 2 lines added - new mapping in xbmc asound.conf
>> else if(iChannels == 8)
>> deviceuse = "xbmc_win71:'" + EscapeDevice(deviceuse) + "'";

}

this mapping in xbmc asound.conf file:
pcm.xbmc_win71 {
@args.0 SLAVE
@args.SLAVE {
type string
default "default"
}
type route
slave {
pcm $SLAVE
channels 8
}
ttable {
0.0= 1
1.1= 1
2.4= 1
3.5= 1
4.2= 1
5.3= 1
6.6= 1
7.7= 1
}
}

For right 5.1 AAC mapping i use this one, instead of original:
pcm.xbmc_aac51 {
@args.0 SLAVE
@args.SLAVE {
type string
default "default"
}
type route
slave {
pcm $SLAVE
channels 6
}
ttable {
0.0= 1
1.1= 1
2.4= 1
3.5= 1
4.2= 1
5.3= 1
}
}

and of course, i use alsa patch and system alsa mapping from this thread,
thanks Alan !

Thanks for posting. What is your setup on which you found this change necessary? (i.e. Linux version, hardware, Nvidia driver, etc.)

Thanks.


- Den4t - 2010-01-09

myrison Wrote:Thanks for posting. What is your setup on which you found this change necessary? (i.e. Linux version, hardware, Nvidia driver, etc.)

Thanks.

HTPC
MB: ASUS P5N7A-VM
Linux: FC11
NVIDIA Driver: 185.18.36
XBMC 9.11: Camelot
Alsa:
Advanced Linux Sound Architecture Driver Version 1.0.21.
Compiled on Dec 21 2009 for kernel 2.6.29.6-213.fc11.i686.PAE (SMP).
+
Pioneer-1018AHK via HDMI
+
TV Philips 42pfl9703 via HDMI


- myrison - 2010-01-09

Interesting, I run an Acer Aspire Revo on Ubuntu Jaunty with the 185.xx Nvidia drivers and didn't have to remap anything after running Alan's scripts. Glad you got it working though.


- bitlisz - 2010-01-10

Den4t Wrote:Hi !

As many users i have problems with channel mappings, after some experiments i
found solution for me, bun not test it actively.
First, adding some code to ALSADirectSound.cpp, for right mapping 8 chan. flac & pcm:
else if (strstr(strAudioCodec, "DMO") || strstr(strAudioCodec, "FLAC") || strstr(strAudioCodec, "PCM"))
{
if(iChannels == 6)
deviceuse = "xbmc_win51:'" + EscapeDevice(deviceuse) + "'";
else if(iChannels == 5)
deviceuse = "xbmc_win50:'" + EscapeDevice(deviceuse) + "'";

>>this 2 lines added - new mapping in xbmc asound.conf
>> else if(iChannels == 8)
>> deviceuse = "xbmc_win71:'" + EscapeDevice(deviceuse) + "'";

}

this mapping in xbmc asound.conf file:
pcm.xbmc_win71 {
@args.0 SLAVE
@args.SLAVE {
type string
default "default"
}
type route
slave {
pcm $SLAVE
channels 8
}
ttable {
0.0= 1
1.1= 1
2.4= 1
3.5= 1
4.2= 1
5.3= 1
6.6= 1
7.7= 1
}
}

For right 5.1 AAC mapping i use this one, instead of original:
pcm.xbmc_aac51 {
@args.0 SLAVE
@args.SLAVE {
type string
default "default"
}
type route
slave {
pcm $SLAVE
channels 6
}
ttable {
0.0= 1
1.1= 1
2.4= 1
3.5= 1
4.2= 1
5.3= 1
}
}

and of course, i use alsa patch and system alsa mapping from this thread,
thanks Alan !

I have tried your solution, but not work fine.
Im pretty sure that not correct the channel mapping with truehd5.1 (maybe only with AAC, but i dont think so, maybe some channel still mixed)
Check this sample: DDTrueHD 5.1 (I will reupload if deleted)

Im first time ever compiled anything, but the build was successful (10.5, build 26613). The biggest problem was with the VDPAU support (very high cpu usage, im using v185 nv driver), just does not work with my build.

I get from here another build, and with this one the VDPAU worked, but started only first time with empty user folder, after I configured, "started" many times with segfault...not so stable...so i get rollback.

So we need better solution...maybe have to wait until the channel mapping corrected in XBMC and new nVidia driver which does not breaks MultiChannel output (only v185 works for me).

At least I upgraded to Alsa 1.0.22.1-2, and kernel 2.6.31-17-generic.


- Den4t - 2010-01-10

bitlisz Wrote:I have tried your solution, but not work fine.
Im pretty sure that not correct the channel mapping with truehd5.1 (maybe only with AAC, but i dont think so, maybe some channel still mixed)
Check this sample: DDTrueHD 5.1 (I will reupload if deleted)

Hi !
Can't download the sample for now, rapidshare overloaded, will try tomorrow.
One question - is this audio only or have a video track ?
If this audio only, i think, xbmc use PAPlayer by default, can you play
the sample with DVDPlayer ? PAPlayer use another mapping scheme, i think.
With DVDPlayer you will see in xbmc.log:
DEBUG: Initialize - using alsa device xbmc_win71:'plug:hdmi'


- alanwww1 - 2010-01-11

Thanks guys for the great feedback.

I was on Holiday, but now back. As soon as i get my work in shape i put together a new guide with updated new Ubuntu, Alsa, XBMC, Nvidia driver.

Also i am interested in checking out Intel's new platforms with Proper channel detection a and mapping with OPEN SOURCE drivers. These platforms with Broadcom's Crystal HD chip for video decode, could be a great alternative of Nvidia ION.