• 1
  • 2(current)
  • 3
  • 4
  • 5
  • 15
Linux Almost solved: PROPER Dual Audio on Linux
#16
Okay -- so this was a simple thing to solve...I should have done more guessing and checking.

I realized that my HDMI audio out was on the second HDMI channel (device 7). So in my case, I needed to change the asound.conf setting to:

Code:
# HDMI output
pcm.hdmi_hw {
        type hw
        card 1
        device 7
        channels 6
}

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

And then when I changed the "Audio Output Device" to the "default", it worked!

This is brilliant and well worth the switchover from Windows to Linux that I did to get this functionality in Frodo.

A job VERY well done, puntloos!!
One last thing for anyone who comes across this thread -- if you allow passthrough audio, you won't get the dual channels when playing DTS/HD audio streams (which makes sense, sense the audio is sent straight to the AVR).

I'm guessing this means you need to disable all of the receiver specific settings in the Audio Output section (DTS, TrueHD, etc.) so that the audio stream is forced to be transcoded by XBMC and not the receiver.
Reply
#17
did you ever try to solve it in a more generic way using pulseaudio ? I didn't have had to hack one single config file to get work like you ...

Greetz

LastCoder
HTPC Specs: Silverstone GD05B Case, ASUS P8H61-M LE/USB3, i5-3470S, GT1030, 8 GB RAM , 2 TB HDD, iHOS104 BluRay Drive, TT DVBS2-1600, Sony PS3 BD Remote control
PS3 BD Remote Control Daemon for Kodi/Linux
UNCHAINED Demo Group
Reply
#18
@ LastCoder

If you have a method and how-to to get it working with pulseaudio, feel free to post it.

Only ppl with full desktop installs have pulseaudio, otherwise pulseaudio is neither needed or installed in some distros. e.g. IIRC Openelec or Ubuntu minimal.

uNi
Reply
#19
This looks very good. I asked about this ealier, before finding this thread, here: http://forum.xbmc.org/showthread.php?tid=148968

Can you tell me if this works on all hardware? I am planning to buy a Zotac Nano AD12.
I really need audio for my kids via ZOTAC -> HDMI -> TV (my kids don't mind surround)
And for myself ZOTAC -> Optical out -> Receiver ( I just lower down the Volume on my TV).

Other question: What about the delay? Will there be an echo and will that me much?
For reference: I have a popcornhour C200 now and when I have audio trough tv and receiver I can hear a really small echo.
But this is so small, it's almost impossible to see lipsync issues, so I even don't have to adjust it.
GLAD, because I can't adjust this on my receiver.
Reply
#20
Who know is this works in all hardware? No one really. It probably does but it probably doesn't, either way no one can answer that unless they have your exact hardware and have tried this.

As for delay and echo, I can tell you 100% for sure that your TV and receiver will never be in sync this is why you get the echo no matter how small it is.

My advice is turn the TV sound off (mute) and use receiver only.
Either way if you not using receiver or tv turn whicevr one is not in use volume off or mute so you dont get any echo.

Other issues you have that are not dual audio related Smile, ask in your own thread. nobody wants to read a thread that will end up 200 pages long and read about unrelated issues just to get a fix to something related.

uNi
Reply
#21
I am running raspbmc on a Pi, but when I run aplay -l I get:

aplay: device_list:252: no soundcards found...

Any hints?
Reply
#22
Yes, google...

uNi
Reply
#23
Puntloos -- curious if you ever found a fix for the buffering issues you were seeing. I've noticed while listening to Pandora this evening that the audio does cut out for a brief moment every 5 minutes or so, which sounds similar to what you were describing. I'm going to try with some different sources to see if it's consistent, but thought I'd see if you ever found a fix for that issue before I get too far down the line...
Reply
#24
Puntloos thank you for sharing this information. Before reading your post, I doubted about moving from Openelec 2 (EDEN) to Openelec 3 (FRODO) due to limitations of dual audio support. For my current set up (HDMI for video + SPDIF DAC for music) I require dual audio support.
I still have one question regarding your configuration: does it resample mp3 and flac audio to 48 kHz with a bit resolution of 16 bits or is it possible to keep the samplerate and bit resolution of the original file (mp3 or flac). Because I use a DAC I prefer the latter (Big Grin)
Reply
#25
I've been following this thread as I've had this issue for some time. I wanted to add one thing I did slightly differently. I use both MPD (through ALSA) and XBMC. When using this basic approach to get dual audio it causes a problem because the new devices are not shareable. So, when MPD tries to play it gets an error that it can't access the sound device. To avoid this problem, you have to use the dmix plug-in. This is what my .asoundrc looks like to do that:

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

pcm.both {
  type route
  slave {
    pcm multi
    channels 6
  }
  ttable.0.0 1.0
  ttable.1.1 1.0
  ttable.0.2 1.0
  ttable.1.3 1.0
  ttable.0.4 0.5
  ttable.1.4 0.5
  ttable.0.5 0.5
  ttable.1.5 0.5
}

pcm.multi {
  type multi
  slaves.a {
    pcm "hdmi_dmix"
    channels 2
  }
  slaves.b {
    pcm "digital_dmix"
    channels 2
  }
  slaves.c {
    pcm "analog_dmix"
    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
  bindings.4.slave c
  bindings.4.channel 0
  bindings.5.slave c
  bindings.5.channel 1
}

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

pcm.digital_hw {
  type hw
  card 0
  device 1
  channels 2
}

pcm.analog_hw {
  type hw
  card 0
  device 0
  channels 2
}

pcm.hdmi_dmix {
  type dmix
  ipc_key 1024
  slave {
    pcm "hdmi_hw"
    rate 48000
  }
}

pcm.digital_dmix {
  type dmix
  ipc_key 1025
  slave {
    pcm "digital_hw"
    rate 48000
  }
}

pcm.analog_dmix {
  type dmix
  ipc_key 1026
  slave {
    pcm "analog_hw"
    rate 48000
  }
}

One issue I still have is with non-48KHz audio. I know I need to re-sample it to 48Khz but I can't figure out a way to do that reliably. I've tried using advancedsettings.xml and various changes to the .asoundrc but nothing seems to work.
Reply
#26
When I installed frodo, the .asoundrc was already set for dual audio. I just had to change the device from 1,3 to 1,7 and it worked. But I have a strange problem. When the volume is on maximum, it works properly on HDMI and analog output. When I lowered the volume, it started crackling.
Does anybody knows what could be the problem?
Thank you
Reply
#27
Hi all - sorry I didn't respond earlier, for some reason the forum stopped sending me email notifications.

Let me respond to a few people in one massive post. I've also updated my original post. =)

(2012-12-21, 09:44)botez Wrote: This is brilliant and well worth the switchover from Windows to Linux that I did to get this functionality in Frodo.
A job VERY well done, puntloos!!

Great to hear! If you have any suggestions of stuff that I should mention in my original post then let me know.

(2012-12-21, 09:44)botez Wrote: One last thing for anyone who comes across this thread -- if you allow passthrough audio, you won't get the dual channels when playing DTS/HD audio streams (which makes sense, sense the audio is sent straight to the AVR).

I'm guessing this means you need to disable all of the receiver specific settings in the Audio Output section (DTS, TrueHD, etc.) so that the audio stream is forced to be transcoded by XBMC and not the receiver.

Exactly, and that is what I'm doing. More specifically I configure XBMC to think my receiver ONLY supports LPCM. There is no audio quality downside to this (or at least there shouldn't be).. maybe a bit of extra processing power needed on your XBMC to decode, so people with crap CPUs might be out of luck. The upside is exactly as you said, plus audio postprocessing (volume, night mode) works. Of course also, your receiver needs to support LPCM

(2012-12-21, 13:03)LastCoder Wrote: did you ever try to solve it in a more generic way using pulseaudio ? I didn't have had to hack one single config file to get work like you ...

Nope, I don't have pulseaudio, like others said only "complete" linux installations have this - and even then it is mostly optional.
Would love to see a description of your setup though, how did you get it to work, what settings, if any?

(2012-12-21, 15:45)JeeGee Wrote: Can you tell me if this works on all hardware? I am planning to buy a Zotac Nano AD12.
I really need audio for my kids via ZOTAC -> HDMI -> TV (my kids don't mind surround)
And for myself ZOTAC -> Optical out -> Receiver ( I just lower down the Volume on my TV).
Of course I can't promise this works on all hardware, too many possible combinations. I can say that if your hardware is supported by asound (i.e. if you can find someone who says it works) then this likely is just a modification that should also work. As always a good bet is to look on the internet to find someone reporting 'everything works' and then copying their hardware setup =)
(2012-12-21, 15:45)JeeGee Wrote: Other question: What about the delay? Will there be an echo and will that me much?

For reference: I have a popcornhour C200 now and when I have audio trough tv and receiver I can hear a really small echo.
But this is so small, it's almost impossible to see lipsync issues, so I even don't have to adjust it.
GLAD, because I can't adjust this on my receiver.

You mean you .. ohh.. I think I see what you're trying to do there.. interesting.
In my current setup I have an audiophile DAC (for music) and a surround receiver (for movies) but indeed why not always use the DAC, even for movies. Like uNiversal says though, you are probably adding extra complexity to the system which makes delay/echo more and more likely. Fun fact, hardware devices even slowly start to desync naturally because of slight differences in accuracy of their internal clocks.

But to answer your question: I don't know. I have not tried this. I could imagine including a buffer in the device that is too early might actually delay it, or maybe asound.conf supports delays somehow but a quick google has not shown me anything yet. Feel free to let me know if you fix it =)

(2012-12-22, 08:29)botez Wrote: Puntloos -- curious if you ever found a fix for the buffering issues you were seeing. I've noticed while listening to Pandora this evening that the audio does cut out for a brief moment every 5 minutes or so, which sounds similar to what you were describing. I'm going to try with some different sources to see if it's consistent, but thought I'd see if you ever found a fix for that issue before I get too far down the line...
Nope not from my side, I haven't had time to look into things much. Did you try multiple sources? It's easy to have your dropouts caused by the fact that you're streaming from the net.

(2013-01-07, 23:46)Hawaltie Wrote: Puntloos thank you for sharing this information. Before reading your post, I doubted about moving from Openelec 2 (EDEN) to Openelec 3 (FRODO) due to limitations of dual audio support. For my current set up (HDMI for video + SPDIF DAC for music) I require dual audio support.
I still have one question regarding your configuration: does it resample mp3 and flac audio to 48 kHz with a bit resolution of 16 bits or is it possible to keep the samplerate and bit resolution of the original file (mp3 or flac). Because I use a DAC I prefer the latter (Big Grin)

I don't see any reason why my asound.conf would up/downsample. No frequency numbers in that file =) It's quite possible that XBMC might get cheeky and do up/downsampling elsewhere but I believe if you set audiophile=1 in advancedsettings.xml that shouldn't happen.

(2013-01-08, 00:29)tknorris Wrote: I've been following this thread as I've had this issue for some time. I wanted to add one thing I did slightly differently. I use both MPD (through ALSA) and XBMC. When using this basic approach to get dual audio it causes a problem because the new devices are not shareable. So, when MPD tries to play it gets an error that it can't access the sound device. To avoid this problem, you have to use the dmix plug-in.
Curious, why is the dmix plugin better than the original when it comes to sharing? Or is it because MPD requires 48K?
(2013-01-08, 00:29)tknorris Wrote: One issue I still have is with non-48KHz audio. I know I need to re-sample it to 48Khz but I can't figure out a way to do that reliably. I've tried using advancedsettings.xml and various changes to the .asoundrc but nothing seems to work.
Try my step #3 and #4 from the original post. Maybe it is because weird stuff happens in XBMC if your system switches to passthrough

(2013-01-31, 21:36)bselva Wrote: When I installed frodo, the .asoundrc was already set for dual audio. I just had to change the device from 1,3 to 1,7 and it worked.

This is surprising to me, can anyone confirm that the OpenELEC guys have included my asound.conf into the distribution? I have no objections to this btw, just that I haven't seen this myself. I know there are a few advanced asound.conf sample files there but they are not activated out of the box, nor do they fully achieve dual surround audio.

(2013-01-31, 21:36)bselva Wrote: But I have a strange problem. When the volume is on maximum, it works properly on HDMI and analog output. When I lowered the volume, it started crackling.
Does anybody knows what could be the problem?

That's surprising. Where do you lower the volume? With XBMC or with your receiver/DAC?
System: Kodi on NVidia Shield 2015
Video: Panasonic AE3000 Projector / Samsung 46" LCD
Audio: Quad 2912 on Nord DM500Up with Marantz 7010 receiver.
Reply
#28
Thank you puntloos! These are the answers I was waiting for. I will try your guide immediatly!
Reply
#29
For some reason I am not able to select the audio device 'default'. The system settings only show 3 devices, HDMI, SPDIF and Analog and no default.
My current config is:
- ZBox AD12
- Openelec 2.99.2
This fix (2097 (PR)) on github seems to be related.
Reply
#30
(2013-02-01, 22:13)Hawaltie Wrote: For some reason I am not able to select the audio device 'default'. The system settings only show 3 devices, HDMI, SPDIF and Analog and no default.
My current config is:
- ZBox AD12
- Openelec 2.99.2
This fix (https://github.com/xbmc/xbmc/pull/2097) on github seems to be related.

Your link doesn't work.

But anyway, not seeing any new devices typically has one of 2 reasons:

1/ asound.conf in the wrong place.(maybe it has changed)
2/ parsing error of asound. Hmm I did make some changes to my original post today but I don't think I touched the actual conf file.

Make sure the file is in the right place, and perhaps try with a few versions posted in this thread to see if you can make it show the device.
Tip: you dont have to fully reboot xbmc - just kill the xbmc.bin process
System: Kodi on NVidia Shield 2015
Video: Panasonic AE3000 Projector / Samsung 46" LCD
Audio: Quad 2912 on Nord DM500Up with Marantz 7010 receiver.
Reply
  • 1
  • 2(current)
  • 3
  • 4
  • 5
  • 15

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