Kodi Community Forum

Full Version: Asrock ION 330: Audio output to HDMI and SPDIF simultaneously
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hey guys,

I currently have things setup in a way that HDMI (TV) receives navigation sounds, and non-multichannel audio, while SPDIF (receiver) gets the DD/DTS to decode. These are exclusive.

What I'd like is to have both HDMI and SPDIF to receive audio simultaneously:

Non-multichannel: both receive the same digital signal
Multichannel: HDMI receives down-mixed stereo, SPDIF gets raw multichannel stream (DD/DTS)

I've been reading this forum till my eyes were numb, and played around with System/System/Audio settings and .asoundrc, but I can't get it to work. Workaround is to switch settings for different types of audio streams.

Can anyone get me a setup that works?
Yes that seems like a pretty damn good tutorial, thanks an aweful lot, I had not seen that one yet.
Paljas,

did you figure out a solution?
No not yet Boris, it's still really annoying. Now, whenever I pause a DTS/DD movie, the receiver switches back to PCM, so when I unpause again, I get the loud tick, which is bad for my speakers, not to mention disturbingly loud to the ears. So now I pause, mute, unpause, unmute. Not ideal.

I still have to dig into that article above, which is a good starting point, but not guaranteed to address the issue we're having. Have to find time to do it.
Paljas,

This thread
http://forum.xbmc.org/showthread.php?tid...lsa&page=2
is getting us close to the solution.

Although I'm not entirely happy about having to go through a re-encoding of the multichannel to AC3 for the SPDIF output.
I'm really sorry, in my last post (2 posts back) I was referring to another issue I had, thought it was another thread (http://forum.xbmc.org/showthread.php?tid=75857).

My current solution now mostly does what I want, referring to the opening post. I will post details and .asoundrc later.
Yes, please do!
You have to edit the .asoundrc (ALSA configuration) file. I found the configuration below somewhere on this forum, I can't recall which one, but I deserve no credit on this one.

Setup: XBMC Live 9.11 on Asrock ION 330

TV connected to HDMI (Panasonic TX-P42G20)
Receiver connected to optical out (NAD T761)

Audio output: digital
Dolby Digital (AC3) capable receiver: ticked
DTS Capable Receiver: ticked
Audio output device: default
Pass-thru device: iec958
Downmix multichannel audio to stereo: ticked

~/.asoundrc
Code:
pcm.!default {
        type plug
        slave {
                pcm "both_digital"
        }
}

pcm.both_digital {
        type route
        slave {
                pcm multi
                channels 4
        }
        ttable.0.0 1.0
        ttable.1.1 1.0
        ttable.0.2 1.0
        ttable.1.3 1.0
}

# Toslink digital_1 output
pcm.digital_1 {
        type hw
        card 0
        device 1
        channels 2
}

# HDMI digital_2 output
pcm.digital_2 {
        type hw
        card 0
        device 3
        channels 2
}

pcm.multi {
        type multi
        slaves.a {
                pcm "digital_1"
                channels 2
        }

        slaves.b {
                pcm "digital_2"
                channels 2
        }

        bindings.0.slave a
        bindings.0.channel 0
        bindings.1.slave a
        bindings.1.channel 1
        bindings.2.slave b
        bindings.2.channel 0
        bindings.3.slave b
        bindings.3.channel 1
}

What does it do?

source: menu sounds
output: both TV and receiver play sounds in stereo mode

source: movie with 2ch audio audio pcm/mp3 any quality
output: both TV and receiver play sounds in stereo mode

source: movie with DD5.1
output: receiver gets raw DD5.1 stream and decodes fine, except for short loud static noise during switch from stereo to DD5.1. TV plays no sound at all

source: movie with DTS
output: same as DD5.1, except now, when movie is paused, receiver switches to stereo, and back to DTS when movie is resumed, with again short noise burst

So, remaining problems:

1. TV does not play sound when playing DD5.1/DTS in digital mode.
2. Loud static noise burst while receiver is switching from stereo to DD5.1/DTS.

Workaround for (1) is to set output to analog. You can do this in the Settings/System/Audio window, or during the movie in the context window under audio options (faster than former).

