Skip to content

Instantly share code, notes, and snippets.

@nnirror
Created October 8, 2023 13:28
Show Gist options
  • Select an option

  • Save nnirror/ff180c25e86cb3cfbc88f9c954d01c7a to your computer and use it in GitHub Desktop.

Select an option

Save nnirror/ff180c25e86cb3cfbc88f9c954d01c7a to your computer and use it in GitHub Desktop.
nnirror 2023-10-07 set
// 45 bpm
// state 1: tri waves
$('bpm')
.from(45)
.bpm();
$('s1')
.iter(4, () => {
this.sup(_.tri(_.noise(8)
.scale(ri(40, 60), ri(70, 90))
.key(barmod(2, [0, 'c major', 1, 'f major']))
.mtof()
.size(128)
.slew(16, 0.5, 0.5), n1)
.times(_.ramp(1, 0, n8))
.scale(0, 1, 9), i / iters)
})
.lpf(_.drunk(32, rf())
.scale(ri(500, 1000), ri(1500, 3000)))
.mix(0.5, () => {
this.reverb(2, 0.9)
})
.delay(n6)
.full()
.play();
// state 2: plane pad
$('planepad')
.spiral(4)
.scale(ri(40, 60), ri(80, 90))
.key('c major')
.chord('maj7')
.note(_.ramp(60, 100, 4), 1000, 3);
// state 3: CLEAR HOOKS.
$('808midihats')
.from([42, 0])
.dup(15)
.note(_.ramp(10, 127, 16)
.dup(3), 215, 1);
// add 808 drums
$('808midi')
.from([36, 0, 38, 0])
.note(100, 215, 1);
$('808midixtra')
.noise(16).dup(7).scale(10,127)
.note(100, 215, 1);
// state 4: add square wave bassline
$('squarewavebass')
.iter(choose([4, 8, 16]), () => {
this.sup(_.square(_.ramp(ri(30, 50), ri(60, 90), iters)
.key('c major pentatonic')
.data[i], n1 / iters)
.times(_.ramp(1, 0, n8)
.scale(0, 1, 4)), i / iters)
})
.lpf(_.ramp(10000,100,n4).scale(100,10000,4).dup(7))
.full()
.play();
// state 5: 45bpm electro, switch-up to 90
$('bpm')
.from(45)
.bpm();
$('electro90')
.iter(16, () => {
this.sup(_.square(_.ramp(ri(30, 50), ri(60, 90), iters)
.key('c major pentatonic')
.data[i], n1 / iters)
.times(_.ramp(1, 0, n8)
.scale(0, 1, 4)), i / iters)
})
.lpf(_.ramp(100, NYQUIST, 128)
.scale(100, NYQUIST, 4))
.full()
.sup(_.iter(8, () => {
this.sup(_.noise(n4)
.times(0.1)
.hpf(4000, 1)
.times(_.ramp(1, 0, n4)
.scale(0, 1, 9)), i / iters)
})
.sup(_.sample('kicks/BD.1 MOD [Pitch+Depth+Overdrive] 10.wav')
.full(), 0)
.sup(_.sample('808/808-Clap13')
.full(), _.from([0.25, 0.75])))
.full()
.play();
$('planepad')
.spiral(2)
.scale(ri(40, 60), ri(80, 90))
.key('c major')
.chord('maj7')
.note(_.ramp(60, 100, 2), 1000, 3);
// state 6: trumpet pad
$('hornspirals')
.spiral(8, rf(0, 360))
.scale(ri(30, 40), ri(50, 60))
.key('c major')
.chord('major')
.note(_.ramp(30, 100, 4)
.palindrome(), 500, 2);
$('hornpitchbend')
.sine(1)
.size(128)
.times(0.2)
.pitchbend();
// state 7: pluck 2-step
$('bpm')
.from(45)
.bpm();
$('hornspirals')
.spiral(8, rf(0, 360))
.scale(ri(30, 40), ri(50, 60))
.key('c major')
.chord('major')
.note(_.ramp(30, 127, 4)
.palindrome(), 500, 2);
$('hornpitchbend')
.sine(1)
.size(128)
.times(0.2)
.pitchbend();
$('pluck2step')
.silence(n1)
.iter(8, () => {
this.sup(_.pluck(_.noise(4)
.scale(ri(20, 50), ri(90, 110))
.key(choose(['c major', 'f major']))
.shuffle()
.data[0], n8, 1, 0.5), i / iters)
})
.fkey([24, 31, 36, 43, 48, 55], rf(0.01, 0.05), ri(4, 12))
.resonate(_.from(12)
.mtof(), _.ramp(1, 4, 4), 80, 0.5)
.harmonics(4)
.tanh(4)
.fade(0.1)
.truncate(n1)
.full()
.sup(_.sample('kicks/002')
.times(0.5)
.comb(ms(ri(3, 25))), _.ramp(0, 1, 64).prob(0.5)) // kick patt
.sup(_.sample('808/808-Clap13').sometimes(0.5,()=>{this.reverse()})
.times(0.35), _.from([0.125, 0.375, 0.625, 0.875]).echo(3)) // clap patt
.play();
// state 8: breakbeat mods
$('bpm')
.from(100)
.bpm();
$('b')
.randsamp('breaks')
.stretchto(n1)
.slices(16, () => {
this.pitch(_.ramp(rf(0.5, 2, 2), rf(0.5, 2, 2), 128))
.log(rf())
.mix(rf(), () => {
this.comb(n128 / 2)
.truncate(n16)
})
})
.sup(_.sample('kicks/002'), _.ramp(0, 1, 16)
.prob(rf(0.5, 1)))
.sup(_.sample('808/808-Clap13')
.full(), 0.5)
//.pitch(_.ramp(1,0.125,512)).truncate(n1).rechunk(16)
/*.slices(8, () => {
this.sometimes(1,()=>{
if (Math.random() > 0.5) {
this.pow(0.7)
}
else {
this.log(0.7)
}
})
})*/
/*.delay(_.ramp(9000, 20, 128)
.scale(20, 9000, 5))
.ichunk(_.spiral(128,ri(0,360)))*/
.play();
// state 9: hyper break, self-following LPF
$('bpm')
.from(80)
.bpm();
$('hyper_break')
.randsamp('breaks')
.rechunk(16)
.slices(32, () => {
this.sometimes(0.5, () => {
this.log(rf())
})
.sometimes(rf(0.1, 0.25), () => {
this.reverse()
})
.sometimes(4 / 32, () => {
this.stutter(ri(0, 4))
})
})
.sometimes(1, () => {
this.lpf(_.from(this.data)
.follow(0, n16)
.scale(100, NYQUIST, 3), rf(0, 12))
})
.stretchto(n1)
.flange(ri(60, 1000), ri(1, 2000))
.sup(_.tri(60)
.stretchto(n2)
.lpf(_.sine(choose([4, 6, 8, 9, 12]))
.scale(30, 3000))
.fade(0.001)
.times(_.ramp(1, 0, n2))
.sup(_.tri(40)
.stretchto(n2)
.lpf(_.sine(choose([4, 6, 8, 9, 12]))
.scale(30, 3000))
.fade(0.001)
.times(_.ramp(1, 0, n2)), 0.5, n1)
.full())
.play();
// state 9 bass only
$('lpfmod_bass')
.tri(60)
.stretchto(n2)
.lpf(_.sine(choose([4, 6, 8, 9, 12]))
.scale(30, 3000))
.fade(0.001)
.times(_.ramp(1, 0, n2))
.sup(_.tri(40)
.stretchto(n2)
.lpf(_.sine(choose([4, 6, 8, 9, 12]))
.scale(30, 3000))
.fade(0.001)
.times(_.ramp(1, 0, n2)), 0.5, n1)
.full()
.play();
//.log(0.9).play();
//.log(0.9).play(_.ramp(0,1,8));
// state 10: "test"
$('test')
.sample('test')
.ichunk(_.ramp(0, 1, 64)
.scale(0, 1, rf(0.1, 2)))
.pitch(_.ramp(2, 0.5, 16))
.stretchto(n1)
.mix(0.5, () => {
this.reverb(4, 0.8)
})
.play();
// state 11: haunted tom's diner
$('bpm')
.from(60)
.bpm();
$('tom')
.sample('tom')
.pitch(barmod(4, [0, 1, 1, 1, 2, 1, 3, 0.66]))
.reverb(2, 0.98)
.range(0.6, 1)
.lpf(_.ramp(100,4000,128), 1)
.fadein(0.1)
.full()
.play();
// state 12: bouncing ball kicks
$('bouncing_ball_kicks')
.iter(32, () => {
this.append(_.randsamp('kicks')
.stretchto(n4 / (i + 1))
.lpf(ri(100, NYQUIST), rf(0.1, 4))
.full())
})
/*.sup(_.sample('hats/008')
.stretchto(n16)
.times(_.ramp(1, 0, n32))
.full()
.times(0.1)
.dup(15))*/
/*.sup(_.sample('snares/011')
.full(), 0.25)
.stretchto(n1)*/
/*.sup(_.tri(_.ramp(50, 5, 32)
.round()
.key('C# major')
.mtof(), n4)
.dup(3))*/
.play();
// state 12 basssss
$('just_the_bassss').tri(_.ramp(50, 5, 32)
.round()
.key('C# major')
.mtof(), n4)
.dup(3).play();
// state 13: fm piano up slide
$('fm_up_slide')
.iter(4, () => {
this.append(_.spiral(16)
.scale((i * 12) + 36, (i * 12) + 52))
})
.clip(36, 88)
.round()
.key('c major')
// .key(barmod(4, [0, 'c major', 1, 'd major', 2, 'a major', 3, 'g major']))
.chord('maj7')
.note(_.ramp(127, 10, 128), 666, 4);
// state 14: 808s for fm piano upslide
$('upslide_808_64ths')
.spiral(64)
.scale(barmod(4, [0, 36, 1, 48, 2, 60, 3, 72]), barmod(4, [0, 52, 1, 64, 2, 76, 3, 88]))
.round()
.prob(0.5)
.at(0, 36)
.at(0.25, 38)
.at(0.5, 36)
.at(0.75, 38)
.key('c major')
.chord('maj7')
.note(_.noise(64)
.scale(0, 63), 10, 1);
// end state: space re/decomposition
$('space')
.iter(8, () => {
this.sup(_.randsamp('snow'), i / iters)
})
// arg 2 from 0.1 to 0.001
// arg 3 from 20 to 2
.fkey(_.from([0,12,24,36,48,60,72,84,96,108,120]),0.1,20)
.stretchto(n1)
.reverb(4)
.full()
.play();
// bonus: reverse echo witch (w/ background accompaniment)
$('witch')
.sample('witch')
.reverse()
.delay(n24, 0.8)
.reverse()
.play();
// bonus bonus: timestretched witch
$('witch')
.sample('witch')
.reverse()
.delay(n24, 0.8)
.reverse()
.stretch(_.ramp(0.75, 4, 512))
.play();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment