Skip to content

Instantly share code, notes, and snippets.

@halfbyte
Created September 20, 2013 12:46
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 halfbyte/6636949 to your computer and use it in GitHub Desktop.
Save halfbyte/6636949 to your computer and use it in GitHub Desktop.
A patch for liv3c0der, used at JSConf.eu 2013 and before my talk at onGameStart 2013.
// NAME: middle
function draw(c, s) {
LC.cls(c)
}
// context, outlet, times, time per step, state, data
// should return array of functions that accept a single argument: the time
function pattern(c, o, t, l, s, d) {
var i;
var ll=t.length;
//s.init('loop',0);
notes = [0,3,7,10,12,15,19,22];
AE.DelayLine.delayTime.value = l*3;
AE.Arp(notes, t[0], l, 16, function(time,n) {
AE.SpreadSynth.flt_a = 0.8;
AE.SpreadSynth.flt_mod = 800 + 2000 * ((Math.sin(s.loop / 2) + 1) / 2)
AE.SpreadSynth.play(AE.REV, time, l/2, 24 + notes[s.loop % notes.length] + n);
});
AE.AcidSynth.play(AE.REV, t[0], l*2, 24);
for(i=0;i<ll;i++) {
//if (i % 4 == 0) AE.S['t_base'].playShot(o, t[i]);
//if (i % 8 == 4) AE.S['t_clap'].playShot(AE.REV, t[i]);
//if (i % 4 == 2) AE.S['t_hhcl'].playShot(o, t[i]);
if (i % 4 == 2) AE.NoiseHat.play(AE.DEL, t[i], 0.6, 5, 2000 + Math.random() * 3000, 10);
}
s.loop++;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment