Skip to content

Instantly share code, notes, and snippets.

@dnoyes
Created February 23, 2012 02:39
Show Gist options
  • Save dnoyes/1889375 to your computer and use it in GitHub Desktop.
Save dnoyes/1889375 to your computer and use it in GitHub Desktop.
html5 audio
<script>
var a = new Audio();
var sources = [
'topsecret1.wav',
'topsecret2.wav',
'topsecret3.wav'];
function playSound() {
var i = Math.floor(Math.random()*3);
a.pause();
a.src = sources[i];
a.startTime = 0;
a.play();
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment