I was having the issue where HDMI sound is not working on Ubuntu. Turns out its a pretty common problem.
Make sure the HDMI cable is connected.
First we will find out the details of the HDMI device.
$ aplay -l
card 0: Intel [HDA Intel],
device 0: ALC887 Analog [ALC887 Analog]
Subdevices: 0/1
Subdevice #0:
subdevice #0 card 0: Intel [HDA Intel], device 3: ALC887 Digital [ALC887 Digital] Subdevices: 1/1
Subdevice #0: subdevice #0 card 1: HDMI [HDA ATI HDMI], device 3: HDMI 0 [HDMI 0] Subdevices: 1/1 Subdevice #0: subdevice #0
On the HDMI device the card number is 1 & the device number is 3
Now we have two methods to fix it. Try the first one first, if not try the second method.
# The hw:x,y is x = card, y = device
speaker-test -c 2 -r 48000 -D hw:0,3
# let the sound test run out of both speakers then press Ctrl+C to exit
# if that didnt work install this package
sudo apt-get install pavucontrol
The HDMI device should now be listed in the sound settings.
Related External Links: