Background
Recently, I have installed Ubuntu on my desktop computer. Everything is good except my HDMI audio does not work. I surfed the Internet but could not find any helpful tips. After a few trial, I found that an official NVIDIA driver can solve the problem. It might not be a perfect one but works for me with some awareness. The same problem might happen again after some system update. If so, you just need to reinstall the driver again.
Hope this blog can help persons like me. Let's start.
Select the correct Audio Output Device
If you find the HDMI audio not working, make sure you select the right output device from Settings -> Sound
If you cannot find the HDMI audio device here, you need to download a suitable linux driver from NVIDIA.
For my case, i got the driver like this. (make sure select the suitable one for you)
You should get something like
Install the Driver under terminal
After all you should find the HDMI device in Output Device list under Audio Settings. Good Luck