I got this info from this website: http://www.ivankristianto.com/os/ubuntu/tips-solving-ubuntu-sound-problem-without-restart/440/
Here are the condensed steps.
1. Open your shell and find all process that currently using sound with this command:
lsof | grep pcm
2. After you get all proceess with the proceess id, kill all that process with this command: 3. Restart ALSA (Advanced Linux Sound Architecture) driver with this command: I think this could be automated into a single script with one command.
kill -9
sudo /etc/init.d/alsa-utils restart