Yeah even if you didn't alt-tab, it might still not have focus for a number of reasons, in which case there'll be no sound. It could happen randomly if the OS doesn't give it focus, though it's not always obvious/easy to know why, depends on what else is going on on your computer at the time. Can't do anything about that on the game side.