Last active
December 19, 2015 23:00
-
-
Save dariusk/88c85cc24ce10c451a32 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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