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

+- XBMC Community Forum (http://forum.xbmc.org)
+-- Forum: Announcements, Info, and General Discussion (/forumdisplay.php?fid=85)
+--- Forum: Tips, tricks, and step by step guides (/forumdisplay.php?fid=110)
+--- 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 31 32 33 34 35 36 37 38 39 40 41 42 43 44


- Den4t - 2010-01-09 17:29

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 18:20

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 20:08

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 23: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 02:29

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.


- bitlisz - 2010-01-11 02:32

Den4t Wrote: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'
This is with video, just a sample 5.1 truehd speakertest from demo bluray disc.


7.1 Flac Test File - pbjr - 2010-01-11 12:38

While googling, I found this 7.1 test file if it can help.

www.megaupload.com/?d=E5X4E34S

It came from this post here discussing 8 channel flac support.
http://www.hydrogenaudio.org/forums/lofiversion/index.php/t77207.html


- andyblac - 2010-01-11 13:17

alanwww1 Wrote: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.

great cant wait, i'm still getting problems with my ASROCK & Onkyo 875, i only get stereo on it, also the ION is ALOT more powerfull the the BC Crystal HD chip.


- bitlisz - 2010-01-11 14:24

pbjr Wrote:While googling, I found this 7.1 test file if it can help.

www.megaupload.com/?d=E5X4E34S

It came from this post here discussing 8 channel flac support.
http://www.hydrogenaudio.org/forums/lofiversion/index.php/t77207.html

But as I said no problem with any 7.1...
The problem only with:
Dolby Digital TrueHD 5.1 and AAC5.1 (swaping channels)
DTS from wav
Dolby Digital Plus (audio dropouts/lots of hdmi reconnects)

Anyway here are more free files to test:
http://www.2l.no/hires/index.html


- Den4t - 2010-01-11 19:05

bitlisz Wrote:But as I said no problem with any 7.1...
The problem only with:
Dolby Digital TrueHD 5.1 and AAC5.1 (swaping channels)
DTS from wav
Dolby Digital Plus (audio dropouts/lots of hdmi reconnects)
[/url]

OK, i got both samples, DDTrueHD51.m2ts and 8_Channel_ID.flac
So, what a have in system and in xbmc.

1.
speaker-test -Dhdmi -c6 -r192000 -FS32_LE

speaker-test 1.0.22

Playback device is hdmi
Stream parameters are 192000Hz, S32_LE, 6 channels
Using 16 octaves of pink noise
Rate set to 192000Hz (requested 192000Hz)
Buffer size range from 32 to 2720
Period size range from 16 to 1360
Using max buffer size 2720
Periods = 4
was set period_size = 544
was set buffer_size = 2720
0 - Front Left
4 - Center
1 - Front Right
3 - Rear Right
2 - Rear Left
5 - LFE
channel mapping right receiver show 6ch PCM

2.
speaker-test -Dhdmi -c8 -r192000 -FS32_LE

speaker-test 1.0.22

Playback device is hdmi
Stream parameters are 192000Hz, S32_LE, 8 channels
Using 16 octaves of pink noise
Rate set to 192000Hz (requested 192000Hz)
Buffer size range from 8 to 2048
Period size range from 4 to 1024
Using max buffer size 2048
Periods = 4
was set period_size = 512
was set buffer_size = 2048
0 - Front Left
4 - Center
1 - Front Right
7 - Side Right
3 - Rear Right
2 - Rear Left
6 - Side Left
5 - LFE
channel mapping right receiver show 8ch PCM

So, system alsa mapping seems to be correct.

Now try to play samples, first - DDTrueHD51.m2ts
xbmc.log:
19:14:29 T:3086329824 M:3431227392 DEBUG: GetMusicVideoId (/storage/tmp/samples/11/DDTrueHD51.m2ts)
, query = select idMVideo from musicvideo where idFile=1167
19:14:29 T:2916088688 M:3431227392 DEBUG: CDVDPlayerAudio - CDVDMsg::GENERAL_RESYNC(33344.000000, 1
)
19:14:29 T:2916088688 M:3431227392 NOTICE: Creating audio device with codec id: 86064, channels: 6,
sample rate: 48000, no pass-through
19:14:29 T:2916088688 M:3431227392 DEBUG: CALSADirectSound::CALSADirectSound - Channels: 6 - Sample
Rate: 48000 - SampleBit: 16 - Resample false - Codec PCM - IsMusic false - IsPassthrough false - audi
oDevice: plug:hdmi
19:14:29 T:2916088688 M:3431227392 DEBUG: RemoveActiveDevice - Removing device 1
19:14:29 T:2916088688 M:3431227392 DEBUG: SetActiveDevice - SetActiveDevice from 0 to 2
19:14:29 T:2916088688 M:3431227392 DEBUG: RemoveActiveDevice - Removing device 0
19:14:29 T:2939661168 M:3431227392 DEBUG: CDVDPlayerVideo - CDVDMsg::GENERAL_SYNCHRONIZE
19:14:29 T:2939661168 M:3431227392 DEBUG: CDVDPlayerVideo - CDVDMsg::GENERAL_RESYNC(0.000000, 0)
19:14:29 T:2916088688 M:3431227392 DEBUG: Initialize - using alsa device xbmc_win51:'plug:hdmi'
On receiver - 6ch PCM, channel mapping right !
Last line from log shows xbmc_win51 mapping, which i do not touch at all,
so, this work correctly without my patch.

Now flac (play with DVDPlayer):
19:15:57 T:3086329824 M:3430141952 DEBUG: CGUIInfoManager::SetCurrentSong(/storage/tmp/samples/11/8
_Channel_ID.flac)
19:15:57 T:3086329824 M:3430141952 DEBUG: LoadMusicTag: loading tag information for file: /storage/
tmp/samples/11/8_Channel_ID.flac
19:15:57 T:2968849264 M:3430141952 NOTICE: running thread: CDVDPlayerAudio::Process()
19:15:57 T:2968849264 M:3430141952 NOTICE: Creating audio device with codec id: 86031, channels: 8,
sample rate: 48000, no pass-through
19:15:57 T:2968849264 M:3430141952 DEBUG: CALSADirectSound::CALSADirectSound - Channels: 8 - Sample
Rate: 48000 - SampleBit: 16 - Resample false - Codec PCM - IsMusic false - IsPassthrough false - audi
oDevice: plug:hdmi
19:15:57 T:2968849264 M:3430141952 DEBUG: RemoveActiveDevice - Removing device 1
19:15:57 T:2968849264 M:3430141952 DEBUG: SetActiveDevice - SetActiveDevice from 0 to 2
19:15:57 T:2968849264 M:3430141952 DEBUG: RemoveActiveDevice - Removing device 0
19:15:57 T:3086329824 M:3430141952 DEBUG: Loading additional tag info for file /storage/tmp/samples
/11/8_Channel_ID.flac
19:15:57 T:2968849264 M:3430141952 DEBUG: Initialize - using alsa device xbmc_win71:'plug:hdmi'

receiver show 8ch PCM, channel mapping right.
From last line we see xbmc_win71 mapping which is my Smile


Try please speaker-test as above, to check correct system channel mapping.

And now AAC, i have only one such movie. First i have convert audio track
from AAC to AC3 with mplayer and use pass-through when play in xbmc
to check that channel mapping in original movie is correct, then play original AAC:

19:53:08 T:2895108976 M:3426988032 DEBUG: CALSADirectSound::CALSADirectSound - Channels: 6 - SampleRate: 48000 - SampleBit: 16 - Resample false - Codec AAC - IsMusic false - IsPassthrough false - audioDevice: plug:hdmi
19:53:08 T:2895108976 M:3426988032 DEBUG: RemoveActiveDevice - Removing device 1
19:53:08 T:2895108976 M:3426988032 DEBUG: SetActiveDevice - SetActiveDevice from 0 to 2
19:53:08 T:2895108976 M:3426988032 DEBUG: RemoveActiveDevice - Removing device 0
9:53:08 T:2895108976 M:3426902016 DEBUG: Initialize - using alsa device xbmc_aac51:'plug:hdmi'

xbmc_aac51 - is my, from above post. Receiver show 6ch PCM, all channel mapping correct. AAC and AC3 souns identical.