[Linux] how to get digital audio output through hdmi and spdif simulaneously
#1
Star 
hi all,

i was trying hard to get a working asound.conf that fits my setup. but i didn't make it. accidentally i found the solution that fits my needs perfectly.

background:
i have a 5.1 setup including an ac3/dts avr for watching my movies. also i use an old stereo amp for listening to music. to use both amps with the same front speakers, i connected the preout front outputs of my avr with the poweramp section of my stereo amp. having this in mind, my htpc is connected via hdmi with my avr while spdif (toslink) is connected with my dac/stereo amp. to describe the "audio chains" let's have a look at the following:

first chain:
htpc -> HDMI -> avr -> HDMI -> lcd
[INDENT][INDENT][INDENT]|
-> center/sub/rear
|
-> preout -> CINCH -> stereo amp -> frontspeakers
[/INDENT][/INDENT][/INDENT]


second chain:
htpc -> TOSLINK -> dac -> CINCH -> stereo amp -> frontspeakers

here is some output of my audio device:
Code:
aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: NVidia [HDA NVidia], device 0: VT1708S Analog [VT1708S Analog]
  Subdevices: 2/2
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
card 0: NVidia [HDA NVidia], device 1: VT1708S Digital [VT1708S Digital]
  Subdevices: 0/1
  Subdevice #0: subdevice #0
card 0: NVidia [HDA NVidia], device 3: NVIDIA HDMI [NVIDIA HDMI]
  Subdevices: 0/1
  Subdevice #0: subdevice #0

the following setup gives me great results.

xbmc config:
- audio output: digital
- dolby digital capable receiver: yes
- dts capable receiver: yes
- audio output: default
- passthrough output device: hdmi
- downmix multichannel audio to stereo: yes (i guess this setting does not matter since ac3/dts is getting passed through to the avr anyway)

result:
- non ac3/dts stereo playback (video, audio) over toslink and hdmi at the same time
- passthrough of ac3/dts signals to my external avr. in this case toslink does not output anything. but that's fine and like it should be.
- navigation sounds on both output devices, hdmi and toslink

disadvantages:
- i didn't find any until now

so here we go:
Code:
cat /etc/asound.conf
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
}

source: http://www.vdrportal.de/board/thread.php...post850161


have fun && regards,
einhänder
Reply
#2
Does making it "channels 2" not make it only stereo? What if you want to play a 5.1 track/movie?

-Erik
Reply
#3
hi einhander,

i know there were some posts in this thread (before the lighting strike) discussing outputting both 5.1 to toslink and hdmi, and you find out how.

can you post again your finding?

thanks.
Reply
#4
hi h3rd3r,

as far as i can remember you simply have to set "default" as your passthrough device (not tested). just play around with the audio settings in xbmc.
Reply
#5
Hi,

This is exactly what I want to do. I only have a stereo system and want bit-perfect (i.e. 44.1kHz) playback of CDs and downmixed LPCM for movies. Are you able to confirm if you play a CD, it doesn't get resampled to 48kHz?

Thanks
Reply
#6
hi arad85,

i just did some checks:

playback of a lossless audio track (playback simultaneously through hdmi and toslink):

Code:
XBMC ~ # cat /proc/asound/card0/pcm3p/sub0/hw_params
access: MMAP_INTERLEAVED
format: S16_LE
subformat: STD
channels: 2
rate: 44100 (44100/1)
period_size: 512
buffer_size: 8192

XBMC ~ # cat /proc/asound/card0/pcm1p/sub0/hw_params
access: MMAP_INTERLEAVED
format: S16_LE
subformat: STD
channels: 2
rate: 44100 (44100/1)
period_size: 512
buffer_size: 8192

playback of movie with dts soundtrack (passthrough via hdmi only):

Code:
XBMC ~ # cat /proc/asound/card0/pcm3p/sub0/hw_params
access: RW_INTERLEAVED
format: S16_LE
subformat: STD
channels: 2
rate: 48000 (48000/1)
period_size: 512
buffer_size: 8192

though i'm not quite sure why the latter output just shows two channels. my amp fires all speakers.
atm i'm playing around with jack, looks like this would be the ultimate option for audiophile people. see the following links for details:

http://forum.xbmc.org/showthread.php?p=5...post523917
http://en.gentoo-wiki.com/wiki/JACK
Reply
#7
What distros are you guys running? I am on Lucid 64bit. I don't have the exact same setup as the original poster, but I am outputting SPDIF to my AV receiver and HDMI to my TV at the same time. I am pretty sure HDMI connected to a receiver would work too.
But ... I have the very default Lucid setup, no asound.conf and no asound.rc at all.
It just works right now ....

Output in XBMC are both set to IEC958.

boba
Reply
#8
einhänder Wrote:hi arad85,

i just did some checks:
You're the man. Thank you VERY much Smile DAC on order now Big Grin
Reply
#9
OT: already made your choice? i can highly recommend this one:
http://www.mglaudiolabs.com/en/products/.../index.php
Reply
#10
Went with this one:

http://www.cambridgeaudio.com/summary.php?PID=320

A bit cheaper at £230 than your selection... and good reviews too Smile Uses the same DACs for what it's worth.... Having said that, it has to compete against a Naim CDS1 for playback.... (into a setup of Naim 52 pre/135 power/DBLs...) which is why going surround is very expensive Eek
Reply
#11
einhänder Wrote:i have a 5.1 setup including an ac3/dts avr for watching my movies. also i use an old stereo amp for listening to music. to use both amps with the same front speakers, i connected the preout front outputs of my avr with the poweramp section of my stereo amp. having this in mind, my htpc is connected via hdmi with my avr while spdif (toslink) is connected with my dac/stereo amp. to describe the "audio chains" let's have a look at the following:

first chain:
htpc -> HDMI -> avr -> HDMI -> lcd
[INDENT][INDENT][INDENT]|
-> center/sub/rear
|
-> preout -> CINCH -> stereo amp -> frontspeakers
[/INDENT][/INDENT][/INDENT]

second chain:
htpc -> TOSLINK -> dac -> CINCH -> stereo amp -> frontspeakers

Hi,

could you (or someone else ;-) please help me setting up XBMC (installed to harddisk on an ASRock Ion 330HT from live CD) for the following environment?
The main difference to the setup described above is that I do have only a stereo amplifier which all devices are connected to:

first chain:
htpc -> HDMI -> lcd -> stereo amplifier -> stereo speakers

second chain:
htpc -> TOSLINK -> dac -> CINCH -> stereo amp -> stereo speakers

My XBMC config:

xbmc config:
- audio output: digital
- dolby digital capable receiver: no
- dts capable receiver: no
- audio output: default
- passthrough output device: hdmi
- downmix multichannel audio to stereo: yes

Currently the I hear no sound on my LCD through HDMI - so where is my fault? What are the correct settings for asound.conf?
Vero 4k+ | OSMC Kodi 19.1
Sony KD-65A1
Reply
#12
hm, i just tested your setup and it works with the mentioned alsa confinguration.
the only differences are:

- i'm using the svn version of xbmc (audio settings have changed but shouldn't matter since i used to use this config with xbmc 9.11)
- my htpc is connected to an avr via hdmi (giving me downmixed stereo sound on a movie with 5.1 ac3 soundtrack)

at first i'd compare the ouput of (aplay -l) with the devices used in your alsa config.
Reply
#13
My set-up is again different to this.

Is it possible to output DTS/DD over SPDIF for all content and downmix to stereo for the HDMI.

Basically, I want the option of being able to watch movies only on my TV without having to use my external A/V. The TV only supports a stereo over HDMI.

Thanks Anand
Reply
#14
nigma2k Wrote:Basically, I want the option of being able to watch movies only on my TV without having to use my external A/V. The TV only supports a stereo over HDMI.

this is just a blind shot. but i'd try to set hdmi as the default audio device (connected to tv) while defining spdif/toslink as your passthrough device (connected to avr). the downmix option would be disabled in that case, since hdmi puts out all stereo signals anyway.

nevertheless you would have to use the posted asound.conf in case you want to output stereo signals via the passthrough device (spdif in your case) as well. if you wouldn't need stereo over your passthrough device it should work out of the box just by defining the devices in a correct way (e.g. like mentioned above).
Reply
#15
hi,

I like this idea. Would it work for TOSLINK & HDMI into the same amp? I have an AVR amp and want my music to go through TOSLINK, but movie DTS, AC3 etc to go through HDMI using the same amp?


thanks
Reply

Logout Mark Read Team Forum Stats Members Help
[Linux] how to get digital audio output through hdmi and spdif simulaneously1