In-code sound loop?

Ok so, the thing is, I have this audio file of a song that lasts around 3 minutes, but the next song change comes later in the code, which means, there’s a part where everything is just silent and… I don’t want that.
I have been thinking about looping the file manually using audacity, but that’ll make it heavier and I don’t want to use like a third of the game’s weight for just one single soundtrack.
Is there anyway to loop it through the code? I thought about maybe doing something like

*if sound != song.mp3
 *sound song.mp3

But, aside from not even working since sound isn’t a variable, if it worked this couldn’t be put everywhere and even if it could be, it could still lead to moments of silence unless I make every page pretty short so that the checks are almost every 10 seconds if not less (which still would cause silence at some point)

It’s not possible as far as I know. ChoiceScript lacks thorough support for audio (or any other kind of media, to be honest) except for the very basic.

There was a plugin once, but it’s been discontinued by the creator. And wouldn’t be able to be used anyway if you plan to publish through CoG’s labels.

1 Like

This isn’t really supported, but you could try:

*sound confirm.mp3
*script document.getElementsByTagName("audio")[0].setAttribute("loop", true);

Note that *script is not supported though, and we discourage in-depth JavaScript discussions here. So you’ll be on your own if you’re going down that route.