0 votes
by (180 points)
So I have



So I wanted some background audio for my game that extended over multiple passages in the form of a loop but  I think I use a code for harlowe instead of sugarcube. When I went and played it not only was there no music available but  it gave an error for my dialogue boxes saying the macro was incorrect.


Can someone help?

This is the code I used in javascript

var audio = document.createElement: ('audio');
audio.src = 'https://www.youtube.com/watch?v=se--yzRW1pI';
audio.loop = true;

1 Answer

+1 vote
by (44.7k points)

You should take a look at the SugarCube audio documentation, plus the music sample code here, for help with playing sounds in Twine/SugarCube.

Also, you really should use MP3 files for your audio.  Not only will MP3 files save bandwidth compared to using videos, but it's also less likely to stutter since it can be downloaded faster.

Hope that helps!  :-)