I take a different approach
what distro are you using pls?
2) are you using pulseaudio?
leaping ahead, go to pavucontrol and config tab and change the pulldown
to select your hdmi device
3) if answer is no and using alsa
leaping ahead set up a .asoundrc file in your home folder/yourname
(note the leading do)
with contents using a formula of
change card to card 0 or card 1 etc
change device to device 1 or 3 or something based on this command
---post your output if you are unsure pls
its likely your analog is hw0:0
its likely your hdmi is card1 devices vary
you may need to try more than one device number
---log out and log back in after changing file