Kodi Community Forum

Full Version: Almost solved: PROPER Dual Audio on Linux
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
I modified Hawaltie's config from post 105 on Openelec 3.2.3 Generic build

http://forum.xbmc.org/showthread.php?tid...pid1435897


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

# First we create a 'both' route, that has 4 channels
pcm.both_digital {
        type route
        slave {
                pcm multi
                channels 4
        }
        # And we route the channels 1:1
        # 2 inputs (0-1) get mapped into 4 outputs (0-3)
        # (this is how we copy channels)
        ttable.0.0 1.0
        ttable.1.1 1.0
        ttable.0.2 1.0
        ttable.1.3 1.0
}

# Then define a multi device that splits the 4-channel input
# Into 2x 2 output

pcm.multi {
        type multi
        slaves.a {
                pcm "hdmi_hw"
                channels 2
        }
        slaves.b {
                pcm "dac_hw"
                channels 2
        }

    # Bind stuff to the HDMI outputs
        bindings.0.slave a
        bindings.0.channel 0
        bindings.1.slave a
        bindings.1.channel 1

        # And to the DAC outputs
        bindings.2.slave b
        bindings.2.channel 0
        bindings.3.slave b
        bindings.3.channel 1
}

# 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 0
        device 3
        channels 2
}

# Stereo output
pcm.dac_hw {
        type hw
        card 0
        device 7
        channels 2
}
First I have to say this tread was very useful when setting up the audio on my Zotac Nano running Ubuntu. Thank you to everyone that contributed. I am getting close to understanding how all the sound mappings work but I am still struggling with one last configuration. I sometimes use my setup for Karaoke when we have social events at our house and I can't seem to get the MIC to work on loopback with no delay with this configuration. Is there something I could add to the .asoundrc file to enable the mic with zero delay loopback into the speakers?

Thanks in advance!

FYI for people who may be having trouble getting sound out of one output with this configuration. Run alsamixer and make sure the volume of all your outputs are at 100%. I was having trouble getting sound out of the 2.0 analog output with my 7.1 HDMI output and the solution was that my master volume in alsamixer was turned to zero....started working as soon as I turned it up.
Thanks for all your contributions!

I now have simultaneous 2+2 audio on my setup using:
- The advancedsettings.xml from the topic start
- Selecting 'Default' in the audio menu after adding the ./storage/.config/asound.conf below:

Code:
# Aangemaakt: 20131208
# 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
#
# update by c3po:
# Reworked the excellent work from puntloos to make it work for a both analog & hdmi stereo (2 channels) configuration
# Can be a good sollution for people that do not have a 5.1 setup (like I have: HDMI goes directly to my TV which has only stereo speakers)

pcm.!default {
        type plug
        slave {
                pcm "both_digital"
        }
}

# First we create a 'both' route, that has 4 channels
pcm.both_digital {
        type route
        slave {
                pcm multi
                channels 4
        }
        # And we route the channels 1:1
        # 2 inputs (0-1) get mapped into 4 outputs (0-3)
        # (this is how we copy channels)
        ttable.0.0 1.0
        ttable.1.1 1.0
        ttable.0.2 1.0
        ttable.1.3 1.0
}

# Then define a multi device that splits the 4-channel input
# Into 2x 2 output

pcm.multi {
        type multi
        slaves.a {
                pcm "hdmi_hw"
                channels 2
        }
        slaves.b {
                pcm "dac_hw"
                channels 2
        }

        # Bind stuff to the HDMI outputs
        bindings.0.slave a
        bindings.0.channel 0
        bindings.1.slave a
        bindings.1.channel 1

        # And to the DAC outputs
        bindings.2.slave b
        bindings.2.channel 0
        bindings.3.slave b
        bindings.3.channel 1
}

# 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 0
        device 3
        channels 2
}

# Stereo output
pcm.dac_hw {
        type hw
        card 1
        device 1
        channels 2
}

My setup:
OpenElec 3.2.3 (XBMC 12.2)
Asus E2KM1-I Deluxe + 4GB mem + Kingston 60GB SSD
MS-Tech MC-80AN (case + remote)
Selecting 'Default' in the audio menu after adding the ./storage/.config/asound.conf below

Can't find the option 'Default' Anywhere.!

I only have hdmi/digital/analog

Or am I the wrong place? (system / audio hardware)

EDIT:
I found it, both analog and HDMI output worked with the above asound.conf

Didn't look good,at last I saw the default option

thanks
I'm beginning to think that those of us with a single "card" configuration as shown in aplay -l are doomed to run in either 2.0/2.0 or not show the "Default" device in the menu. Can anyone confirm that they have this working with both audio devices on the same card? Here is my aplay-l for example - 2.0/2.0 works fine but the "Default" option fails to appear in any other configuration.

Code:
# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC887-VD Analog [ALC887-VD Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 1: ALC887-VD Digital [ALC887-VD Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
[/code]
This is just to confirm that this works perfectly on an Zotac ZBOX ID88 (OpenELEC, XBMC 12.2 Frodo):

Code:
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC892 Analog [ALC892 Analog]
  Subdevices: 0/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 1: ALC892 Digital [ALC892 Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 7: HDMI 1 [HDMI 1]
  Subdevices: 0/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 8: HDMI 2 [HDMI 2]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

I used the asound.conf of the first post and only modified the card/device IDs in the last section. Then copied it to ./storage/.config/asound.conf. After that I added /storage/.xbmc/userdata/advancedsettings.xml with the contents of the first post.

Reboot!

In the settings the relevant item is quite hidden by the AEON NOX skin:
setup -> system -> audio output

At the top you only can select audio output as "analog, HDMI, spdif". This is the wrong place!

Press cursor right and scroll down, because there is more :-)

Set the option "Audio output device" to "Default" and enjoy dual audio sound!
Hey Guys,

I am running XBMC 12.3 on Xubuntu 13.10, I used the asound.conf of the first post (i tried many others as well) and only modified the card/device IDs in the last section and tried placing it in:

/etc/
and
/usr/share/xbmc/system/

as well as./asound in my home directory

With no change in the behavior of XBMC.

I would like to output 5.1 via s/pdif and 2.0 to Lyra Wireless which functions as a usb soundcard.


My output of aplay -l is:

**** List of PLAYBACK Hardware Devices ****
card 0: SB [HDA ATI SB], device 0: VT1708S Analog [VT1708S Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: SB [HDA ATI SB], device 1: VT1708S Digital [VT1708S Digital]
Subdevices: 0/1
Subdevice #0: subdevice #0
card 1: HDMI [HDA ATI HDMI], device 3: HDMI 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 2: L2000 [Lyra Wireless 2.0.00], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0

What am i doing wrong?

Thanks!
I'm having the same problem using Ubuntu. No matter where I put the configuration file from here (/etc/asound.conf, ~/.asoundrc), XBMC ignores it.
Build current xbmc tree from source. We now have a real pulseaudio sink.

use pavucontrol, papref, whatever to combine you a virtual sink and use that one in xbmc.
So that means that upcoming binary versions will also make this easier? Sorry for asking this stupidly, but I'm not sure what a "pulseaudio sink" is.
In audio you have source and destination, a sink is the destination.
Ok, thanks for clearing that up. I will just wait for the next readily compiled binary version and use my current setup until then.
Hi there!
i almost got this on my openelec 3.2.3. ALMOST!
from boot i only get audio from the 2nd device, but if i go to settigs > audio and circle trough all the options once (meaning: i start from "default HDMI Nvidia" and go through all the other option until i get to "default HDMI Nvidia" againg) i get output on both devices.
this is my asound.conf:
Code:
pcm.!default {
        type plug
        slave {
                pcm "both_digital"
        }
}

# First we create a 'both' route, that has 4 channels
pcm.both_digital {
        type route
        slave {
                pcm multi
                channels 4
        }
        # And we route the channels 1:1
        # 2 inputs (0-1) get mapped into 4 outputs (0-3)
        # (this is how we copy channels)
        ttable.0.0 1.0
        ttable.1.1 1.0
        ttable.0.2 1.0
        ttable.1.3 1.0
}

# Then define a multi device that splits the 4-channel input
# Into 2x 2 output

pcm.multi {
        type multi
        slaves.a {
                pcm "hdmi_hw"
                channels 2
        }
        slaves.b {
                pcm "dac_hw"
                channels 2
        }

    # Bind stuff to the HDMI outputs
        bindings.0.slave a
        bindings.0.channel 0
        bindings.1.slave a
        bindings.1.channel 1

        # And to the DAC outputs
        bindings.2.slave b
        bindings.2.channel 0
        bindings.3.slave b
        bindings.3.channel 1
}

# 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 2
        device 7
        channels 2
}

