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
Ok I might have found the issue, errors are gone.

2 things that I have done:

- run aplay -l, find the device your HDMI device (in my case it's card 0 device 3)
- open /usr/share/alsa/alsa.conf and replace the existing lines by
defaults.ctl.card NVidia
defaults.pcm.card NVidia
defaults.pcm.device 3
- use puntloos config file, edit it according to your devices:
pcm.hdmi_hw {
type hw
card 0
device 3
channels 2
rate 48000
}

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

- choose "both_digital" in the audio prefs

So far so good, the error is gone, even when I pause, search for subtitles etc... on both hdmi and DAC
Not counting my chickens just yet - but tleej's suggestion appears to have done the job Smile

Tuning to Summer Hits TV has always caused the problem before now, but touching wood it's not this time!

Code:
# asound.conf for Dual Audio - HDMI (2.0) + Stereo out
# originally by puntloos with suggestions by tleej
# 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 6
        }
        # 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
        
        ttable.0.4 1.0
        ttable.1.5 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 "front_hw"
                channels 2
        }
        slaves.c
        {
                pcm "fm_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 Front 3.5mm jack outputs
        bindings.2.slave b
        bindings.2.channel 0
        bindings.3.slave b
        bindings.3.channel 1
        
        # And to the USB FM Transmitter outputs
        bindings.4.slave c
        bindings.4.channel 0
        bindings.5.slave c
        bindings.5.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
         rate 48000
}

# Stereo output
pcm.front_hw {
        type hw
        card 0
        device 0
        channels 2
         rate 48000
}

pcm.fm_hw {
        type hw
        card 1
        device 0
        channels 2
         rate 48000
}

EDIT - Damn spoke too soon - after a restart of xmbc due to another issue the log is absolutly full of them - worse than ever before. No more roughness but instead complete dropouts on either tv or fm Sad
Hi I got some confusing issue with the setting. I hope somebody can help me with it. I have a media player with OpenELEC 3.0.6 using AMD GPU. I had connect the hdmi to tv and the optical to the 5.1 theater system. If I use the code below where it only have 2 channels everything fines but if i play 5.1 sound movie some of the sound missing only the background music come out from my 5.1 speaker. But if i edit the code to 5.1 channels shows as 2nd code the 'default' won't show no matter how i keep on restart

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
}


pcm.hdmi_hw {
        type hw
        card 0
        device 3
        channels 2
}

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

Here is the 2nd code where the 'default' option won't come out.

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

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

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


pcm.hdmi_hw {
        type hw
        card 0
        device 3
        channels 2
}

# Stereo output
pcm.dac_hw {
        type hw
        card 1
        device 0
        channels 6
}
After I got this to work all the way back on page 2 of this thread (using puntloos asound.conf), I stopped using it almost immediately due to the audio cutting out for about 1 second every 5 minutes or so, regardless of the source (video, music, HD, flac, mp3...). The accompanying lines are in my log file everytime this happens are:

23:22:38 T:140179558856448 INFO: CAESinkALSA - ALSA: pcm_hw.c:535Sadsnd_pcm_hw_hwsync) SNDRV_PCM_IOCTL_HWSYNC failed (-32): Broken pipe
23:22:38 T:140179558856448 ERROR: CAESinkALSA::HandleError(snd_pcm_avail) - underrun
23:22:38 T:140179558856448 ERROR: CSoftAE::WriteSink - sink blocked- reinit flagged
23:22:38 T:140179558856448 DEBUG: CSoftAE::Run - Sink restart flagged

Is anyone else seeing anything like this when using dual audio? Any ideas on a fix?
(2013-07-08, 22:51)kevjs1982 Wrote: [ -> ]EDIT - Damn spoke too soon - after a restart of xmbc due to another issue the log is absolutly full of them - worse than ever before. No more roughness but instead complete dropouts on either tv or fm Sad

Touching wood here....

I recently tried to install a new DVB-T2 USB adaptor which basically broke two of my three terrestrial tuners and didn't work properly itself either Sad Anyway the flipside of this is that to get my machine working with those tuners I updated the kernel and by necessity the Nvidia drivers and this appears to have solved the issue . Touch Wood.
Just letting you know it worked fine for me on the latest stable Openelec distro. Thanks!

The "default" output device appeared for me as "Default (HDA NVidia HDMI 0)".

My only concern is about my denon showing "Multi in" instead of the correct audio type, but that's happening because I disabled all the passthrough options.
I've tried this but no 'default' option appears in audio settings. Any idea why?[/align]
Well, after reading through this thread yesterday, I got dual audio up and running very quickly. Thanks for all the info!

My setup is Zotac ION-ITX, running OpenElec 3.1.5.
Audio device 1: Polk Soundbar (decodes AC3, but not DTS)
Audio Device 2: Fiio E17 USB/SPDIF DAC

Strangely enough, I accidentally skipped step 3 on the first post (adding entries to AdvancedSettings), but it worked perfectly, and continued to stream audio when silent (my soundbar stopped going to sleep). But when I realized I'd missed a step, and added the entries, my sound went away, and my soundbar went to sleep!


Anyway, I feel like my soundbar has a better soundstage with DD5.1 than 2ch PCM. It doesn't appear to handle multichannel LPCM unfortunately.

Is there any way to have AC3 passthrough for 1 audio device, and 2ch PCM only for the other (DAC)?
For some reason it stopped working in 3.2.0 Sad

Only 1st card visible as Default...

Any ideas?
(2013-07-12, 02:42)maideii Wrote: [ -> ]Hi I got some confusing issue with the setting. I hope somebody can help me with it. I have a media player with OpenELEC 3.0.6 using AMD GPU. I had connect the hdmi to tv and the optical to the 5.1 theater system. If I use the code below where it only have 2 channels everything fines but if i play 5.1 sound movie some of the sound missing only the background music come out from my 5.1 speaker. But if i edit the code to 5.1 channels shows as 2nd code the 'default' won't show no matter how i keep on restart

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
}


pcm.hdmi_hw {
        type hw
        card 0
        device 3
        channels 2
}

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

Here is the 2nd code where the 'default' option won't come out.

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

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

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


pcm.hdmi_hw {
        type hw
        card 0
        device 3
        channels 2
}

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

Maideii, I'm having the same issue with my DCCP847DYE NUC running OpenElelc 3.2. Dual audio out in 2.0 over both HDMI ports works great but as soon as I edit asound.conf to 5.1, "Default" option stops showing up. Any luck in figuring it out?
weird, when using this asound.conf with my card settings I can only see 1st card as default Sad any ideas?
Hello Folks...

Looking for a little help on getting dual audio to work. Tried getting it working with either ~/.asoundrc or /etc/asound.conf and neither work. I had Pulseaudio installed, and have removed it (not sure if completely or not)

Here is my aplay -l

Code:
**** List of PLAYBACK Hardware Devices ****
card 0: NVidia [HDA NVidia], device 0: ALC1200 Analog [ALC1200 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: NVidia [HDA NVidia], device 3: ALC1200 Digital [ALC1200 Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia_1 [HDA NVidia], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia_1 [HDA NVidia], device 7: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia_1 [HDA NVidia], device 8: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia_1 [HDA NVidia], device 9: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Here are the connection details:
ALC1200 Analog is connected to Zone2 (upstairs speakers)
ALC1200 Digital is the optical connection to my receiver for 5.1 surround
HDMI is connected to the TV but I'm not sure which card/device it is, and I'm not sure what command is used in Terminal to find out.

I would love to have triple audio output, but would be happy with dual output mainly for music to be sent to both optical and analog...

Thanks!
puntloos

You are my new best friend! This is a great fix. But I have a noob question:

First, you recommend turning off HDMI passthrough and letting xbmc decode everything. I have a relatively old htpc (an Acer Revo 1600) so I'm concerning about the CPU hit AND based on 10 minutes of testing all of my passthroughs are working. Should I expect this to stop working?

Thanks again. This saved me a ton of recabling to try a second approach to get music back out onto my deck.
So far I have only had success with this in 2.0/2.0 configurations. Looking for a 7.1/2.0 solution or a 7.1/7.1 solution for Frodo for a multi-zone implementation but whenever I introduce this into the asound.conf, "Default" option disappears. And ideas on how to get this to work with the asound.conf or am I barking up the wrong tree?

I have also explored several "external" hardware solutions that split analog audio out but they too downmix the 7.1 to 2.0 on the passthrough. Does anyone know of hardware that can passthrough HDMI 7.1 digital signal and convert/split-off 2.0 analog signal?

Thanks for any help in advance!
(2013-11-04, 17:23)lallhands Wrote: [ -> ]So far I have only had success with this in 2.0/2.0 configurations. Looking for a 7.1/2.0 solution or a 7.1/7.1 solution for Frodo for a multi-zone implementation but whenever I introduce this into the asound.conf, "Default" option disappears. And ideas on how to get this to work with the asound.conf or am I barking up the wrong tree?

I have also explored several "external" hardware solutions that split analog audio out but they too downmix the 7.1 to 2.0 on the passthrough. Does anyone know of hardware that can passthrough HDMI 7.1 digital signal and convert/split-off 2.0 analog signal?

Thanks for any help in advance!

can you share your 2.0/2.0 config please?
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15