// title: Middle Children of History MUSC115 Final // author: ianmcdougall60 // description: // https://soundcloud.com/user-68447368/middle-children-of-history-musc115-final // code: ////////////////////////////////////// //////// Ian McDougall /////////// ////////////////////////////////////// // =================================== // SynthDefs here // =================================== // Sample definitions ~fight = Buffer.read(s, "C:/Users/Ian/Desktop/SUPERCOLLIDER/FINAL PROJECT/Fight Club Speech.wav "); ~fight.duration; ~kanye = Buffer.read(s, "C:/Users/Ian/Desktop/SUPERCOLLIDER/FINAL PROJECT/Kanye West - Self Conscious on Def Jam Poetry.wav"); ~kanye.duration; ~west1 = Buffer.read(s,"C:/Users/Ian/Desktop/SUPERCOLLIDER/FINAL PROJECT/west1.wav"); // Your SynthDefs go here ( SynthDef("lowbuild", {arg out = 0, dur = 0.75, amp = 0.3, sinfreq = 80, glissf = 0.9, att = 0.01, rel = 0.45, pan = 0; var env, snd, ramp; env = Env.pairs([[0,0.05], [dur, 0.1]], \exp).kr(doneAction: 2); ramp = XLine.kr( start: sinfreq, end: sinfreq * glissf, dur: rel ); snd = Saw.ar( freq: ramp, mul: env, add: 0); snd = Pan2.ar(snd, pan); Out.ar(out, snd); }).add; SynthDef("speech", {arg rate = 1, amp = 1, buffer, startPos = 0, attack = 0.02, panning = 0, ffreq = 1000, rq = 0.1, delay = 0.3, decay = 1; var snd, env; env = Env.pairs([[0,10], [48, 15]], \lin).kr(doneAction: 2); snd = PlayBuf.ar( numChannels: 1, bufnum: buffer, rate: rate, startPos: startPos.linlin(0, 1, 0, BufFrames.kr(buffer)) ); snd = snd * env; snd = BPF.ar(snd, ffreq, rq); snd = CombC.ar(snd, maxdelaytime: 2, delaytime: delay, decaytime: decay); snd = Pan2.ar(snd, panning); Out.ar(0, snd); }).add; SynthDef(\lead, { |out, freq=440, amp=0.1, gate=1, bps=2| var snd; var seq = Demand.kr(Impulse.kr(bps*4), 0, Dseq(freq*[1,3,2], inf)).lag(0.01); snd = LFSaw.ar(freq*{rrand(0.995, 1.005)}!4); snd = Splay.ar(snd); snd = MoogFF.ar(snd, seq, 0.5); snd = snd * EnvGen.ar(Env.asr(0.01,1,0.01), gate, doneAction:2); OffsetOut.ar(out, snd * amp); }).add; SynthDef("sampler", {arg rate = 1, amp = 1, buffer, startPos = 0, attack = 0.02, release = 0.5, panning = 0; var snd, env; env = Env.perc(attackTime: attack, releaseTime: release, level: amp).kr(doneAction: 2); snd = PlayBuf.ar( numChannels: 1, bufnum: buffer, rate: rate, startPos: startPos.linlin(0, 1, 0, BufFrames.kr(buffer)) ); snd = snd * env; snd = Pan2.ar(snd, panning); Out.ar(0, snd); }).add; SynthDef("sampfilter", {arg rate = 1, amp = 1, buffer, startPos = 0, attack = 0.02, release = 0.5, ffreq = 1000, rq = 0.1, panning = 0, delay = 0.3, decay = 1; var snd, env; env = Env.perc(attackTime: attack, releaseTime: release, level: amp).kr(doneAction: 2); snd = PlayBuf.ar( numChannels: 1, bufnum: buffer, rate: rate, startPos: startPos.linlin(0, 1, 0, BufFrames.kr(buffer)) ); snd = snd * env; snd = BPF.ar(snd, ffreq, rq); snd = CombC.ar(snd, maxdelaytime: 2, delaytime: delay, decaytime: decay); snd = Pan2.ar(snd, panning); Out.ar(0, snd); }).add; SynthDef("hihat", {arg out = 0, amp = 0.5, att = 0.01, rel = 0.2, ffreq = 6000, pan = 0; var env, snd; env = Env.perc(att, rel, amp).kr(doneAction: 2); snd = WhiteNoise.ar; snd = HPF.ar(in: snd, freq: ffreq, mul: env); Out.ar(out, Pan2.ar(snd, pan)); }).add; SynthDef("snare", {arg out = 0, amp = 0.1, sinfreq = 180, att = 0.01, rel = 0.2, ffreq = 2000, pan = 0; var env, snd1, snd2, sum; env = Env.perc(att, rel, amp).kr(doneAction: 2); snd1 = HPF.ar( in: WhiteNoise.ar, freq: ffreq, mul: env ); snd2 = SinOsc.ar(freq: sinfreq, mul: env); sum = snd1 + snd2; Out.ar(out, Pan2.ar(sum, pan)); }).add; SynthDef("kick", {arg out = 0, amp = 0.3, sinfreq = 60, glissf = 0.9, att = 0.01, rel = 0.45, pan = 0; var env, snd, ramp; env = Env.perc(att, rel, amp).kr(doneAction: 2); ramp = XLine.kr( start: sinfreq, end: sinfreq * glissf, dur: rel ); snd = SinOsc.ar(freq: ramp, mul: env); snd = Pan2.ar(snd, pan); Out.ar(out, snd); }).add; // Basic saw synth for chords and bass SynthDef("sawSynth", { arg freq = 440, amp = 0.1, att = 0.1, rel = 2, lofreq = 1000, hifreq = 3000; var env, snd; env = Env.perc( attackTime: att, releaseTime: rel, level: amp ).kr(doneAction: 2); snd = Saw.ar(freq: freq * [0.99, 1, 1.001, 1.008], mul: env); snd = LPF.ar( in: snd, freq: LFNoise2.kr(1).range(lofreq, hifreq) ); snd = Splay.ar(snd); Out.ar(0, snd); }).add; ) // end of SynthDefs // =================================== // Define a bunch of "score snippets" // =================================== ( ~hihat1 = Pbind( \instrument, "hihat", \dur, Pseq([1/8, Rest(2/8), 2/8, 1/8], inf), \att, 0.01, \rel, Pseq([0.3, 1, 0.1, 0.3], inf), \ffreq, 11000, \pan, 0, \amp, 0.1 * Pwhite(0.1, 1.8) ); ~snare1 = Pbind( \instrument, "snare", \dur, Pseq([Rest (3/8), 3/8, Rest(2/8), 4/8], inf), \att, 0.01, \rel, 0.1, \sinfreq, 180, \ffreq, 2000, \amp, 0.15 * Pwhite(0.1, 1.8) ); ~kick1 = Pbind( \instrument, "kick", \dur, Pseq([Rest(6/8), 6/8], inf), \att, 0.01, \rel, 0.22, \sinfreq, 60, \glissf, 0.9, \amp, 0.3 * Pwhite(0.1, 1.8) ); ~bass1 = Pbind( \instrument, "sawSynth", \freq, Pseq([80, 120, 80, 60, 50, 60], inf), \dur, Pseq([Rest(2/4), Rest(1/4), 1/4, 1/4, Rest(2/4), 3/4, 2/4], inf), \att, 0.02, \rel, Pseq([1, 1, 0.3, 0.3, 1, 0.5, 0.5], inf), \amp, 0.6 * Pwhite(0.1, 1.8), \lofreq, 50, \hifreq, 180 ); ~fightspeech = Pbind( \instrument, "speech", // notice I'm using granny2 synthdef here \rate, Pseq([1], 1), \amp, 20, // boosted to 5 because filtering attenuates a lot of the sound \startPos, 0, \attack, 0.2, \ffreq, 300, \rq, 0.1, \delay, 0.2, \decay, 2, \buffer, ~fight, // which buffer to play from \dur, 48, \panning, 0, ); ~pulse = Pbind( \instrument, \lead, \midinote, Pseq([ [50, 55, 65, 70], [65, 75, 80, 55], [40, 45, 50, 55], [35, 45, 55, 65, 75], ], inf ), \dur, Prand([1.25, 1, 2, 1.5], 26), \att, 0.1, \rel, 4, \amp, 0.06 ); ~speech1 = Pbind( \instrument, "sampfilter", // notice I'm using granny2 synthdef here \rate, Pseq([2, 4, 1, 9], 10), \amp, 5, // boosted to 5 because filtering attenuates a lot of the sound \startPos, Pwhite(0.05, 0.95), \attack, 0.2, \release, 2, \ffreq, Prand([100, 200, 400, 550, 9000, 50, 100, 2000], inf), \rq, 0.1, \delay, 0.2, \decay, 2, \buffer, ~fight, // which buffer to play from \dur, 0.5, \panning, Pwhite(-0.5, 0.5) ); ~speech2 = Pbind( \instrument, "sampfilter", // notice I'm using granny2 synthdef here \rate, Pseq([0.2, 0.4, 0.3, 0.5], 14), \amp, 12, // boosted to 5 because filtering attenuates a lot of the sound \startPos, Pwhite(0.05, 0.95), \attack, 0.4, \release, 2.5, \ffreq, Prand([100, 200, 400, 550, 9000, 50, 100, 2000], inf), \rq, 0.1, \delay, 0.2, \decay, 1, \buffer, ~fight, // which buffer to play from \dur, 0.5, \panning, Pwhite(-0.5, 0.5) ); ~kanye1 = Pbind( \instrument, "sampler", \rate, Pseq([1.2], inf), // notice this one ENDS after 4 cycles \amp, Pseq([1, 1, 0.6, 0.6], 4), \startPos, Pseq([0.57, 0.4, 0.8, 0.65],4), \attack, 0.01, \release,Pseq([ 0.5, 1, 1, 1], inf), \buffer, ~kanye, // which buffer to play from \dur, Pseq([0.5, Rest(0.25), 1, 1], inf) ); ~hihat2 = Pbind( \instrument, "hihat", \dur, Pseq([0.125], inf), \att, 0.01, \rel, Pseq([0.3, 1, 0.1, 0.3], inf), \ffreq, 11000 *Pwhite(0.3, 0.9), \pan, Pwhite(-1, 1), \amp, 0.1 * Pwhite(0.1, 1.8) ); ~snare2 = Pbind( \instrument, "snare", \dur, Pseq([1,1], inf), \att, 0.01, \rel, Pseq([0.1, 0.1, 0.1, 0.75, 0.1, 0.1, 0.1, 0.75],inf), \sinfreq, 0, \ffreq, 200, \amp, 0.2 ); ~kick2 = Pbind( \instrument, "kick", \dur, Pseq([1, 0.25, Rest(0.25), 0.125, 0.125, Rest(0.25)], inf), \att, 0.01, \rel, 0.22, \sinfreq, 60, \glissf, 0.9, \amp, 0.7 ); ~down = Pbind( \instrument, "sawSynth", \freq, Pseq([55, 65.41, 82.41, 98].reverse, 4), \dur, Pseq([1/8, 1/8, 1/8, 1/8, 1/8, 1/8, 1/8], 4), \ctranspose, [0, -12], \att, 0.01, \rel, 0.2, \amp, 0.4, \lofreq, 100, \hifreq, 1000 ); ~up = Pbind( \instrument, "sawSynth", \freq, Pseq([55, 65.41, 82.41, 98], 4), \dur, Pseq([1/8, 1/8, 1/8, 1/8, 1/8, 1/8, 1/8], 4), \ctranspose, [0, -12], \att, 0.01, \rel, 0.2, \amp, 0.4, \lofreq, 100, \hifreq, 1000 ); ~down2 = Pbind( \instrument, "sawSynth", \freq, Pseq([72, 72, 66, 66].reverse, 4), \dur, Pseq([1/8, 1/8, 1/8, 1/8, 1/8, 1/8, 1/8], 4), \ctranspose, [0, -12], \att, 0.01, \rel, 0.2, \amp, 0.4, \lofreq, 100, \hifreq, 1000 ); ~up2 = Pbind( \instrument, "sawSynth", \freq, Pseq([80, 76, 72, 70], 4), \dur, Pseq([1/8, 1/8, 1/8, 1/8, 1/8, 1/8, 1/8], 4), \ctranspose, [0, -12], \att, 0.01, \rel, 0.2, \amp, 0.4, \lofreq, 100, \hifreq, 1000 ); ~lowbuild = Pbind( \instrument, "lowbuild", \sinfreq, Pseq([100,90, 80, 70, 60 ], 1), \dur, Pseq([2, 1, 0.5, 0.25, 0.15],inf), \amp, 0.2, \rel, 2, \glissf, Pseq([0.5], inf) ); ~lowbuild2 = Pbind( \instrument, "lowbuild", \sinfreq, Pwhite(100, 200), \dur, Prand([0.1, Rest(0.1), 0.3, 0.2],20), \amp, 0.2, \rel, 2, \glissf, Pseq([4], inf) ); ~lowbuild3 = Pbind( \instrument, "lowbuild", \sinfreq, Pwhite(200, 400), \dur, Prand([0.1, Rest(0.1), 0.3, Rest(0.2)],20), \amp, 0.2, \rel, 2, \glissf, Pseq([0.2], inf) ); ~kanye2 = Pbind( \instrument, "sampler", \rate, Pseq([1.2], inf), // notice this one ENDS after 4 cycles \amp, Pseq([1, 1, 0.6, 0.6], 4), \startPos, Pseq([0.4, 0.2, 0.3, 0.8],4), \attack, 0.01, \release,Pseq([ 0.5, 1, 1, 1], inf), \buffer, ~kanye, // which buffer to play from \dur, Pseq([0.5, Rest(0.25), 1, 1], inf) ); ~hihat3 = Pbind( \instrument, "hihat", \dur, Pseq([0.0833333333], inf), \att, 0.02, \rel, Pseq([0.2, 0.4, 0.1, 0.15], inf), \ffreq, Pwhite(700, 18000), \pan, Pwhite(-1, 1), \amp, 0.1 * Pwhite(0.1, 1.8) ); ~fight2 = Pbind( \instrument, "sampler", \rate, Pseq([3], inf), // notice this one ENDS after 4 cycles \amp, Pseq([1, 1, 0.6, 0.6], 4), \startPos, Pseq([0.9, 0.2, 0.25, 0.7],4), \attack, 0.01, \release,Pseq([ 2, 1, 1, 1], inf), \buffer, ~fight, // which buffer to play from \dur, Pseq([2, Rest(0.25), 1, 1], inf) ); ) // end of Pbind definitions // ============ // Quick test // ============ ~hihat1.play; ~snare1.play; ~kick1.play; ~bass1.play; ~pulse.play; ~fightspeech.play; ~speech1.play; ~speech2.play; ~up.play; ~hihat2.play; ~hihat3.play; // ===================== // Sequencing & playing // using Pspawner // ===================== ( Pspawner({ arg maestro; "start".postln; ~drumbeat1 = maestro.par(Ppar([ ~kick1, ~hihat1])); maestro.wait(4); ~drumbeat12 = maestro.par(Ppar([~pulse, ~snare1])); maestro.par(~fightspeech); maestro.seq(~speech1); maestro.seq(~speech2); maestro.suspend(Ppar([~fightspeech, ~drumbeat1])); maestro.wait(2); ~drumbeat2 = maestro.par(Ppar([~kick2, ~snare2, ~hihat2])); maestro.seq(~kanye1); maestro.wait(4); maestro.seq(Ppar([~up, ~down])); maestro.seq(~up); maestro.seq(Ppar([~up, ~down])); maestro.seq(~down); maestro.seq(Ppar([~up, ~down])); maestro.seq(~up); maestro.seq(Ppar([~up, ~down])); maestro.seq(~down); maestro.seq(Ppar([~up2, ~down2])); maestro.seq(~up2); maestro.seq(Ppar([~up2, ~down2])); maestro.seq(~down2); maestro.suspend(~drumplayer2); maestro.par(Ppar([~hihat3, ~snare2, ~kick2, ~fight2])); maestro.seq(~lowbuild); maestro.seq(~lowbuild2); maestro.seq(~lowbuild3); maestro.seq(~kanye1); maestro.seq(Ppar([~speech1, ~kanye2])); maestro.seq(~speech2); "end".postln; maestro.suspendAll; }).play ) s.record; s.stopRecording;