Here is simple guide to resolve sound problems on macOS. In this guide I will use Terminal to reload the sound driver kext without need to restart the operating system.
sudo kextunload /System/Library/Extensions/AppleHDA.kext
sudo kextload /System/Library/Extensions/AppleHDA.kext
In most cases the common problems with audio driver occurs after waking macOS from sleep. These two commands will reload the sound driver, so it will imediately start working again.