<audio id="foobar" src="yoursample.ogg" preload="auto">
var sample = document.getElementById("foobar"); sample.play();