Sound over HDMI is actually controlled by the video drivers. The video drivers create an "HDMI audio output" device. You select that as your audio playback device and the sound will be piped through HDMI to your display with speakers. Usually it happens automatically when you plug in an HDMI display with speakers (your question usually comes from people trying to get sound to go through direct-connected speakers instead of their TV). But if it doesn't do it automatically, you can set it up manually.
https://www.drivereasy.com/knowledge/fix-hdmi-monitor-has-no-sound-after-windows-10-upgrade/