html5 audio
HTML
<audio controls preload id="rain">
<source src="http://www.rupamsunyata.org/decklin/tmp/the-rain.mp3" />
</audio>
<div class="output"></div>
JavaScript
var rain = document.getElementById('rain');
rain.addEventListener('ended', function() {
// This should take different amounts of time on different devices.
for (var i = 0; i < 100000000; i++);
// Simulate inexactness of tape playback
rain.playbackRate = 0.995 + Math.random() / 100.0;
// When this finishes it'll run us again
rain.play();
});
rain.play();