Simultaneous audio in HDMI and analog with Pulseaudio

I have connected my computer to the TV via HDMI and wanted to play audio simultaneously in the PC speakers and in the home cinema. You can see this solution in the Arch wiki, I just have added the device description for easier identification.

At the beginning of /etc/pulse/default.pa, add:

load-module module-alsa-sink device="hw:0,0" sink_name=analog_output_stereo channels=2
update-sink-proplist analog_output_stereo device.description="PC Speakers - Stereo"

load-module module-alsa-sink device="hw:0,7" sink_name=hdmi_output_surround channels=6 channel_map=front-left,front-right,rear-left,rear-right,front-center,lfe
update-sink-proplist hdmi_output_surround device.description="Home theater - 5.1"

load-module module-combine-sink sink_name=analog_hdmi_surround slaves=analog_output_stereo,hdmi_output_surround channels=6 channel_map=front-left,front-right,rear-left,rear-right,front-center,lfe
update-sink-proplist analog_hdmi_surround device.description="Home theater and PC Speakers - 5.1"

You can get the device id with aplay. “hw:0,7” means the card 0, device 7.

[Read More]