For my pvp map that is currently under-construction, I wanted to add background music to my map. I figured out a way to do this with resource pack sounds and the /playsound command. Only problem is I need the song to loop, and eventually end. Is there a way to remove the sound/music that is being played with command blocks? If there isn't, is there a way to detect it? If even that isn't feasible, is it possible to overlap the music with another sound effect (such as a pig sound) to overwrite it, and thus stop it?
Even though volume actually specifies an area in which the sound will be heard it's not really accurate (16 blocks range * your value). I'd suggest you specify who hears the sound in your player selector with x, y, z and dx, dy, dz arguments or simply with radius. Also if you use just volume there may appear a gradual falloff so sound would go quieter if you go in, say, to the corner of your area.
Rollback Post to RevisionRollBack
If you want more direct help concerning commands join the /r/MinecraftCommands discord server!