Sometimes (say 25% of the time) when I boot Ubuntu 16.04, or have it running with no sound playing for a short while, if I then try to play any kind of sound (e.g. Spotify linux app, YouTube via FireFox, the Test button in Sound Settings) I get no output.
If I check in pavucontrol I can see the active sound application is playing through the correct output device (my HDMI sound output through my GTX 970), but I still have no sound.
The way I have found to get it working is to leave it playing and then open alsamixer, switch to my output device and toggle the supposedly active channel between mute and unmute. Normally 1-3 toggles is sufficient to get it working again. Note this channel is definitely not muted when I view it in any of the sound applications.
I have repeatedly followed the SoundTroubleshootingProcedure (https://help.ubuntu.com/community/SoundTroubleshootingProcedure) and this does not help. I also used to have this same problem in 14.04 but it occurred much more frequently. I never have any sound issues in the Windows 7 side of my dual boot system, so I can only assume this is an Ubuntu issue.
Any suggestions to resolve this problem?
Update: I connected up my headphones to the front panel when I observed the described problem state. I initiated
speaker-test -c2 -t wav and as expected received no ouput from hdmi, despite pavucontrol showing the sound as playing. However, switching the output to "built in analogue stereo" with pavucontrol gives me the correct sound output through my headset. Switching back to hdmi continues the no sound state from this device.
This makes me think I may have found an issue with the nvidia linux drivers. I'm currently running nvidia-367.35. Any ideas on what I should try?