I was searching for a solution to this problem and couldn't find any, feel free to close it and point me towards an answered question on this topic if such exist.
So, I've had this issue on multiple PCs and multiple Ubuntu versions with different desktop environments. When I get a notification from any messaging program, the sound stops for a short while (a second or so) and then everything continues normally.
It's not a big issue, but it can be boring and even disturbing while working and listening to music. I am usually listening music through a browser (Firefox almost always), so that might help in trying to understand why it happens.
Anybody got the same issue, or am I the only one? :)
All the best!
31 Answer
So, apparently the problem was in the selected audio device.
Many of the applications (Slack, Viber, etc) detected my HDMI as the primary audio output source instead of the Built-In Audio Analog Stereo.
I tried fixing this first by disabling the notifications (but apparently even if they are disabled, muted, turned off and what not, they still try to connect to the first device and during that short period of time, the audio is turned of from the analog stereo output, it's turned on the HDMI and when it doesn't succeed it turns the analog output back on).
The next I did was trying some libraries and software solutions (different audio libraries, different drivers, etc). Nothing of that worked.
I also tried adding the Simultaneous output (as you can see in the image above), but that didn't help either, the sound was still turned off on the analog output.
Finally, I figured the issue being as described in the opening of the answer, so I set all audio devices manually (from each application) to the built in analog output, as well as the default as in the image.
It still sometimes tries to set the simultaneous output as the default, but apart from that I don't have sound issues anymore.