Music stopped working

So some time ago I worked out how to get music to play by using Sugarcube, I was folliwing this tutorial, but now it won’t play when I test it. I don’t know if it’s because I renamed the story passages, but that shouldn’t have affected it, right? Do I have to rebuild the passages I have so far again just so it will work again?

Hi,
Renaming the passages shouldn’t affect the audio.
Did you test the game from the Twine app or the published HTML file?

I tested the published HTML file every time.

Other possible sources of error:

  • the files are not in the correct folder related to the HTML file
  • there is a typo in the code (the url for the file is case sensitive)

Could you share with us the code related to audio you have in the StoryInit passage and the other passage where you want the music to start?

EDIT: here is the code you can find in the documentation:
<<cacheaudio "bgm_space" "media/audio/explosion.mp3">>
<<audio "bgm_space" pause>>
Old tutorials sometimes may lead you to errors, especially if the format has been updated in the meantime

Here’s one example:

<<cacheaudio "attachment" "Music/attachment.mp3">>

I tried both <<audio attachment play>> and <<audio "attachment" play>> but neither of them work.

:thinking:
Do you have a setting to lower the volume of the audio or turn off the audio completely?
Or go through a previous passage where you used the fadeout option? Cause that will not stop the audio, just turn it to 0.
<<audio "bgm_space" fadeout>>

No, so far I’ve got 2 other tracks that won’t play that I’ve added codes to stop the previous track from playing, but the first one won’t play either and that doesn’t have anything in the passages before it.

EDIT: I don’t know if I’m allowed to doube post, but I worked it out. Turns out I needed the published file to be in the same folder as the folder containing all the sounds. I don’t know why I didn’t have it saved there. That was silly.

1 Like