Summarize:

OS X Mavericks (10.9) has a lot of problems with sound, many of which were fixed in Yosemite (10.10). El Capitan (10.11) has fixed even more of these problems. Mac updates are free and are available from the Mac App Store. If there are any available system upgrades, they'll be listed here. Download El Capitan if it is listed in the Updates section. The download will likely take a while to complete. Follow the prompts to install the system update. It's a pretty straightforward process, and you won't lose any of your files or settings. Once the update has finished and you're back at your desktop, test your sound again to see if it is working.
Check to see if you are running the latest version. Open the Mac App Store. Click the "Updates" tab. Download the latest version of OS X. Install the system update. Test your sound again.