I found that I had to do both of the things suggested above. 1. hdmi_drive=2 in config.txt 2. -Raspi-config -advanced -audio -force hdmi
If I just did one or the other, it wouldn't work. I did have one situation where I couldn't get it to work have doing a lot of messing around with things and had to reflash by card. The link below is a further discussion of my many audio issues.
I have been searching and attempting to get the HDMI to use audio. I've attempted these steps and have not been successful.
At this point, I have tried every possible combinations of using: --sudo amixer cset numid=3 2 --setting /boot/config.txt hdmi_drive=2 hdmi_force_edid_audio=1 hdmi_force_hotplug=1 --configured raspi-config to use HDMI
Still unable to get sound out of the HDMI, but sound still works from the composite port.
Hopefully this thread is still alive (noting the last date posted...) Thanks for any insight.