# Stereo output
pcm.dac_hw {
        type hw
        card 1
        device 0
        channels 2
}
advancedsettings should be fine.
this is my log (before switching audio output!)
http://pastebin.com/ew8eR9fz
Hi guys,

I have a revo 3610 with 3 audio output (SPDIF+HDMI+Analog)

Here is my configuration
It outputs:
- bitstream re-encoded to 5.1 Dolby Digital on SPDIF.
- Downmixed 2.0 pcm with Dolby Prologic II surround on HDMI.
- Downmixed 2.0 stereo without surround on Analog.

My xbmc(frodo) configuration is set to:
Audio Output: Analog
Speakers: 5.1
Output Audio device: all

Please enjoy

Code:
# Title: ACER Revo 3610 alsa configuration
# Author: stopdatrue
# Audio devices configuration:
# SPDIF(hw:0,1) connected to 5.1 Dolby Digital capable receiver.
# HDMI(hw:0,3) connected to 2.0(pcm) TV forwarding via SPDIF or Analog RCA to 5.1 Dolby Prologic II surround capable receiver.
# Analog(hw:0,0) connected to wireless stereo headphones.
#
# Note: - Dolby Prologic(not II) matrix is available on comment.
#       - Dolby Digital bitrate is set to 640Mbs, downgrade it to 448 if your receiver does not support.
pcm.!default {
        type plug
        slave {
                pcm "all"
                channels 6
        }
}

pcm.all {
        type route
        slave {
                pcm "binds"
                channels 10
        }

        # Keep 6 first channels unchanged for Dolby Digital output.
        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

        # Downmix using Dolby Prologic matrix on 2 channels (6,7)
        # ttable.0.6 1
        # ttable.1.7 1
        # ttable.2.6 0.707
        # ttable.2.7 -0.707
        # ttable.3.6 0.707
        # ttable.3.7 -0.707
        # ttable.4.6 0.707
        # ttable.4.7 0.707
        # ttable.5.6 0.707
        # ttable.5.7 0.707

        # Downmix using Dolby Prologic II matrix on 2 channels (6,7)
        ttable.0.6 1
        ttable.1.7 1
        ttable.2.6 0.866
        ttable.2.7 -0.5
        ttable.3.6 0.5
        ttable.3.7 -0.866
        ttable.4.6 0.707
        ttable.4.7 0.707
        ttable.5.6 0.707
        ttable.5.7 0.707

        # Downmix on stereo without surround on 2 channels (8,9)
        ttable.0.8 1.0
        ttable.1.9 1.0
        ttable.2.8 0.5
        ttable.3.9 0.5
        ttable.4.8 0.707
        ttable.4.9 0.707
        ttable.5.6 0.707
        ttable.5.7 0.707
}

pcm.binds {
        type multi

        slaves.digital {
                pcm "ac3"
                channels 6
        }

        slaves.hdmi {
                pcm "hw:0,3"
                channels 2
        }

        slaves.analog {
                pcm "hw:0,0"
                channels 2
        }

        # Bind 6 first channels on digital(spdif) output
        bindings.0.slave digital
        bindings.0.channel 0
        bindings.1.slave digital
        bindings.1.channel 1
        bindings.2.slave digital
        bindings.2.channel 2
        bindings.3.slave digital
        bindings.3.channel 3
        bindings.4.slave digital
        bindings.4.channel 4
        bindings.5.slave digital
        bindings.5.channel 5

        # Bind channels 6,7 on hdmi output
        bindings.6.slave hdmi
        bindings.6.channel 0
        bindings.7.slave hdmi
        bindings.7.channel 1

        # Bind channels 8,9 on analog output
        bindings.8.slave analog
        bindings.8.channel 0
        bindings.9.slave analog
        bindings.9.channel 1
}

pcm.ac3 {
        # Process Dolby Digital encoding
        type plug
        slave {
                pcm {
                        type a52
                        # Some devices supports only bitrate <= 448
                        # bitrate 448
                        bitrate 640
                        channels 6
                        slavepcm "hw:0,1"
                }
                format S16_LE
                rate 48000
        }
}
Very nicely done stopdatrue. Do you experience any weirdness with your setup? In particular Audio/Video not completely synchronous, or pops, crackles etc?

