I had the annoying experience of un-plugging in my earphones from my computer and losing audio from the internal speakers on my computer. In System Preferences the output and input were the internal speakers. So, there should have been audio coming from my computer, but nope!
Here's what finally fixed it. Open Activity Monitor, type coreaudiod in the search box at the top-right, and click the Force Quit button to manually kill the process.
I didn't have to do anything after that. It seems like coreaudiod re-booted itself and now the sound is working from my computer again.
Hooray.