heh, I also once had trouble getting audio right. That's why I decided against JS APIs, and instead use HTML to set up an HTML5 audio tag and an older object tag. If the new API for playing sound is available, I just execute that on the audio tag, else I use the object tag to play sound.
<audio class="js-audio-new">
<source src="horse.ogg" type="audio/ogg">
<source src="horse.mp3" type="audio/mpeg">
</audio>
var audioNew = document.querySelector('.js-audio-new'); // <- might use jQuery for older browsers here
if (audioNew.play) {
audioNew.play();
}
else {
audioNew.innerHTML = '<embed src="' + audioNew.attributes.src.value + '" autostart=true loop=false volume=100 hidden=true></embed>';
}