Some TVs / monitors won’t play sound over HDMI when using Raspberry Pi, even if sound from other devices plays fine.
First thing to do is to change the setting to force sound over HDMI using configuration tool. Start configuration tool from terminal by typing
Select option 8 (Advanced Options) from the menu and then select Audio option. Select option to force audio over HDMI and exit configuration tool. You should now have sound over HDMI.
If method above still didn’t help, you’ll need to edit configuration file manually. Go to terminal and navigate to /boot directory. Then edit config.txt file by typing
sudo pico config.txt
Find a line with
and uncomment it (remove # in front). Reboot Raspberry Pi and you should have HDMI sound.