Music loop plays on macOS app after quitting app

That's really interesting that it happens on quit with the Mac. Is this a Catalyst-based app? (Well, if so it is less surprising since I've heard Catalyst is pretty buggy!)

If so, maybe some of the two iOS-related threads could apply:

It sees a solution would be to handle the visibilitychange event and if the document is hidden to run code which pauses the audio. A head html solution would look something like:

<script>

document.addEventListener("visibilitychange", (function () {
	if (document['hidden']) {
		var hypeDocument = Object.values(HYPE.documents)[0]; // get first hypeDocument
		hypeDocument.triggerCustomBehavior("muteAll"); // do something that mutes audio in the Hype document; here I would have setup a custom behavior that sets all of them to pause
	}
}));

</script>

Are you able to take this type of approach?