vol=75
chan=`amixer controls | grep Volume | head -n1 | cut -f1 -d',' | cut -f2 -d'='`
amixer cset numid=$chan -- ${vol}% > /dev/null
Plugging the 3.5mm jack into the HDMI display.
Note that there might need to be some further setup to get things working consistently.
Maybe this in /boot/config.txt?
hdmi_drive=2
A known issue. I think the HDMI audio 'goes to sleep' when not in use.
I believe the following solves it by making hdmi audio always 'on' (src):
vcgencmd force_audio hdmi 1
This can be added to the rc.local file so that it's executed at bootup.