HA! this is a hugeass issue on every android I've owned. im assuming you're using poweramp or something right? the stock player pauses the song to play it thru the headphones which is probably why that dude up ^^ doesn't get that.
anyways some kernels fix this, namely Boeffla Sound on the sgs3. sadly I've seen no fix on the s4. SO! , here's what your can do; in your music player (power amp, etc), under audio settings, turn on Settings>Audio>Audio Focus> and tick 'Short Audio Focus Changes', this will pause your music on notifications.
ORRRRR a far better solution is when you plug in your 3.5mm jack headphones (cause this shii* doesn't happen on bluetooth), you can just pull down your notification bar and tap over to vibrate mode. then you'll hear notifications IN YOUR HEADPHONES a little quieter but still noticeably behind your music, and your music won't pause or mute or anything.
Sent from my SGH-M919 using xda app-developers app.