code

looping audio with soundjs

a preloaded audio loop gets a simple pair of play and stop buttons.

html

<script src="//code.createjs.com/soundjs-0.5.0.min.js"></script>
<script src="//code.createjs.com/preloadjs-0.3.0.min.js"></script>
<button id="play">Play</button>
<button id="stop">Stop</button>

javascript

var manifest = [
  { id: "waiting", src: "//futuredeathtoll.com/upload/filez/djhrn.mp3" },
];
var preload = new createjs.LoadQueue();
preload.installPlugin(createjs.Sound);
preload.loadManifest(manifest);

$("#play").on("click", function () {
  createjs.Sound.play("waiting", createjs.Sound.INTERRUPT_NONE, 0, 0, -1, 1);
});
$("#stop").on("click", function () {
  createjs.Sound.stop();
});

this demo preserves the compiled output and may depend on external libraries or services that are no longer available.

original jsfiddle post