Reviving this thread since it’s something I was interested in and solved…
Summary: I wanted to output PCM streams to both HDMI and USB (from my RPi) in order to control different zones. The solution is simply to clone the stream and output it to the different devices by using a custom ALSA configuration in /etc/asound.conf. The following is my file which should work for any RPi, however on different devices the card and device assignment may be different:
pcm.!default {
type plug
slave {
pcm "both"
}
}
pcm.both {
type route
slave {
pcm multi
channels 4
}
ttable.0.0 1.0
ttable.1.1 1.0
ttable.0.2 1.0
ttable.1.3 1.0
}
pcm.multi {
type multi
slaves.a {
pcm "hdmi_hw"
channels 2
}
slaves.b {
pcm "digital_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
}
pcm.hdmi_hw {
type hw
card 1
device 1
channels 2
}
pcm.digital_hw {
type hw
card 0
device 1
channels 2
}
This configuration can be expanded to as many devices as are present by increasing the channel count and corresponding ttable entries, adding new slaves and binding them then finally defining the additional hardware devices.
Additionally, you need to change MPD configuration in /etc/mpd.conf. Unfortunately right now the web GUI doesn’t list “default” as an MPD output option, so you’ll have to modify the file by hand and make sure it doesn’t get overwritten. The only change is the to “device” parameter in the “audio_output” section:
audio_output {
type "alsa"
name "Output"
device "default"
dop "no"
}
Hope this helps someone.