hindsight
By license on December 22, 2020 3:15 am
(s.waitForBoot({
var repetitions = 0;
var chordList = [
[47, 49, 52, 53], // start
[45, 46, 52, 54], // tense
[45, 57, 55, 56], // worrisome
[51, 52, 53, 54], // dramatic
[60, 59, 58, 57], // searching
[48, 50, 55, 56], // some kind of triumph
[46, 53, 47, 54], // tragedy
[50, 58, 48, 53], // delirious
[40], // shock/sadness
[41], // optimistic
[42], // accept/fight
[43], // angry
[44], // coping
[45], // consoling
[46] // serious
];
var delayInBus = Bus.audio(s, 2);
var mainBus = Bus.audio(s, 2);
//s.prepareForRecord;
SynthDef(\kickSidechain, { |out=0, inBus, t_trig, dryMix=1|
var pitchEnv = EnvGen.ar(Env.perc(0.01, 0.3, 1, -30), t_trig);
var ampEnv = EnvGen.ar(Env.perc(0.01, 0.5, 1, 0), t_trig);
var kick = SinOscFB.ar(50 + (pitchEnv * 200), ampEnv.pow(15), ampEnv * 0.8);
var sidechain = In.ar(inBus, 2) * (1 - (ampEnv * 0.4)) * dryMix;
Out.ar(out, ((kick ! 2) + sidechain).tanh);
}).add;
SynthDef(\delay, { |out=0, modDepth=0.004, dryMix=1, wetMix=0.3, decay=5, base=0.4|
var in = In.ar(delayInBus) * dryMix;
var delay = CombN.ar(in, 1, SinOsc.ar([0.23, 0.17], [2.0.rand, 2.0.rand], modDepth, base.lag(1)), decay);
Out.ar(out, (in * dryMix.lag(0.2)) + (delay * wetMix.lag(0.2)));
}).add;
SynthDef(\hat, {|out=0, rel=0.3, amp=1, freq=400, fb=4, t_trig=1, cutoff=5000,
second=0, secondDelay=0.02, third=0, thirdDelay=0.04|
var env1 = EnvGen.ar(Env.perc(0, rel, amp, -8), t_trig);
var env2 = EnvGen.ar(Env.perc(0, rel * 0.62, amp, -8), DelayN.kr(t_trig, 1, secondDelay, second));
var env3 = EnvGen.ar(Env.perc(0, rel * 0.62, amp, -8), DelayN.kr(t_trig, 1, thirdDelay, third));
var osc1 = SinOscFB.ar(freq, fb * env1, env1);
var osc2 = SinOscFB.ar(freq * 2, fb * env2, env2);
var osc3 = SinOscFB.ar(freq * 4.01, fb * env3, env3);
Out.ar(out, BHiPass.ar((osc1 + osc2 + osc3) / (1 + (second * 0.4) + (third * 0.4)), cutoff) ! 2);
}).add;
SynthDef(\pad, {|out=0, freq, amp|
var env = EnvGen.ar(Env.perc(5, 5), doneAction: 2);
var mod1 = SinOscFB.ar(freq, 1.8 * env, env);
var mod2 = SinOsc.ar((freq * 2.99), mod1, env);
var car = SinOsc.ar((freq * 4) + [-0.3, 0.3], mod2 * 2, env * amp) / 3;
Out.ar(out, car);
}).add;
SynthDef(\whoosh, {|out=0, freq, bw, slope, amp, pos, sr, bits|
var env = EnvGen.ar(Env.perc(slope, slope, amp, 1), doneAction: 2);
var osc = BBandPass.ar(Decimator.ar(WhiteNoise.ar, sr, bits), freq, bw, env);
Out.ar(out, Pan2.ar(osc, pos));
}).add;
//s.record;
Pmono(\kickSidechain,
\dur, 5,
\inBus, mainBus,
\trig, Pfunc({ if(((repetitions < 4) || (repetitions > 28 )) && (repetitions != 45), 0, 1) }),
\dryMix, Pfunc({ if(repetitions >= 45, 0, 1) })
).play;
Pmono(\delay,
\dur, 5,
\modDepth, Pfunc({ if(repetitions < 44, repetitions * 0.001, 0.4 )}),
\dryMix, Pfunc({ if(repetitions < 44, 1, 0) }),
\wetMix, Pfunc({ if(repetitions < 44, 0.3, 1) }),
\decay, Pfunc({ if(repetitions < 44, 5, 20) }),
\base, Pfunc({ if(repetitions < 44, 0.4, 0.6) }),
\out, mainBus
).play;
Pbind(
\instrument, \whoosh,
\dur, Pif(Pfunc({ repetitions < 4 }), Pwhite(0.01, 0.5), Rest()),
\freq, Pwhite(12, 127).midicps,
\bw, Pwhite(0.1, 2.0),
\slope, Pwhite(0.1, 1.0),
\amp, Pwhite(0.1, 0.3) / Pfunc({ repetitions + 1 }),
\pos, Pwhite(-1.0, 1.0),
\sr, Pwhite(60, 130.midicps),
\bits, Pwhite(4, 12),
\out, delayInBus
).play;
Pmono(\hat,
\degree, Pif(
Pfunc({ repetitions < 12 }),
Pfunc({ chordList[0][chordList[0].size.rand] }),
Pwrand(chordList, ((5!8) ++ (1!7)).normalizeSum, inf)
) - 54,
\dur, Pif(
Pfunc({ repetitions < 46 }),
Pn(Pgeom(1, 0.8, 50) ++ Pfunc({
repetitions = repetitions + 1;
repetitions.postln;
nil;
})),
Pfunc({
//s.stopRecording;
"fin".postln;
nil;
})),
\amp, Pseq((140..200) ++ (200..140), inf) * (1/200),
\fb, Pseq((150..250) ++ (250..150), inf) * (4/300),
\trig, 1,
\cutoff, (Pseq((1020..430) ++ (430 .. 1020), inf) / 10).midicps,
\scale, Scale.major,
\releaseRatio, Pseq((20..60) ++ (60..30), inf) / 30,
\rel, Pfunc({ |e| e.dur * e.releaseRatio }),
\second, Pfunc({ repetitions > 3 }),
\secondDelay, Pif(Pfunc({ repetitions < 20 }), Pkey(\dur) / 2, Pkey(\dur) * 1 / 3),
\third, Pfunc({ repetitions > 19 }),
\thirdDelay, Pkey(\dur) * 2 / 3,
\out, Pfunc({ if(repetitions < 4, mainBus, delayInBus) })
).play;
Pbind(
\instrument, \pad,
\dur, Pfunc({ if((repetitions < 4) || (repetitions >= 44), Rest(5), 5) }),
\degree, Pif(
Pfunc({ repetitions < 4 }),
Rest(),
Pseq([7, 5, 6, 3, 7, 5, 6, 10] - 26, inf)
) + Pif(Pfunc({ repetitions < 28 }), 0, [7, 9, 11, 14]),
\amp, Pif(Pfunc({ repetitions < 28 }), 1, 1/2),
\out, Pfunc({ if(repetitions < 20, mainBus, delayInBus) })
).play;
}))
Audio works licensed by author under:
CC0 Creative Commons Zero (Public Domain)