Skip to content

Instantly share code, notes, and snippets.

@dariusk
Last active December 19, 2015 23:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dariusk/88c85cc24ce10c451a32 to your computer and use it in GitHub Desktop.
Save dariusk/88c85cc24ce10c451a32 to your computer and use it in GitHub Desktop.
var src = window.getDraggedFile() || "/timbre.js/misc/audio/amen.wav";
Array.prototype.pick = function() {
return this[Math.floor(Math.random()*this.length)];
}
T("audio").load(src, function() {
function slice(that, start) {
var len = 450;
return that.slice(start, start+len).set({bang:false});
}
var P1 = [];
for (var i=0; i<8; i++) P1.push(slice(this, 545*i));
var drum = T("lowshelf", {freq:20, gain:8, mul:0.6}, ...P1).play();
T("interval", {interval:"BPM128 L32"}, function(count) {
var i = count;
if (i % 8 === 0) P1.pick().bang();
//P1[0].forEach(function(p) { p.bang(); });
}).start();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment