2012-11-17, 07:05
[Edit March 3rd] - It would be useful if you chime in if you either:
- Have it working perfectly
- Have it working 'with issues' (most notably the 'occasional hiccup bug')
- Can't get it to work (do post your graphics card and/or audio hardware through aplay -l )
- Would love for this to work
If many people chime in it'll be easier to get this feature officially supported rather than this system that isn't officially tested not to break with updates etc)
Through experimenting with asound.conf I've managed to get dual audio working. But with some caveats.
Stuff that works:
- XBMC is sending audio to both my HDMI out, as well as to my stereo out.
- The HDMI audio is surround. This was the hard part.
Stuff that is iffy:
- If you are using passthrough audio (don't.... there is not good reason to do so!) then dual audio might stop working. Not sure why, maybe passthrough mode bypasses asound completely?
- My receiver sometimes every 3-4 mins drops audio for a second, relays clicking (losing encoding detection.. I think). Some people had better success.
Todo:
- See if I can put the hardware config stuff on top of the file (for readability)
- See if some additional buffering can be inserted to fix occasional dropouts. So far whatever I try basically stops everything working (too much buffering?)
My system is a Zotac ZBOX ID80 (Intel Atom D2700 + Nvidia Geforce 520M) running OpenELEC Frodo
To get this to work: (for non-OpenELEC setups configfile paths should be similar, go find them yourself with locate or find / | grep asound.conf )
0/ ssh into your XBMC and run to get a list of recognized devices. Sample output:
1/ Modify your system's asound.conf ( ./storage/.config/asound.conf ) - in particular edit the hardware config at the bottom to match your hardware from #0. In my case it turned out that I needed card 1 device 3 for HDMI out, and card 0 device 1 for digital out.
2/ Go into system settings and make sure audio device used is 'default'
3/ Edit advancedsettings.xml (./storage/.xbmc/userdata/advancedsettings.xml) - or create the file if it doesn't exist, and make sure it has these lines
For reference my full advancedsettings.xml is here
4/ (optional) Go to audio settings and tell XBMC your receiver ONLY supports LPCM, and not AC3/DTS/etc, and disable passthrough, no good can come from it =) (opinions on this vary wildly but this is my fairly informed opinion)
- Have it working perfectly
- Have it working 'with issues' (most notably the 'occasional hiccup bug')
- Can't get it to work (do post your graphics card and/or audio hardware through aplay -l )
- Would love for this to work
If many people chime in it'll be easier to get this feature officially supported rather than this system that isn't officially tested not to break with updates etc)
Through experimenting with asound.conf I've managed to get dual audio working. But with some caveats.
Stuff that works:
- XBMC is sending audio to both my HDMI out, as well as to my stereo out.
- The HDMI audio is surround. This was the hard part.
Stuff that is iffy:
- If you are using passthrough audio (don't.... there is not good reason to do so!) then dual audio might stop working. Not sure why, maybe passthrough mode bypasses asound completely?
- My receiver sometimes every 3-4 mins drops audio for a second, relays clicking (losing encoding detection.. I think). Some people had better success.
Todo:
- See if I can put the hardware config stuff on top of the file (for readability)
- See if some additional buffering can be inserted to fix occasional dropouts. So far whatever I try basically stops everything working (too much buffering?)
My system is a Zotac ZBOX ID80 (Intel Atom D2700 + Nvidia Geforce 520M) running OpenELEC Frodo
To get this to work: (for non-OpenELEC setups configfile paths should be similar, go find them yourself with locate or find / | grep asound.conf )
0/ ssh into your XBMC and run
Code:
aplay -l
Code:
**** List of PLAYBACK Hardware Devices ****
card 0: Intel [HDA Intel], device 0: ALC892 Analog [ALC892 Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: Intel [HDA Intel], device 1: ALC892 Digital [ALC892 Digital]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0]
Subdevices: 0/1
Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 7: HDMI 1 [HDMI 1]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 8: HDMI 2 [HDMI 2]
Subdevices: 1/1
Subdevice #0: subdevice #0
1/ Modify your system's asound.conf ( ./storage/.config/asound.conf ) - in particular edit the hardware config at the bottom to match your hardware from #0. In my case it turned out that I needed card 1 device 3 for HDMI out, and card 0 device 1 for digital out.
Code:
# asound.conf for Dual Audio - HDMI (5.1) + Stereo out
# by puntloos
# This should allow you to send audio to two devices, one HDMI (for surround) and one other device, which can be digital or even analog outputs
# 1- Location of asound.conf in OpenELEC is ./storage/.config/asound.conf - create or modify that file.
# 2- Modify the bottom part of the file to match your hardware
pcm.!default {
type plug
slave {
pcm "both_digital"
}
}
# First we create a 'both' route, that has 12 channels
pcm.both_digital {
type route
slave {
pcm multi
channels 12
}
# And we route the channels 1:1
# 6 inputs (0-5) get mapped into 12 outputs (0-11)
# (this is how we copy channels)
ttable.0.0 1.0
ttable.1.1 1.0
ttable.2.2 1.0
ttable.3.3 1.0
ttable.4.4 1.0
ttable.5.5 1.0
ttable.0.6 1.0
ttable.1.7 1.0
ttable.2.8 1.0
ttable.3.9 1.0
ttable.4.10 1.0
ttable.5.11 1.0
}
# Then define a multi device that splits the 12-channel input
# Into 2x 6 output
pcm.multi {
type multi
slaves.a {
pcm "hdmi_hw"
channels 6
}
slaves.b {
# virtual dac still has 6 channels
# although I suppose I could try making it 2
pcm "dac_virtual"
channels 6
}
# Bind stuff to the HDMI outputs
bindings.0.slave a
bindings.0.channel 0
bindings.1.slave a
bindings.1.channel 1
bindings.2.slave a
bindings.2.channel 2
bindings.3.slave a
bindings.3.channel 3
bindings.4.slave a
bindings.4.channel 4
bindings.5.slave a
bindings.5.channel 5
# And to the DAC outputs
bindings.6.slave b
bindings.6.channel 0
bindings.7.slave b
bindings.7.channel 1
bindings.8.slave b
bindings.8.channel 2
bindings.9.slave b
bindings.9.channel 3
bindings.10.slave b
bindings.10.channel 4
bindings.11.slave b
bindings.11.channel 5
}
# Since the DAC is 2 channels, we downmix.
pcm.dac_virtual
{
type route
slave.pcm dac_hw
slave.channels 2
# Front and rear, at 33% of original signal strength
ttable.0.0 0.33
ttable.1.1 0.33
ttable.2.0 0.33
ttable.3.1 0.33
# Center channel routing (routed to front-left and front-right),
# 6dB gaindrop (gain half of main channels) per channel
ttable.4.0 0.16
ttable.4.1 0.16
# LFE channel routing (routed to front-left and front-right),
# 6dB gaindrop (gain half of main channels) per channel
ttable.5.0 0.16
ttable.5.1 0.16
}
# And here is my actual hardware
# Note that this is linked to the output of 'aplay -l'
# HDMI output
pcm.hdmi_hw {
type hw
card 1
device 3
channels 6
}
# Stereo output
pcm.dac_hw {
type hw
card 0
device 1
channels 2
}
2/ Go into system settings and make sure audio device used is 'default'
3/ Edit advancedsettings.xml (./storage/.xbmc/userdata/advancedsettings.xml) - or create the file if it doesn't exist, and make sure it has these lines
Code:
<advancedsettings>
<audio>
<resample>0</resample>
<audiophile>1</audiophile>
<audiosinkbufferdurationmsec>200</audiosinkbufferdurationmsec>
<allowtranscode44100>0</allowtranscode44100>
<streamsilence>1</streamsilence>
<dont_resample>1</dont_resample>
<audiophile>1</audiophile>
</audio>
</advancedsettings>
For reference my full advancedsettings.xml is here
4/ (optional) Go to audio settings and tell XBMC your receiver ONLY supports LPCM, and not AC3/DTS/etc, and disable passthrough, no good can come from it =) (opinions on this vary wildly but this is my fairly informed opinion)