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
Yes, I'm running openelec.
(2013-05-16, 12:38)puntloos Wrote: [ -> ]The problem is that the stereo channel currently is the 'sum of all channels' - meaning that indeed sound that is 100% rear also comes through my front speakers.
Perhaps this is what someone might want who wants to watch a movie on a stereo system, but in MY case I have different needs. My intended setup (or one of them, at least) will only send front left, center and front-right to the stereo channel. The trouble though is that with mixing multiple channels (especially 5.1 or 7.1) into two means you could go over the channel's limit. You need to pre-amplify (or rather attenuate) the channels before mixing, else you might run into clipping IF the mix is already pretty loud, which is common for TV shows and uncommon for movies.

This is why Matthias T for example used this mixing matrix:
Code:
# Different routing setting taken from http://wiki.ubuntuusers.de/.asoundrc
  ttable.0.0 1
  ttable.1.1 1
  ttable.2.0 0.707
  ttable.3.1 0.707
  ttable.4.0 0.5
  ttable.4.1 0.5
  ttable.5.0 0.5
  ttable.5.1 0.5

Suggest you try something like this and report back =)

Hmmm, this is different to my understanding of how that table works. I thought my setup was sending only channel 0 and 1 to stereo, meaning front right and left only, then sending 7.1 (channels 0, 1, 2, 3, 4, 5, 6, 7, 8) over HDMI. At least that's how it seems to be when I tested it but I could be completely wrong.

(2013-05-16, 15:24)puntloos Wrote: [ -> ]On another note, has anyone figured out how XBMC decides on the names for the audio output device in Settings -> System -> Audio ?
I'd love it to actually be more descriptive than "Default". (Dual-Audio sounds good...)

In my setup it is called 'Mixed' in XBMC.
(2013-05-16, 23:46)omobeanz Wrote: [ -> ]
(2013-05-16, 12:38)puntloos Wrote: [ -> ]The problem is that the stereo channel currently is the 'sum of all channels' - meaning that indeed sound that is 100% rear also comes through my front speakers.
Perhaps this is what someone might want who wants to watch a movie on a stereo system, but in MY case I have different needs. My intended setup (or one of them, at least) will only send front left, center and front-right to the stereo channel. The trouble though is that with mixing multiple channels (especially 5.1 or 7.1) into two means you could go over the channel's limit. You need to pre-amplify (or rather attenuate) the channels before mixing, else you might run into clipping IF the mix is already pretty loud, which is common for TV shows and uncommon for movies.

This is why Matthias T for example used this mixing matrix:
Code:
# Different routing setting taken from http://wiki.ubuntuusers.de/.asoundrc
  ttable.0.0 1
  ttable.1.1 1
  ttable.2.0 0.707
  ttable.3.1 0.707
  ttable.4.0 0.5
  ttable.4.1 0.5
  ttable.5.0 0.5
  ttable.5.1 0.5

Suggest you try something like this and report back =)

Hmmm, this is different to my understanding of how that table works. I thought my setup was sending only channel 0 and 1 to stereo, meaning front right and left only, then sending 7.1 (channels 0, 1, 2, 3, 4, 5, 6, 7, 8) over HDMI. At least that's how it seems to be when I tested it but I could be completely wrong.

Well no this is a different step. What my quote does is downmixing to stereo. I'm not sure if that is exactly what you want mind you, (or if it does what Matthias wants) but the point is that what you describe sounds like the "sum of the data" you are sending to read exceeds the maximum, so to fix your problem I think you need to 'send less' somehow.

At least that's my theory on what you're hearing. I could be completely wrong too, but just to experiment I would suggest just dropping all inputs to the channels you find distorted to half.
(2013-05-16, 23:49)puntloos Wrote: [ -> ]Well no this is a different step. What my quote does is downmixing to stereo. I'm not sure if that is exactly what you want mind you, (or if it does what Matthias wants) but the point is that what you describe sounds like the "sum of the data" you are sending to read exceeds the maximum, so to fix your problem I think you need to 'send less' somehow.

At least that's my theory on what you're hearing. I could be completely wrong too, but just to experiment I would suggest just dropping all inputs to the channels you find distorted to half.

Yeah, looking at the description of ttables on the Alsa page I think I'm doing exactly what I want to do for my set up. I really only want analog stereo output (front right and left) for my amplifier's zone 2 as that has no DAC. The speakers for that are outside on the patio and I only use them for playing music. In this scenario I think my config works great and I don't need/want down-mixing. The issue I hear with the strained audio is just when watching a movie or show inside (5.1 digital only, no zone 2 active). I will test and see if the system is maybe under high load when this happens although it is a fairly powerful HTPC.
(2013-05-17, 00:39)omobeanz Wrote: [ -> ]
(2013-05-16, 23:49)puntloos Wrote: [ -> ]Well no this is a different step. What my quote does is downmixing to stereo. I'm not sure if that is exactly what you want mind you, (or if it does what Matthias wants) but the point is that what you describe sounds like the "sum of the data" you are sending to read exceeds the maximum, so to fix your problem I think you need to 'send less' somehow.

At least that's my theory on what you're hearing. I could be completely wrong too, but just to experiment I would suggest just dropping all inputs to the channels you find distorted to half.

Yeah, looking at the description of ttables on the Alsa page I think I'm doing exactly what I want to do for my set up. I really only want analog stereo output (front right and left) for my amplifier's zone 2 as that has no DAC. The speakers for that are outside on the patio and I only use them for playing music. In this scenario I think my config works great and I don't need/want down-mixing. The issue I hear with the strained audio is just when watching a movie or show inside (5.1 digital only, no zone 2 active). I will test and see if the system is maybe under high load when this happens although it is a fairly powerful HTPC.

No this is not a CPU issue, if I am correct it is a clipping issue.

What you should try is to reduce volume across the board. Just multiply every channel by 0.5 as a start.
Hi everyone,

I also had a perfect dual audio setup for my zone 2 under Eden that I miss so much ! I have not tested yet the "asoundrc" proposed here, it seems not to be fully working. Also, I was thinking of a hardware solution.

What do you think of that :

ViewHD-Analog-Conv. ?

It seems that the feedback is godd but is it really HDCP compliant, is the HDMI signal not altered ?
Guess I missed a step somewhere,

But one when I put the .asoundrc file in my homedir. I don't see the audio output device mixed; actually there is no change at all.
Any hints on what trivial step I must have forgotten ?

(did have it working under Eden on XBMCbuntu; upgraded last night from that to Frodo)

Aplay only shows the "old" devices:

**** 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: 1/1
Subdevice #0: subdevice #0
(2013-05-27, 13:27)dragonfly28 Wrote: [ -> ]Guess I missed a step somewhere,

But one when I put the .asoundrc file in my homedir. I don't see the audio output device mixed; actually there is no change at all.
Any hints on what trivial step I must have forgotten ?

(did have it working under Eden on XBMCbuntu; upgraded last night from that to Frodo)

Aplay only shows the "old" devices:

**** 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: 1/1
Subdevice #0: subdevice #0

Did you restart XBMC and then try edit the audio? You won't see the asoundrc changes with 'aplay -l'.
I've restarted XBMC and rebooted the machine.

I'm not sure what you mean by edit the audio. I've tried to change the audio settings from within XBMC but no new options are available. (i.e. same output options and output devices as before).

When I tried testing from the commandline with aplay -D xbmc test.wav or speakertest I got an error that xbmc device could not be found. (I'm @work now, but will update post with proper error message when I'm home)
To me it looks like the .asoundrc is somehow not loaded or properly read in.
Can someone post a working asound.conf on OpenElec 3.03. I have tried all I could find and adjust my HW but no luck:

aplay -1 shows:

**** List of PLAYBACK Hardware Devices ****
card 0: Generic [HD-Audio Generic], device 3: HDMI 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: SB [HDA ATI SB], device 0: ALC892 Analog [ALC892 Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: SB [HDA ATI SB], device 1: ALC892 Digital [ALC892 Digital]
Subdevices: 1/1
Subdevice #0: subdevice #0
to clarify my earlier post. (messed up the aplay -D xbmc test.wav part)

used the code you (omobeanz) describes on page 8. I changed the digital to:

Code:
pcm.digital-hw {
        type hw
        card 0
        device 1
}
To reflect my setup.

So no changes visible within XBMC. Testing with: aplay -D mixed /usr/share/sounds/alsa/Front_Center.wav

Results in the following error:

Playing WAVE '/usr/share/sounds/alsa/Front_Center.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
ALSA lib pcm_params.c:2162Sadsnd1_pcm_hw_refine_slave) Slave PCM not usable
aplay: set_params:1037: Broken configuration for this PCM: no configurations available

If try to use multi, the following similar error shows:
Playing WAVE '/usr/share/sounds/alsa/Front_Center.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
aplay: set_params:1037: Broken configuration for this PCM: no configurations available

I also tried puntloos' approach with the asound.conf from the first page, but again no changes visible within xbmc. /puzzled
Hey dragonfly, that's not quite right, your digital card is the HDMI one in this case. From your aplay output it should be something like:

pcm.analog-hw {
        type hw
        card 0
        device 0
}

ctl.analog-hw {
        type hw
        card 0
}

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

ctl.digital-hw {
        type hw
        card 1
}
hmm I tried your change, but unfortunately nothing is changed.
Still no changes in XBMC and same errors with aplay command.
Maybe I need to edit another file to get .asoundrc "activated" ?
(2013-05-29, 17:36)Bjur Wrote: [ -> ]Can someone post a working asound.conf on OpenElec 3.03. I have tried all I could find and adjust my HW but no luck:

aplay -1 shows:

**** List of PLAYBACK Hardware Devices ****
card 0: Generic [HD-Audio Generic], device 3: HDMI 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: SB [HDA ATI SB], device 0: ALC892 Analog [ALC892 Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: SB [HDA ATI SB], device 1: ALC892 Digital [ALC892 Digital]
Subdevices: 1/1
Subdevice #0: subdevice #0

Anyone that can give a hint?
(2013-06-01, 08:31)Bjur Wrote: [ -> ]Anyone that can give a hint?

Bjur,

It seems that we have a similar config. This is my asound.conf offering audio on both HDMI and SPDIF. It works on OE 3.0.3

Code:
# asound.conf for Dual Audio - HDMI (2.0) + 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 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
}
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15