Silent HDMI sound with NUC6CAYH 16.04

I have an Intel NUC6CAYH connected to a not very new Samsung 42" TV. When I go to sound settings and select "Play sound through" "HDMI / Displayport", the software seems to think everything is OK, but no sound is produced.

I checked that everything is umuted in alsamixer, and pavucontrol shows that sound is being produced.


After much experimentation, I found that putting the display to sleep (e.g. when the screen is turned off after a period of inactivity), waking it, and then restarting pulseaudio makes the sound work until the next reboot.

I'm using the PC as an HTPC that loads kodi at bootup, so I automated this by creating a little script to launch kodi:

#! /bin/sh

xset dpms force off
sleep 1
pulseaudio -k
sleep 1
/usr/bin/kodi -fs

In earlier attempts at fixing the issue I set pulseaudio to never let the sound device sleep (commented out load-module module-suspend-on-idle in /etc/pulse/default.pa), and also set the default sampling rate to 48000 (default-sample-rate = 48000 in /etc/pulse/daemon.conf). Not sure if these settings contributed to the fix, but they are not sufficient on their own.

I also reported a bug against Ubuntu 16.04:

https://bugs.launchpad.net/ubuntu/+source/pulseaudio/+bug/1709708