Honestly i've moved away from dual audio for a while purely because I upgraded XBMC (to Gotham) and didn't find time yet to update my configs. But it is starting to look like we can actually make an universal dual audio setup that users can just select-and-try by now.

(2014-03-12, 12:22)stopdatrue Wrote: [ -> ]Hi guys,

I have a revo 3610 with 3 audio output (SPDIF+HDMI+Analog)

Here is my configuration
It outputs:
- bitstream re-encoded to 5.1 Dolby Digital on SPDIF.
- Downmixed 2.0 pcm with Dolby Prologic II surround on HDMI.
- Downmixed 2.0 stereo without surround on Analog.

My xbmc(frodo) configuration is set to:
Audio Output: Analog
Speakers: 5.1
Output Audio device: all

Please enjoy

Code:
# Title: ACER Revo 3610 alsa configuration
# Author: stopdatrue
# Audio devices configuration:
# SPDIF(hw:0,1) connected to 5.1 Dolby Digital capable receiver.
# HDMI(hw:0,3) connected to 2.0(pcm) TV forwarding via SPDIF or Analog RCA to 5.1 Dolby Prologic II surround capable receiver.
# Analog(hw:0,0) connected to wireless stereo headphones.
#
# Note: - Dolby Prologic(not II) matrix is available on comment.
#       - Dolby Digital bitrate is set to 640Mbs, downgrade it to 448 if your receiver does not support.
pcm.!default {
        type plug
        slave {
                pcm "all"
                channels 6
        }
}

pcm.all {
        type route
        slave {
                pcm "binds"
                channels 10
        }

        # Keep 6 first channels unchanged for Dolby Digital output.
        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

        # Downmix using Dolby Prologic matrix on 2 channels (6,7)
        # ttable.0.6 1
        # ttable.1.7 1
        # ttable.2.6 0.707
        # ttable.2.7 -0.707
        # ttable.3.6 0.707
        # ttable.3.7 -0.707
        # ttable.4.6 0.707
        # ttable.4.7 0.707
        # ttable.5.6 0.707
        # ttable.5.7 0.707

        # Downmix using Dolby Prologic II matrix on 2 channels (6,7)
        ttable.0.6 1
        ttable.1.7 1
        ttable.2.6 0.866
        ttable.2.7 -0.5
        ttable.3.6 0.5
        ttable.3.7 -0.866
        ttable.4.6 0.707
        ttable.4.7 0.707
        ttable.5.6 0.707
        ttable.5.7 0.707

        # Downmix on stereo without surround on 2 channels (8,9)
        ttable.0.8 1.0
        ttable.1.9 1.0
        ttable.2.8 0.5
        ttable.3.9 0.5
        ttable.4.8 0.707
        ttable.4.9 0.707
        ttable.5.6 0.707
        ttable.5.7 0.707
}

pcm.binds {
        type multi

        slaves.digital {
                pcm "ac3"
                channels 6
        }

        slaves.hdmi {
                pcm "hw:0,3"
                channels 2
        }

        slaves.analog {
                pcm "hw:0,0"
                channels 2
        }

        # Bind 6 first channels on digital(spdif) output
        bindings.0.slave digital
        bindings.0.channel 0
        bindings.1.slave digital
        bindings.1.channel 1
        bindings.2.slave digital
        bindings.2.channel 2
        bindings.3.slave digital
        bindings.3.channel 3
        bindings.4.slave digital
        bindings.4.channel 4
        bindings.5.slave digital
        bindings.5.channel 5

        # Bind channels 6,7 on hdmi output
        bindings.6.slave hdmi
        bindings.6.channel 0
        bindings.7.slave hdmi
        bindings.7.channel 1

        # Bind channels 8,9 on analog output
        bindings.8.slave analog
        bindings.8.channel 0
        bindings.9.slave analog
        bindings.9.channel 1
}

pcm.ac3 {
        # Process Dolby Digital encoding
        type plug
        slave {
                pcm {
                        type a52
                        # Some devices supports only bitrate <= 448
                        # bitrate 448
                        bitrate 640
                        channels 6
                        slavepcm "hw:0,1"
                }
                format S16_LE
                rate 48000
        }
}
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15