I have no problems with sound when first starting up, but if I leave it alone for a few hours and come back I get no sound. The only way I've found to fix it is by logging out and logging back in.

Any suggestions for how to stop this from happening or failing that to quickly restart sound without having to log out?

I'm using Ubuntu 12.04 and LXDE although the same problem happens in Gnome and Confluence. It is connected to a TV via HDMI and the sound should come through the TV speakers.

I tried the troubleshooting tips at the top of the forum, and I've looked on Google a lot, but not found anything that helps.

speaker-test looks like it is working, but I don't get any sound.
lspci - finds the card fine
aplay -l also shows the card
pulseaudio -k doesn't help
alsactl init also doesn't help

Any suggestions gratefully received!