Skip to content

Instantly share code, notes, and snippets.

@halfbyte
Created January 11, 2014 13:42
Show Gist options
  • Save halfbyte/8371068 to your computer and use it in GitHub Desktop.
Save halfbyte/8371068 to your computer and use it in GitHub Desktop.
A demonstration of some new elements in liv3c0der I did for my WCDC talk.
// NAME: default
AE.Instance.tempo = 120;
AE.Instance.groove = 0.0;
function draw(c, s) {
LC.cls(c)
}
// context, outlet, times, time per step, state, data
function pattern(c, o, t, l, s, d) {
if (!AE.dubfilter)
AE.dubfilter = new AE.LfoFilter(c, {lfo_freq: 0.2, frequency: 2500, lfo_gain: 2000, type: 'notch'});
var i;
var ll=t.length;
s.init('loop',0);
AE.DelayLine.delayTime.value = l*3;
AE.ReverbLine.mix.value = 0.5;
AE.DubLine.delay.delayTime.value = l*3;
AE.DubLine.delay.feedback.value = 0.6;
AE.DubLine.delay.filterFrequency.value = 1000;
AE.DubLine.delay.output.value = 0.7;
AE.DubLine.reverb.mix.value = 0.9;
// your code here
for(i=0;i<ll;i++) {
if (i % 6 == 0) AE.DrumSynth.play(o, t[i], 0.8, 20, 2, 300, AE.NOTES[20 + i]);
if (i == 8) AE.SnareSynth.play(AE.REV, t[i], 0.8, 10, 5)
AE.NoiseHat.play(o, t[i], 0.2);
if (i > 12) AE.NoiseHat.play(o, t[i] + l/2, 0.2);
}
baseNote = 36;
if (s.loop % 4 == 0) baseNote += 3;
AE.dubfilter.connect(AE.DUB);
AE.dubfilter.lfo_gain.value = 500;
AE.dubfilter.frequency.value = 2000;
//AE.dubfilter.lfo_freq.value = 2;
AE.dubfilter.filter.type = 'bandpass'
AE.SawSynth.flt_mod = 1000 + Math.random() * 2000;
AE.SawSynth.flt_d = 0.1;
AE.SawSynth.play(AE.dubfilter.destination, t[4], l/2, baseNote);
AE.SawSynth.play(AE.dubfilter.destination, t[4], l/2, baseNote + 3);
AE.SawSynth.play(AE.dubfilter.destination, t[4], l/2, baseNote + 7);
if (Math.random() < 0.2) {
AE.SawSynth.play(AE.dubfilter.destination, t[12], l/2, baseNote);
AE.SawSynth.play(AE.dubfilter.destination, t[12], l/2, baseNote + 3);
AE.SawSynth.play(AE.dubfilter.destination, t[12], l/2, baseNote + 7);
AE.SawSynth.play(AE.dubfilter.destination, t[12], l/2, baseNote + 12);
}
// AE.SawSynth.play(AE.DUB, t[3], l/2, baseNote - 12);
s.loop++;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment