Last active
April 22, 2016 15:51
-
-
Save smuuf/f5d505e85227cfdeeab12641b461cf25 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// Prepare some stuff. | |
var bpm = 135; | |
var loopInterval = (60 * 1000) / bpm / 4; | |
// Master channel. | |
__().compressor({id: "master"}).dac(); | |
__().sine({id: "kick", frequency: 60}) | |
.overdrive({drive: 0.05}) | |
.adsr({id: "kickA"}) | |
.gain(0.8) | |
.highpass(20) | |
.connect("#master"); | |
__().white({id: "clap"}) | |
.adsr({id: "clapA"}) | |
.gain(0.5) | |
.highpass(300) | |
.lowpass({frequency: 2500, q: 6}) | |
.connect("#master"); | |
__().white({id: "hihat"}) | |
.adsr({id: "hihatA"}) | |
.gain(0.2) | |
.highpass(8000) | |
.lowpass({frequency: 20000, q: 3}) | |
.connect("#master"); | |
// Loop | |
__.loop({steps: 16, interval: loopInterval}); | |
// Patterns | |
__('#kick,#kickA').bind("step", function(i, v, a) { | |
if (v) { | |
__.ramp(40, .1, "frequency", 140); | |
__.adsr("trigger", [0, 0.3, 0.2, 0.2]); | |
} | |
}, [1,0,0,0,0,0,1,0,0,0,1,0,0,1,0,0]); | |
__('#clap,#clapA').bind("step", function(i, v, a) { | |
if (v) { | |
__.adsr("trigger", [0, 0.20, 0.1, 0.05]); | |
} | |
}, [0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0]); | |
__('#hihat,#hihatA').bind("step", function(i, v, a) { | |
if (v) __.adsr("trigger", [0, 0.08, 0, 0]); | |
}, [0,0,1,1,0,0,1,1,0,1,1,0,0,0,1,1]); | |
// Hrej! | |
__.loop("start"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment