(ALSA) How to output sound to Build-In Audio, HDMI and S/PDIF simultaneously?
#1
Hi

aplay -l output:
Code:
**** List of PLAYBACK Hardware Devices ****
card 0: Intel [HDA Intel], device 0: ALC887 Analog [ALC887 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: Intel [HDA Intel], device 1: ALC887 Digital [ALC887 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
card 1: NVidia [HDA NVidia], device 7: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 8: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 9: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

The folloing is short description of my devices:
plughw:0,0 -> Analog Audio
plughw:0,1 -> S/PDIF
plughw:1,7 -> HDMI output

So, my current configuration is to output sound only through HDMI and here is my .asoundrc:
Code:
pcm.!default {
  type plug
  slave {
    pcm "plughw:1,7"
  }
}


Audio Output in XBMC is to "default (ALSA)" and it works fine on my TV, but how to make sound goes to the Analog output and SPDIF, also?

My audio equipment is:
- TV speakers (HDMI)
- Hi-End stereo amplifier (Analog Audio)
- DAC (S/PDIF) - (still don't have this one, but soon I will)

I saw some examples (.asoundrc configurations) from internet about this problem, but they are too complicated.

Reply
#2
Any help?
Reply
#3
Ok. After many hours of googling I found asound's script which works for me. Now, ALSA successfully outputs sound to Analog, S/PDIF and HDMI simultaneously.
There is a minor issue with the script. If using below code for .asoundrc then menu sounds go through HDMI, but if I uncomment "rate 48000" in the Analog section, then menu sounds go through Analog output only. It is very strange for me and I cannot find any logic about this behaviour.

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 1.0
        ttable.1.5 1.0
}

pcm.multi {
        type multi
        slaves.a {
            pcm "hdmi_hw"
            channels 2
        }
        slaves.b {
            pcm "digital_hw"
            channels 2
        }
        slaves.c {
            pcm "analog_hw"
            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 1
        device 7
        channels 2
}

pcm.hdmi_formatted {
        type plug
        slave {
            pcm hdmi_hw
            rate 48000
            channels 2
        }
}

pcm.hdmi_complete {
        type softvol
        slave.pcm hdmi_formatted
        control.name hdmi_volume
        control.card 0
}

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

pcm.analog_hw {
        type hw
        card 0
        device 0
        channels 2
#               rate 48000
}
Reply
#4
How does it work with passthrough audio?
Also there is a patch for xbmc in the dev section that allows dual audio output within xbmc.
There is also pulseaudio which allows output to multiple devices, though I have never used it.
Reply
#5
Thanks for a response.

Here is the Audio Configuration within XBMC:
Audio output = Digital (Actually with current asoundrc, it doesn't matter which one is chosen)
Speaker configuration = 2.0
boost volume: on
ac3: off
dts: off
Audio output device = default (ALSA)
Passthrough output device = hdmi (ALSA)

I will take a look at this xbmc's patch.

I have used PusleAudio for about an year, but recently I have many troubles with it (mainly: a delay when start playing some music, and errors in the log file), and I couldn't manage it to work with simultaneous outputs. So, I decided to removed it and stick to ALSA only.
Reply
#6
Were you using paprefs for the multiple audio outputs? That is what I was going to use to try out pulseaudio. It looks like the patch for xbmc wont be compatible with the new audioengine in xbmc so Id like to get this working at a system level, but I keep reading negative things about pulseaudio, just like your experience...
Reply
#7
My HTPC is headless running Archlinux without any graphical environment, so I configured PulseAudio only through ssh.

After having troubles with PulseAudio I read Pros/Cons of it. It makes no sense to continue using it, because I can't take advantage of its Pros, and ALSA is closer to the hardware than PulseAudio.


However, if PulseAudio worked fine I wouldn't touched anything.

Just try PulseAudio, and may be it will work fine for you Smile
Reply
 
Thread Rating:
  • 0 Vote(s) - 0 Average



Logout Mark Read Team Forum Stats Members Help
(ALSA) How to output sound to Build-In Audio, HDMI and S/PDIF simultaneously?00