Not sure if (1) is a problem of my TV or of XBMC. I should find some logfile of ALSA or something to see what it is actually sending to my TV over HDMI. There's likely an ALSA configuration that solves this problem.

I'll chase (2) in http://forum.xbmc.org/showthread.php?tid=75857 once I get the time.
Thanks Paljas.

This is exactly where I stand right now too.

I'm also trying to figure out #1.
I still haven't read the ALSA wiki/manual, but reading the configuration above is not too hard and it basically does the following. It creates two devices, digital_1 and digital_2 that map onto the optical and HDMI output, and defines them both as 2 channels. It then creates a device 'multi' with the former 2 as slaves (subdevices) with 4 channels, and maps the first 2 channels to the 2 channels of digital_1, and the last 2 to the 2 channels of digital_2. Then it creates both_digital and splits left to both digital_1's left and digital_2's left, same for right.

So the configuration basically simply only addresses splitting stereo to both HDMI and optical out.

I'm not really aware of what happens when a DD5.1/DTS signal is sent, and if anything you put into .asoundrc will ever change this behavior. When reading a bit onwards on pages on ALSA, I get the impression that still a stereo signal is sent, but with -pass_through or something, and hopefully your receiver detects that it's DD5.1/DTS.
I just found out in my TV manual that it only supports 2ch PCM over HDMI input. So I'm going to have to search for a solution where XBMC will simultaneously send the raw DD/DTS stream over optical out, and send a down-mixed 2ch PCM signal through HDMI.

Not sure if that's going to fly Wink.
Paljas Wrote:I just found out in my TV manual that it only supports 2ch PCM over HDMI input. So I'm going to have to search for a solution where XBMC will simultaneously send the raw DD/DTS stream over optical out, and send a down-mixed 2ch PCM signal through HDMI.

Not sure if that's going to fly Wink.

Hi Paljas, any results of your search?
So far the only similar solution would be with a52 plugin and reencode sound to SPDIF in all cases. No passthrough though...
http://forum.xbmc.org/showpost.php?p=571...stcount=18
It upscales stereo music to 6 channels unfortunately, also when jumping in movie there is a static loud noise on amp/speakers via SPDIF.

Again, I have not found any solution in forum or configuration combo on XBMC that would allow: passthrough on output1, while downconvert 5.1 to stereo for output2 and keep stereo intacts to output1 and 2.
Also there is no hotkey to map for disabling/enabling passthrough via single click on remote, which would be temporary solution to overcome on your problem.
Maybe it is worth of a XBMC feature request? Oo Will wait for feedbacks before.
People dont seem to understand how complex the problem of audio is by itself, then introduce multichannel, passthrough, channel mapping, and then add to that mix making it work on Linux with ALSA, Linux with PulseAudio, OSX and Windows, and work the same across each system....

There is a tremendous amount of work to make everything work seamlessly and the Audio layer is going through an overhaul at the moment. For technical reasons, outputting to more then one device (Yes, HDMI & SPDIF on the same card are TWO devices) and keeping them in sync, and down-mixing one of them, would be a nightmare...

So in short, this is not likely ever going to be added, so don't hold your breath.
gnif Wrote:People dont seem to understand how complex the problem of audio is by itself, then introduce multichannel, passthrough, channel mapping, and then add to that mix making it work on Linux with ALSA, Linux with PulseAudio, OSX and Windows, and work the same across each system....

There is a tremendous amount of work to make everything work seamlessly and the Audio layer is going through an overhaul at the moment. For technical reasons, outputting to more then one device (Yes, HDMI & SPDIF on the same card are TWO devices) and keeping them in sync, and down-mixing one of them, would be a nightmare...

So in short, this is not likely ever going to be added, so don't hold your breath.

Clear enough, if this hits a limit. Thanks for the quick answer.
I'm not intended to question the complexity of the task.

Would theoretically a hotkey solution work from audio stream point of view, that let's say toggles DTS passthrough to ON/OFF (on the fly, while playin a movie)? This would solve user experience, and simplify the complexity of the problem.
Pages: 1 2