• 1
  • 11
  • 12
  • 13
  • 14(current)
  • 15
Linux Almost solved: PROPER Dual Audio on Linux
Quote:<audio>
<resample>0</resample>
<audiophile>1</audiophile>
<audiosinkbufferdurationmsec>200</audiosinkbufferdurationmsec>
<allowtranscode44100>0</allowtranscode44100>
<streamsilence>1</streamsilence>
</audio>

None of those options still exists in Gotham, you can remove them all.
First decide what functions / features you expect from a system. Then decide for the hardware. Don't waste your money on crap.
Reply
(2014-06-11, 08:31)fritsch Wrote:
Quote:<audio>
<resample>0</resample>
<audiophile>1</audiophile>
<audiosinkbufferdurationmsec>200</audiosinkbufferdurationmsec>
<allowtranscode44100>0</allowtranscode44100>
<streamsilence>1</streamsilence>
</audio>

None of those options still exists in Gotham, you can remove them all.

Clean-up docs on wiki accordingly as well and further to what doesnt exist anymore. like in addition to above.

<resample>48000</resample>
<forcedirectsound></forcedirectsound>

This is just a remark to note that, so please ignore offtopic.
Reply
To simplify my question from the previous post. How do I get a combined source audio output option to show up as a choice in the settings in XBMC gotham?

In the following case I get "mixed" and "multi" options that show up:
Code:
pcm.analog-hw {
        type hw
        card 0
        device 0
}

ctl.analog-hw {
        type hw
        card 0
}

pcm.digital-hw {
        type hw
        card 0
        device 3
}

ctl.digital-hw {
        type hw
        card 0
}

pcm.!default {
        type plug
        slave {
                pcm multi
                rate 48000
        }
        ttable.0.0 1.0
        ttable.1.1 1.0
        ttable.0.2 1.0
        ttable.1.3 1.0
        ttable.2.4 1.0
        ttable.3.5 1.0
        ttable.4.6 1.0
        ttable.5.7 1.0
        ttable.6.8 1.0
        ttable.7.9 1.0
}

ctl.!default {
        type hw
        card 0
}

pcm.mixed {
        type plug
        slave {
                pcm multi
                rate 48000
                channels 10
        }
        ttable.0.0 1.0
        ttable.1.1 1.0
        ttable.0.2 1.0
        ttable.1.3 1.0
        ttable.2.4 1.0
        ttable.3.5 1.0
        ttable.4.6 1.0
        ttable.5.7 1.0
        ttable.6.8 1.0
        ttable.7.9 1.0
}

ctl.mixed {
        type hw
        card 0
}

pcm.multi {
        type multi
        slaves.a.pcm "analog-hw"
        slaves.a.channels 2
        slaves.b.pcm "digital-hw"
        slaves.b.channels 8
        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
        bindings.4.slave b
        bindings.4.channel 2
        bindings.5.slave b
        bindings.5.channel 3
        bindings.6.slave b
        bindings.6.channel 4
        bindings.7.slave b
        bindings.7.channel 5
        bindings.8.slave b
        bindings.8.channel 6
        bindings.9.slave b
        bindings.9.channel 7
}

ctl.multi {
        type hw
        card 0
}

In this case I don't understand why "all" doesn't show up as an option:
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 using Dolby Prologic II matrix on 2 channels (6,7)
    # Reviewed according to: http://en.wikipedia.org/wiki/Talk%3ADolby_Pro_Logic
    ttable.0.6 1
        ttable.1.7 1
        ttable.2.6 0.872
        ttable.2.7 -0.490
        ttable.3.6 0.490
        ttable.3.7 -0.872
        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.8 0.707
        ttable.5.9 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
    }
}
Reply
With pa you could create that ~/.asoundrc
Code:
pcm.a52 {
  @args [CARD]
  @args.CARD {
    type string
  }
  type rate
  slave {
    pcm {
      type a52
      bitrate 448
      channels 6
      card $CARD
    }
  rate 48000
  }
}

and afterwards:
Code:
sudo apt-get install libasound2-plugins-extra
pulseaudio -k

In xbmc choose output Fixed, 48 khz Channel Layout 5.1

Use the combine instructions from the wiki to combine the a52 slave of your hdmi / spdif card with the analog output.

For example:
Code:
load-module module-combine-sink sink_name=mymultistagesoutput slaves=alsa_output.pci-0000_03_04.0.analog-stereo,alsa_output.pci-0000_01_00.1.hdmi-stereo-extra3

check with pactl list sinks to find the proper device names.
Edit: If you prefer dts, check here: http://aepatrakov.narod.ru/index/0-3
First decide what functions / features you expect from a system. Then decide for the hardware. Don't waste your money on crap.
Reply
Fritsch,

Thanks for the insight on mimicking the ASLA setup with PA. I will give that a try this evening.

I still have one unanswered question though. What does XBMC look for in order to display a new audio output in the settings menu?

Though all of this it is still unclear to me what attribute XBMC looks for to display a new item in the settings menu. For example, if I follow the PA setup on the wiki I don' t get an item in my settings menu labeled "combined".

For me there is some disconnect between creating a new audio sink configuration and having XBMC list that configuration in the settings menu. Sometimes it appears as expected, sometimes it appears with a different name than expected and sometimes it doesn't appear at all.

Thanks for all the help!
Reply
With pulseaudio I get a callback whenever a new device is added and then I reenumerate and display those new devices.

The ALSA sink does not have that capability yet, therefore you only see the device you have at startup. As xbmc queries alsa device itself it ignores the following: https://github.com/xbmc/xbmc/blob/master...A.cpp#L774
First decide what functions / features you expect from a system. Then decide for the hardware. Don't waste your money on crap.
Reply
I see...that makes sense. One last question. On the PA side it appears that the callback should provide the sink_name attribute to XBMC when a new device is added and that is what XBMC displays. Is that correct?

What is the similar mechanism for ASLA? On startup XBMC will look for new ASLA devices, what attribute does is use to name the device in the settings menu?
Reply
Nope, it just tells us, over our callback, here: https://github.com/xbmc/xbmc/blob/master...E.cpp#L477 that there was a new Event received, e.g. a new sink appeared (or was gone): https://github.com/xbmc/xbmc/blob/master...E.cpp#L187

I then reenumerate, see here: by calling: CAEFactory:Big GrineviceChange(); which triggers: https://github.com/xbmc/xbmc/blob/master...E.cpp#L867

Quote:What is the similar mechanism for ASLA? On startup XBMC will look for new ASLA devices, what attribute does is use to name the device in the settings menu?

On ALSA we don't get those events at all, we only enumerate on startup, yes. We ask device itself, see the GetFriendlyName() in the AESinkALSA.cpp

Edit: I really love that PA callback on my desktop - plugin earphones - it continues on earphone, plugin usb sound card, it continues there - just be using the default device :-)
First decide what functions / features you expect from a system. Then decide for the hardware. Don't waste your money on crap.
Reply
(2014-05-07, 01:08)snoxbox Wrote: I've read through this thread and I'm a little confused about the state of play with Gotham.

I'm running Openelec 3.2. If I upgrade to Openelec 4.0 (Gotham), will this hack still work?

A little late response, but it might help others experiencing some issues on OpenElec 4.0:

I updated from OpenElec 3.2 to 4.0 still keeping my 2.0 setup. It worked fine for audio playback, but when watching video on the start of the movie the video playback would stutter & no audio could be heard for a few seconds. This mostly happened on the start of a movie but sometimes it started to stutter again later.

Turned out that the dual audio setup was causing this, because when I switched audio to HDMI or Analog only the stuttering video behavior was gone. Solution was to set the output configuration to 'fixed' instead of 'optimized':

Image

I know the "Fixed output" configuration has been explained before in this thread... but I overlooked it and it took me some time searching the web to find a fix for it. I hope this post can help others experiencing the same video / audio stutter problems.
Reply
I use Gotham and was looking for this. My setup is XBMC on a Asus ION-thingy, and I wanted to use HDMI + USB DAC to output sound.

And this is the thread which made it possible for me to get that. Well, I did some modifications because I wanted ALSA to output to both cards and also passthrough to my surround amplifier via HDMI.

So, what are the modifications? Firstly I made so that the DAC has only two channels in the config file, I don't want to downsample to stereo as I am anyway never going to play surround sound on the DAC anyway. Else I skipped the "advancedguisettings.xml"-file inputs and the idea of setting the bitrate to "Fixed", I left it to "Optimized" so I can enjoy passthrough mode to my receiver via HDMI.

Now, when passthough is enabled (like getting sound from dolby or dts), the DAC won't get any input, which is fine by me as I only want it to work for stereo sounds (NB! Dolby (and DTS?) encoded stereo still does passthrough, and will not give sounds to the DAC. However I mainly use this for music, and that is encoded in MP3 or FLAC or any other codecs which is not Dolby or DTS).

I also made a "hint" in the file, so it's showing a little nicer name in XBMC Audio settings.

Note! I only use this file and choose "HDMI Surround 5.1 + DAC Stereo" from XBMC Audio settings, nothing else. It has only been tested with Gotham stable.

Code:
pcm.!default {
        type plug
        slave {
                pcm "both_digital"
        }
        hint {
                show on
                description "HDMI Surround 5.1 + DAC Stereo"
        }
}

# First we create a 'both' route, that has 8 channels
pcm.both_digital {
        type route
        slave {
                pcm multi
                channels 8
        }
        # And we route the channels 1:1
        # 6 inputs (0-5) get mapped into 2 outputs (0-7)
        # (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
}

# Then define a multi device that splits the 8-channel input
# Into 6/2 output

pcm.multi {
        type multi
        slaves.a {
                pcm "hdmi_hw"
                channels 6
        }
        slaves.b {
                # dac usb has 2 channels
                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
        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
}

# 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 6
}

# Stereo output
pcm.dac_hw {
        type hw
        card 1
        device 0
        channels 2
}
Reply
Hi oleoleole,

Nice to see that it works fine for your, as i'm looking for the same Smile . My setup is XBMC (on OpenElec) on a Matrix TBS2910 box. I mean i'd like to get audio output by USB port of my Matrix TBS2910 connected to the USB port of my Hifi DAC. Is it the same for you ?

Did you edit /storage/.config/asound.conf file ?

I don't see in your asound.conf what identify the USB port as audio output. How do you do to make xbmc recognize the USB port as an audio ouput port ?
Reply
(2014-10-26, 16:44)laruf Wrote: Hi oleoleole,

Nice to see that it works fine for your, as i'm looking for the same Smile . My setup is XBMC (on OpenElec) on a Matrix TBS2910 box.

Do you mean that you edit /storage/.config/asound.conf file ?

That file should do I guess. I use .asoundrc in $HOME myself (I use xbmcbuntu)
Reply
Here is the asound.conf I've settled on after reading this thread and playing about. It always provides original source audio on one output and stereo on the other. XBMC will open different devices depending on the source material IF ALSA 'default' is a stereo device (See CAESinkALSA::OpenPCMDevice and this comment from the XBMC source code). Which is cool because we dont have to force a 2.0 source to 5.1 on the receiver. This file provides ALSA devices 'default', 'surround40', 'surround51', and 'surround71'. Set your audio device to 'Default' in XBMC and it will select the appropriate one automatically.

On my setup 'pcm.main' is HDMI connected to surround receiver and 'pcm.zone' is stereo RCA connected to Zone2 on the same receiver. I get the following outputs using this config depending on source material (2.0, 4.0, 5.1, 7.1)

Code:
2.0 Source --+--> 2.0 Main
             \--> 2.0 Zone2

5.1 Source --+--> 5.1 Main
             \--> 2.0 Zone2 (Dolby PLii)

Here's the file. You'll have to modify 'card' and 'device' for both 'pcm.main' and 'pcm.zone' to match your hardware. If you don't want Dolby downmix, delete all the 'ttable.x.x 0.xxxxxxxx' lines. Keep the 1.0's

Code:
#
# asound.conf - Dual Audio for XBMC. Surround + Dolby PLii Stereo
# Modify 'card' and 'device' below to match your hardware. See 'aplay -l'
#

pcm.main {        # Surround
    type    hw
    card    0
    device    3
}

pcm.zone {        # Stereo
    type    hw
    card    1
    device    0
}


pcm.!default {
    type                plug
    hint.show            on
    hint.description    "2.0 Stereo"

    slave.channels        2
    slave.pcm            {
        type            route

        ttable.0.0        1.0
        ttable.1.1        1.0

        ttable.0.2        1.0
        ttable.1.3        1.0

        slave.channels    4
        slave.pcm        {
            type                multi

            slaves.a.pcm         "main"
            slaves.a.channels     2
            slaves.b.pcm        "zone"
            slaves.b.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
        }
    }        
}

pcm.!surround40 {
    type                plug
    hint.show            on
    hint.description    "4.0 Surround + 2.0 Stereo"

    slave.channels        4
    slave.pcm            {
        type            route

        ttable.0.0         1.0
        ttable.1.1         1.0
        ttable.2.2         1.0
        ttable.3.3         1.0

        ttable.0.4         1.0
        ttable.2.4        -0.87177978870813471044739639677192
        ttable.3.4        -0.48989794855663561963945681494118

        ttable.1.5         1.0
        ttable.2.5         0.48989794855663561963945681494118
        ttable.3.5         0.87177978870813471044739639677192

        slave.channels            6
        slave.pcm                {
            type                multi

            slaves.a.pcm        "main"
            slaves.a.channels    4
            slaves.b.pcm        "zone"
            slaves.b.channels    2

            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    b
            bindings.4.channel    0
            bindings.5.slave    b
            bindings.5.channel    1
        }
    }
}

pcm.!surround51 {
    type                plug
    hint.show            on
    hint.description    "5.1 Surround + 2.0 Stereo"

    slave.channels        6
    slave.pcm            {
        type            route

        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.2.6        -0.87177978870813471044739639677192
        ttable.3.6        -0.48989794855663561963945681494118
        ttable.4.6         0.70710678118654752440084436210485
        ttable.5.6         0.70710678118654752440084436210485

        ttable.1.7         1.0
        ttable.2.7         0.48989794855663561963945681494118
        ttable.3.7         0.87177978870813471044739639677192
        ttable.4.7         0.70710678118654752440084436210485
        ttable.5.7         0.70710678118654752440084436210485

        slave.channels            8
        slave.pcm                {
            type                multi

            slaves.a.pcm        "main"
            slaves.a.channels    6
            slaves.b.pcm        "zone"
            slaves.b.channels    2

            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

            bindings.6.slave    b
            bindings.6.channel    0
            bindings.7.slave    b
            bindings.7.channel    1
        }
    }
}

pcm.!surround71 {
    type                plug
    hint.show            on
    hint.description    "7.1 Surround + 2.0 Stereo"

    slave.channels        8
    slave.pcm            {
        type            route

        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.6.6         1.0
        ttable.7.7         1.0

        ttable.0.8         1.0
        ttable.2.8        -0.87177978870813471044739639677192
        ttable.3.8        -0.48989794855663561963945681494118
        ttable.4.8         0.70710678118654752440084436210485
        ttable.5.8         0.70710678118654752440084436210485
        ttable.6.8        -0.87177978870813471044739639677192
        ttable.7.8        -0.48989794855663561963945681494118

        ttable.1.9         1.0
        ttable.2.9         0.48989794855663561963945681494118
        ttable.3.9         0.87177978870813471044739639677192
        ttable.4.9         0.70710678118654752440084436210485
        ttable.5.9         0.70710678118654752440084436210485
        ttable.6.9         0.48989794855663561963945681494118
        ttable.7.9         0.87177978870813471044739639677192

        slave.channels            10
        slave.pcm                {
            type                multi

            slaves.a.pcm        "main"
            slaves.a.channels    8
            slaves.b.pcm        "zone"
            slaves.b.channels    2

            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
            bindings.6.slave    a
            bindings.6.channel    6
            bindings.7.slave    a
            bindings.7.channel    7

            bindings.8.slave    b
            bindings.8.channel    0
            bindings.9.slave    b
            bindings.9.channel    1
        }
    }
}
Reply
Thanks for sharing this, I will try it out. I have the same requirements to drive a zone 2 and this method is preferable to using custom dual audio builds from http://forum.kodi.tv/showthread.php?tid=192480
Leopold's Repository: Home of LibreELEC Dev Updater ...
Reply
Works perfectly in OpenELEC 4.2.1 on an Acer Revo 3610.
Leopold's Repository: Home of LibreELEC Dev Updater ...
Reply
  • 1
  • 11
  • 12
  • 13
  • 14(current)
  • 15

Logout Mark Read Team Forum Stats Members Help
Almost solved: PROPER Dual Audio on Linux1