If occasionally your sound stops working, you can try to restart the sound server:
sudo /etc/init.d/alsa-utils restart
If this doesn’t work, try to kill the processes that block it:
1) Identify them:
lsof | grep pcm
example output: esd 5080 name 70u CHR 116,6 13639 /dev/snd/pcmC0D0p
2) kill ’em:
kill -9 5080
3) restart alsa:
sudo /etc/init.d/alsa-utils restart
That should do the trick. Thanks to the person who posted it here.