Depending on your setup you might want to configure which device to use for primary sound output once you connect your computer via HDMI . It can either be set to use internal speakers / headphone jack or use the external device, be it a HDTV or projector screen.
To do so, go into the system preferences using the Apple menu on top of the screen. Then click sound to bring up the sound settings window. Navigate to Output and select your preferred device. If connected to HDMI you will be able to see your external device listed here with HDMI listed as device type.
Please note that your computer will remember whatever sound output settings are chosen, so the next time any HDMI device is connected it will revert to those settings unless you change them using the same menu.
Another quick way to access sound settings is by pressing “cmd + space” to bring up spotlight search then typing “Sound” and hitting enter.