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
4 Combined Output aka dual audio

If you want to output to all your attached devices in parallel, e.g. HDMI out, analog out and USB sound card, it is enough to do as below:
Step 1: Edit /etc/pulse/default.pa
load-module module-combine-sink sink_name=combined
Step 2: Restart pulseaudio.
killall pulseaudio
xbmc will then pickup the device, it is named combined.


Looks easy enough. Just need confirmation this well be possible in OpenElec. I will have a go when I install my first OpenElec 4.0 Gotham instance.
No, this is not possible in OpenELEC as it does not ship with pulseaudio (by default).
(2014-05-07, 12:43)fritsch Wrote: [ -> ]No, this is not possible in OpenELEC as it does not ship with pulseaudio (by default).

As I feared, so that means no possible relatively easy solutions for dual audio on OpenElec?

I don't think I have the Linux skills to start compiling custom builds of OpenElec etc. Confused

I've just got dual audio output setup and working on OpenElec / Frodo in my living room and kitchen and it works really well. I am now going to lose this when I update to OpenElec / Gotham.
Why openlelec is the only candidate on your list then idk.
(2014-05-07, 12:55)uNiversal Wrote: [ -> ]Why openlelec is the only candidate on your list then idk.

Well I could always go back to using Ubuntu Minimal I guess.
I've gone back to plan A which was to use SqueezeLite. XBMC dual audio output was plan B.

As I couldn't get XBMC and SqueezeLite to share the same HDMI audio output at the same time (which I'd still like to be able to do), I just connected a USB sound card to the OpenElec HTPC in the Living room. This gives me a new sound device under Linux

Code:
front:CARD=Device,DEV=0 - Generic USB Audio Device, USB Audio - Front speakers

Which I can use for the SqueezeLite service. I can then sync the living room and kitchen for music playback in Logitech Media Server. This should also work for me under Gotham. The SqueezeLite service for the kitchen room is running on my WHS server box.

I know the software syncing in SqueezeLite / Slave is not as good as having actual hardware Squeezeboxes, but its playing in sync OK at the moment so fingers crossed.
This is the message I get when trying to start SqueezeLite on the HDMI audio port which XBMC also uses

Code:
/storage/.xbmc/userdata/squeezelite/squeezelite-x86-64 -o hdmi:CARD=PCH,DEV=1 -m 00:00:00:00:00:fe
[15:32:54.302558] test_open:124 playback open error: Device or resource busy
[15:32:54.302620] output_init_common:365 unable to open output device

If I could share the HDMI port for XBMC and SqueezeLite that would be the perfect solution. Here is the thread talking about Squeeze on the OE forum

Thanks

EDIT: Using the -r rate switch for SqueezeLite seems to be one solution, I have a fully working setup now as shown here
When I upgraded from Frodo to Gotham I thought I would give the pulse audio server a try and I am having some issues I would like to get some feedback on.

First a little system background:

PC - Zotac Nano ID61
OS - Ubuntu 14.04 LTS with all latest updates
Receiver - Onkyo TX-NR737

I have a 7.1 Channel setup in my primary zone and a zone2 stereo setup. The onkyo receiver only allows analog sources for zone2.

On Frodo I was running the alsa configuration from this thread with no issues. In my main room I could achieve 7.1 channel PCM or Passthrough from any video source through the HDMI to the receiver. I could also enable zone 2 and get 5.1 audio in the main room and 2 channel stereo from the 3.5mm jack on the PC which allowed me to output the same audio in both rooms.

Upon upgrading and trying the Pulse audio server I have been able to enable both zones as described in the new audio wiki. One note here is that I was only able to get the second zone working by adding the following to my /etc/pulse/default.pa file:

### Load analog device
load-module module-alsa-sink device=hw:0,0
load-module module-combine-sink sink_name=combined
set-default-sink combined

I couldn't just add "load-module module-combine-sink sink_name=combined" to the file and achieve dual output.

I was then able to get dual audio working using the multichannel setup from the audio wiki. I did not like how Pulse audio re-sampled multchannel video sources. It put way too much voice in the rear channels. So I decided to go with the passthrough option from the audio wiki.

This is where I am now having a problem. It seems I can either get passthrough or dual audio to work and not both. When I get dual audio working I can output music to all speakers in both zones but I get no audio from any movies that have multichannel audio. Conversely if I get passthrough working i lose the ability to output from both the HDMI and the 3.5mm jack simultaniously.

I have followed all the instructions in the audio wiki ( http://wiki.xbmc.org/index.php?title=PulseAudio ) with the only exception of the additional lines in the default.pa file outlined above.

I may just default back to my alsa configuration, but it would be nice to get pulse audio working so I could broadcast music to other rooms via my network.

Anyone have any ideas?
Quote:This is where I am now having a problem. It seems I can either get passthrough or dual audio to work and not both. When I get dual audio working I can output music to all speakers in both zones but I get no audio from any movies that have multichannel audio. Conversely if I get passthrough working i lose the ability to output from both the HDMI and the 3.5mm jack simultaniously.

Yes - that is currently not possible with those simple instructions I gave in the wiki. It can be achieved with a more complex PA config, e.g. output 6 channels, downmix for the 2 channel output and encode those to AC3 for the other output.

Quote:I was then able to get dual audio working using the multichannel setup from the audio wiki. I did not like how Pulse audio re-sampled multchannel video sources. It put way too much voice in the rear channels. So I decided to go with the passthrough option from the audio wiki.
Do you really mean "resampling" here? It's not possible to influence the weights of mixing for the PA server, if you talk of remapping.
Quote:Yes - that is currently not possible with those simple instructions I gave in the wiki. It can be achieved with a more complex PA config, e.g. output 6 channels, downmix for the 2 channel output and encode those to AC3 for the other output.

I believe this still causes one of my problems where XBMC does the decode of all channels and passes them to pulse audio for all cases. I was able to get this mode to work. I am interested in using passthrough when I have a 5.1, 6.1, 7.1, DTS or Dolby source. In this configuration the only output necessary is HDMI, but both outputs could be enabled. When the source is stereo (for instance a music file) I would like to output to both the HDMI and the analog sink.


Quote:Do you really mean "resampling" here? It's not possible to influence the weights of mixing for the PA server, if you talk of remapping.

"resampling" may not be the best word. The wiki describes it as having XBMC do the decode. XBMC doing the decode and passing it to the PA server is fine if the source is stereo but when the source is 5.1, 6.1, 7.1, DTS, Dolby, etc... I would like that to be directly passed to the receiver so that the receiver can do the decode as I feel it does a better job than XBMC.
Quote:Yes - that is currently not possible with those simple instructions I gave in the wiki. It can be achieved with a more complex PA config, e.g. output 6 channels, downmix for the 2 channel output and encode those to AC3 for the other output.

After reading your response again setting up this configuration may be what I am looking for as long as the source can be passed directly to the HDMI sync. Can PA decode downmix and encode for the analog sink? Where is the best reference for setting up more complex PA configurations like this? I am not very familiar with PA and would like to learn more. It seams like it can be very powerful if used properly.
The PA FAQ has some basic example on howto use slaves: http://www.freedesktop.org/wiki/Software...#index30h3
Despite that it's not that good to decode and reencode again, not because of the quality, just because of the overhead.

I don't have a complete howto as I learned PA myself in order to code the xbmc sink for pulse :-) - If you find something doable, happy to help and also to update the wiki.
(2014-06-10, 19:41)fritsch Wrote: [ -> ]The PA FAQ has some basic example on howto use slaves: http://www.freedesktop.org/wiki/Software...#index30h3
Despite that it's not that good to decode and reencode again, not because of the quality, just because of the overhead.

I don't have a complete howto as I learned PA myself in order to code the xbmc sink for pulse :-) - If you find something doable, happy to help and also to update the wiki.

Thanks for the info...I'll let you know what I figure out when I get some more time to play with it. For now I will revert to my ALSA configuration until I get some time to experiment more with PA.

It would probably be good to update the wiki to note that dual audio is only possible with PA if you're using multichannel mode with XBMC decoding the source and that it's not possible with passthrough.
done
I am running Gotham with pulse audio removed from my ubuntu 14.04 system. I got ALSA dual audio up and running. I was using an older 7.1 configuration from this forum but on Gotham the setup was buggy unless I selected the fixed audio option. I decided to give stopdatrue's config file a try. Everything seems to work great except I don't get the option to select "all" for output audio device. I can either select HDMI, which works great or Analog, which also works great. Does anyone know how to get the all option to appear in XBMC settings?


(2014-03-13, 12:04)stopdatrue Wrote: [ -> ]No, no weirdness with this configuration.

Yours encoutered weirdness may be due to CPU lack: on Acer revo there is an Atom 330 dual core CPU @ 1.60GHz.

Here the new version:
- Fix: the LFE (subwoofer) were not correctly forwarded on analog stereo output.
- DBII values have been reviewed with last reverse ingeenering values.

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

And here my advancedsettings:

Code:
<audio>
        <resample>0</resample>
        <audiophile>1</audiophile>
        <audiosinkbufferdurationmsec>200</audiosinkbufferdurationmsec>
        <allowtranscode44100>0</allowtranscode44100>
        <streamsilence>1</streamsilence>
</audio>
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15