// title: 115 Final // author: kkomers // description: // code: ~a = Buffer.read(s,"/Users/krystof/Downloads/Final tracks/american life drum.wav"); ~a.play; ~f = Buffer.read(s,"/Users/krystof/Downloads/Final tracks/american life bass long.wav"); ~f.play; ~w = Buffer.read(s, "/Users/krystof/Downloads/Final tracks/american life 2.wav"); ~w.play; a = {Out.ar(0, SinOsc.ar(freq: [800, 880], mul: LFPulse.ar(2)))}.play; {PlayBuf.ar(2, ~a)}.play; [~w.bufnum, ~a.numChannels, ~a.path, ~a.numFrames]; (~granny= ( SynthDef("granny1", {arg rate = 1, amp = 7, buffer, startPos = 0, attack = 0, release = 20, panning = 0; var snd, env; env = Env.perc(attackTime: attack, releaseTime: release, level: amp).kr(doneAction: 2); snd = PlayBuf.ar( numChannels: 1, bufnum: 1, rate: rate, startPos: startPos.linlin(1, 10 , 0, BufFrames.kr(buffer)) ); snd = Pan2.ar(snd, panning); Out.ar(0, snd); }).add; ) ) (~granny2= ( SynthDef("granny1", {arg rate = 1, amp = 7, buffer, startPos = 0, attack = 0, release = 20, panning = 0; var snd, env; env = Env.perc(attackTime: attack, releaseTime: release, level: amp).kr(doneAction: 2); snd = PlayBuf.ar( numChannels: 1, bufnum: 0, rate: rate, startPos: startPos.linlin(1, 10 , 0, BufFrames.kr(buffer)) ); snd = Pan2.ar(snd, panning); Out.ar(0, snd); }).add; ) ) (~granny3= ( SynthDef("granny1", {arg rate = 1, amp = 7, buffer, startPos = 0, attack = 0, release = 20, panning = 0; var snd, env; env = Env.perc(attackTime: attack, releaseTime: release, level: amp).kr(doneAction: 2); snd = PlayBuf.ar( numChannels: 1, bufnum: 2, rate: rate, startPos: startPos.linlin(1, 10 , 0, BufFrames.kr(buffer)) ); snd = Pan2.ar(snd, panning); Out.ar(0, snd); }).add; ) ) ~granny3.play; ( ~ama = Pbind( \instrument, "am1", \midinote, Prand([72, 79, 77, 79, 82, 79, 87, 86, 84, 82, 84, 79], 20), \ctranspose, [-12, 0, 4], \dur, Pseq([Pn(0.2, 5), 0.3], inf), \amp, 0.2, \att, Pwhite(0.5, 1.8), \rel, Pwhite(0.3, 3), \modfreq, Pwhite(20, 100), \pos, Pwhite(-0.5, 0.5) ).play ) (~strum= Pbind( \strum, 1/Pstep([32,16,3,12],2,4), \degree, Pseq([ [0,2,4,6], [-1,2,4,6], [0,2,4,6], [0,2,4,6]-2, ],4), \octave, 5, \dur, 1, \decay, Pseq([1],inf), \amp, 0.4, ) ); (~strum2= Pbind( \strum, 2/Pstep([32, 10, 3, 15], 1, 2), \degree, Pseq([ [0,2,4,6], [-2,0,2,4], [0, 3, 6], [0,2,4,6]-2, ],2), \amp, 0.4, ) ); (~electricguitar = Pbind( \instrument, "electric", \note, Pseq([2, 4, 3, 5, 7, 6],3), \legato, 1.0, \octave, 5, \ffreqtab, [[ 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8, 2, 4, 6, 8]], \dur, Pseq([0.1,0.1, 0.1, 0.15, 0.1, 0.1, 0.1, 0.15], 3), \amp, 4 ) ); (~electricguitar2 = Pbind( \instrument, "electric", \note, Pseq([9,7,6,5,3,4],9), \legato, 1.0, \octave, 4, \ffreqtab, [[ 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8, 2, 4, 6, 8]], \dur, Pseq([0.1,0.1, 0.1, 0.15, 0.1, 0.1, 0.1, 0.15], 9), \amp, 4 ) ); (~electricguitar3 = Pbind( \instrument, "electric", \note, Pseq([ 3,4],1), \legato, 3.0, \octave, 4, \ffreqtab, [[ 3,4]], \dur, Pseq([3,2], 1), \amp, 4, \attack, 4, ) ); (~electricguitar4 = Pbind( \instrument, "electric", \note, Pseq([2, 5, 4, 3, 6, 5],1), \legato, 1.0, \octave, 5, \ffreqtab, [[ 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8, 2, 4, 6, 8]], \dur, Pseq([1, 2, 2, 1, 2, 2], 1), \amp, 4, \attack, 4, ) ); ~electricguitar.play; ~electricguitar2.play; ~electricguitar3.play; ~electricguitar4.play; ( ~symbals = Pbind( \instrument, "symbals", \degree, Pseq([0.1, 0.1, 0.2, 0.4, 0.7, 1, 1.5, 2], 8), \dur, Pseq([0.2, Rest(0.2), 0.2, Rest(0.2), 0.2, Rest(0.4), 0.2], 8);, \attackTime, 0.34, \amp, 0.75, ) ); (~go = Pbind( \instrument, "synth2", \degree, Pseq([0.1, 0.1, 0.2, 0.4, 0.7, 1, 1.5, 2], 4), \dur, Pseq([0.2, Rest(0.2), 0.2, Rest(0.2), 0.2, Rest(0.4), 0.2], 4);, \attackTime, 0.34, \amp, 0.75, ) ); ~go.play; ( ~bassfill = Pbind( \instrument, "synth3", \degree, Pseq([7,6,5,3], inf), \octave, 3.5, \dur, Pseq([0.8, 0.7, 0.6,0.3], 1), \attackTime, 0.5, \amp, 0.9, ) ); ( ~bassfill2 = Pbind( \instrument, "synth3", \degree, Pseq([6,5,4,3], inf), \octave, 3.5, \dur, Pseq([0.4, 0.35, 0.3, 0.15], 2), \attackTime, 0.5, \amp, 0.9, ) ); (~syncopation = Pbind( \instrument, "synth1", \degree, Pseq([3,1,2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 1,1], 6), \dur, Pseq([0.3, 0.12, 0.12, 0.12, 0.3, 0.12, 0.12, 0.12], 6), \attackTime, 0.1, \amp, 0.1, ) ); ~syncopation.play; (~syncopation2= Pbind( \instrument, "synth1", \degree, Pseq([3,1,2, 3], [2, 1, 2, 3], [2, 1, 2, 3], [2, 1, 1,1], 4), \dur, Pseq([0.12, 0.24, 0.3, 0.12, 0.24, 0.3], 4), \attackTime, 0.1, \amp, 0.1, ) ); (~syncopation3 = Pbind( \instrument, "synth1", \degree, Pseq([3,1,2, 3], [2, 1, 2, 3], [2, 1, 2, 3], [2, 1, 1,1], 16), \dur, Pseq([0.2, Rest(0.2), 0.2, Rest(0.2), 0.2], 16), \attackTime, 0.1, \amp, 0.1, ) ); ~syncopation3.play; (~riff = Pbind( \instrument, "synth1", \degree, Pseq([1,1,1,1,4,4,4,4,2,2,2], 4), \octave, 3, \dur, Pseq([0.3,0.3], 4), \attackTime, 0.1, \amp, 0.2, ) ); // example 1 ( { BPF.ar( in: LFPulse.ar( freq: LFNoise0.kr(10).range(100, 1000), mul: 0.3), freq: MouseY.kr(100, 4000), rq: 0.1 ) }.play; ) // example 2 ( SynthDef("wow", { arg freq = 500, amp = 1; var env, snd; env = Env.perc(level: amp).kr(2); snd = BPF.ar( in: LFPulse.ar( freq: LFNoise0.kr([8,19]).range(freq, freq*2), mul: env), freq: MouseY.kr(500, 2500), rq: 0.1 ); Out.ar(0, snd); }).add; ) // test it (single "note") Synth("wow"); // using it in a Pbind ( Pbind( \instrument, "hihat", \freq, Pwhite(50, 2000), \dur, Pwhite(0.5, 2), \amp, 1 ).play; ) ( SynthDef("alien", { arg freq = 500, amp = 4; var env, snd; env = Env.perc(level: amp).kr(2); snd = BPF.ar( in: LFPulse.ar( freq: LFNoise0.kr([8,19]).range(freq, freq*2), mul: env), freq: MouseY.kr(500, 2500), rq: 0.1 ); Out.ar(0, snd); }).add; ) ( SynthDef("hihat", {arg out = 0, amp = 0.5, att = 0.01, rel = 0.2, freq = 1000, pan = 0; var env, snd; env = Env.perc(attackTime: 0.3, releaseTime: 2, level: 0.2).kr(2); snd = BPF.ar( in: LFPulse.ar( freq: LFNoise0.kr([8,19]).range(freq)), ); Out.ar(out, Pan2.ar(snd, pan)); }).add; ) ( SynthDef("synth1", { arg freq, amp, pan = 0; var out, pluck, period, string; freq = freq * [0.99,1,2,0.98]; pluck = PinkNoise.ar(Decay.kr(Line.kr(1, 0, 0.05), 0.05)); period = freq.reciprocal; string = CombL.ar(pluck, period, period, 4); out = LeakDC.ar(LPF.ar(string, 12000)); out = Splay.ar(out, XLine.ar(0.1,1,0.3)); out = out * XLine.ar(1,1/1000,4, doneAction:2); Out.ar(0, Pan2.ar(out, pan, amp) * 0.4); } ).send(s); ) ( SynthDef("synth2", { arg freq = 100, amp, pan = 0; var out, pluck, period, string; freq = freq * [0.99,1,2,0.98]; pluck = PinkNoise.ar(Decay.kr(Line.kr(1, 0, 0.05), 0.05)); period = freq.reciprocal; string = CombL.ar(pluck, period, period, 4); out = LeakDC.ar(LPF.ar(string, 12000)); out = Splay.ar(out, XLine.ar(0.1,1,0.3)); out = out * XLine.ar(1,1/1000,4, doneAction:2); Out.ar(0, Pan2.ar(out, pan, amp) * 0.4); } ).send(s); ) ( SynthDef("synth3", { arg freq, amp, pan = 0; var out, pluck, period, string; freq = freq * [0.98]; out = SinOsc.ar(freq); out = Splay.ar(out, XLine.ar(0.1,1,0.3)); out = out * XLine.ar(1,1/1000,2, doneAction:2); Out.ar(0, Pan2.ar(out, pan, amp) * 0.4); } ).send(s); ) (~fm = SynthDef("fm", { arg freq = 220, mod_ratio = 0.5, car_ratio = 1, amp_att = 0.01, amp_dec = 0.01, amp_sust = 2, amp_rel = 3, mod_att = 0.01, mod_dec = 0.01, mod_sust = 2, mod_rel = 3, mul = 0.1; var amp_env, freq_env, mod_env, mod_osc, car_osc, source, sig, out; amp_env = EnvGen.ar(Env.new( [0.00001, 1, 0.95, 0.95, 0.00001], [amp_att, amp_dec, amp_sust, amp_rel], 'exponential'), doneAction: 2); freq_env = EnvGen.ar(Env.new( [0.02, 0.00001, 0.00001, 0.01, -0.01], [amp_att, amp_dec, amp_sust, amp_rel], 'linear')); //the modulation envelope mod_env = EnvGen.ar(Env.new( [200, 200, 1, 1, 1], [mod_att, mod_dec, mod_sust, mod_rel], 'exponential')); mod_osc = SinOsc.ar(freq * mod_ratio) * mod_env; car_osc = SinOsc.ar(freq * car_ratio, mod_osc*[0.9, 1, 1.1]).mean; //car_osc = SinOsc.ar(freq * car_ratio, mod_osc); source = car_osc; sig = source; out = source * amp_env * mul ! 2; Out.ar(0, out); }).add ) ~fm.play; ( SynthDef("am1", {arg freq = 440, modfreq = 2, amp = 0.2, att = 0.01, rel = 3; var carrier, modulator, env; env = Env.perc( attackTime: att, releaseTime: rel, level: amp ).kr(2); modulator = SinOsc.ar(modfreq).range(0, 1); carrier = SinOsc.ar(freq: freq, mul: env * modulator); Out.ar(0, carrier ! 2); }).add; ) ( SynthDef("electric", { arg out = 0, freq = 300, amp = 1, gate = 1, spread = 0.8, noiselevel = 0.2, minfreq = 50, decaytime = 1, ffreq = 500, rq = 0.3, vibratoSpeed = 0, vibratoDepth = 10; // adsr as NamedControl; // ffreqtab as NamedControl; var env, sig; env = EnvGen.kr( envelope: NamedControl.kr(\adsr, Env.adsr(0.5, 0.1, 0.8, 0.4)), gate: gate, doneAction: 2); sig = WhiteNoise.ar(noiselevel) + ClipNoise.ar(noiselevel); sig = sig + AllpassC.ar( in: sig, maxdelaytime: 1/minfreq, delaytime: 1/(freq + SinOsc.kr(vibratoSpeed, mul: vibratoDepth)), decaytime: decaytime); sig = RLPF.ar( in: sig, freq: ffreq * NamedControl.kr(\ffreqtab, (1!10)), rq: rq); sig = Splay.ar(sig, spread: spread); sig = sig * env * amp; Out.ar(out, sig); }).add; ) ( SynthDef("symbals", { | decay = 3, amp = 1, freq = 440 | f = WhiteNoise.ar; f = LPF.ar(f, 12000); //f = f+ DelayC.ar(f, 0.1,LFNoise2.ar(1/2).range(0.001,0.01)); f = HPF.ar(f, 4000, 0.05); f = f * EnvGen.kr(Env.perc(0.01,decay*0.8), doneAction:2); Out.ar(0, 15 * f.dup * amp); }).store; ) ( SynthDef("kick", { | decay = 0.03, amp = 1, freq = 40 | var f = SinOsc.ar(freq*XLine.ar(2.4,1/4,0.4)); f = f * EnvGen.kr(Env.perc(0.0001,decay), doneAction:2); Out.ar(0,f.dup * amp * 1); }).store; ) t = TempoClock.default.tempo = 91 ( Ppar([ Pbind( \instrument, \guitar, \strum, 2/Pstep([32,16,3,12],2,inf), \degree, Pseq([ [0,2,4,6], [-1,2,4,6], [0,2,4,6], [0,2,4,6]-2, ],inf), \octave, 5, \dur, 1, \decay, Pseq([1],inf), ), Ppar([ Pbind(\instrument, \kick, \dur, 1/4, \decay, Pstep([2,0.3],1/4,inf) * 0.7, \octave, 4, \amp, Pstep([1,0,0,1, 0,0,1,0, 0,0.2,1,0, 0,0,0,0],1/4,inf)), Pbind(\instrument, \ch, \decay, 0.3, \dur, 1/Pstep([8,4,4,4,1,1,6,1],1,inf), \decay, Pn(Pseg([0.3,0.1],1)) / 2, \amp, Pstep([0,0,0,0, 1,0,0,0, 0,0,0,0, 1,0,0,0],1/4,inf) + (0.1*Pn(Pseg([0,0.4],1))) ) ]) ]).play; ) // Add Bjorn's Patented Dub Echo: ~echo = Synth(\dubecho, [\length, TempoClock.default.beatDur*(3/4), \fb, 0.7, \sep, 0.0012], addAction: \addToTail); ~echo.free //Final PART !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ( ~bassfill = Pbind( \instrument, "synth3", \degree, Pseq([7,6,5,3], inf), \octave, 3.5, \dur, Pseq([0.8, 0.7, 0.6,0.3], 1), \attackTime, 0.1, \amp, 0.9, ) ); ( { "bassfill".postln; ~bassfill.play; }.fork; ) ( Pspawner({arg maestro; maestro.seq(~x); maestro.par(~strum); maestro.wait(2); "Strum2".postln; maestro.par(~strum2); maestro.par(~granny); maestro.seq(~bassfill); }).play; ) ( ~riff5 = Pbind( \degree, Pseq([0, 7], 5), \dur, inf, \mul, 2, \attackTime, 0.4, \decayTime, 3, ) ); ~riff5.play; (~syncopation5 = Pbind( \instrument, "synth1", \degree, Pseq([-1, 0], 150), \dur, 0.05, \amp, 0.1, ) ); ~syncopation5.play; (~syncopation6 = Pbind( \instrument, "synth1", \degree, Pseq([-1, 0], 12), \dur, 0.05, \amp, 0.1, \decay, 3, \release, 3, ) ); ~syncopation6.play; (~electricguitar5 = Pbind( \instrument, "electric", \note, Pseq([8,10,12],3), \legato, 2.0, \octave, 1, \ffreqtab, [[ 8, 10]], \dur, Pseq([ 3], 4.2), \amp, 1 ) ); ~electricguitar5.play; //15sec (~electricguitar6 = Pbind( \instrument, "electric", \note, Pseq([8,10,12],3), \legato, 2.0, \octave, 1, \ffreqtab, [[ 8, 10]], \dur, Pseq([ 3], 3), \amp, 1, \decay, 1, \release, 5, ) ); ~electricguitar6.play; ( ~symbals5 = Pbind( \instrument, "symbals", \degree, Pseq([0.1, 0.1, 0.2, 0.4, 0.7, 1, 1.5, 2], 8), \dur, Pseq([1], inf), \attackTime, 0.34, \amp, 0.75, ) ); ~symbals5.play; (~go5 = Pbind( \instrument, "synth2", \degree, Pseq([-1,0], inf), \dur, Pseq([3], 10);, \attackTime, 0.34, \amp, 0.75, ) ); ~go5.play ( ~bassfill5 = Pbind( \instrument, "synth3", \degree, Pseq([1,3], inf), \octave, 3.5, \dur, Pseq([2,4], inf), \attackTime, 0.5, \amp, 0.9, ) ); ~bassfill5.play; // VITAL CODE FOR FINAL PART !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ~ama.play; s.record; ( { ~strum.play; 2.wait; ~strum2.play; "strum2start".postln; 4.wait; "wow1".postln; ~granny.play; 19.wait; "bassfill".postln; ~bassfill.play; ~bassfill2.play; ~fm.play; 1.wait; ~granny2.play; 9.982.wait; ~granny3.play; 3.5.wait; "syncopation".postln; ~syncopation.play; 3.wait; ~strum2.play; 3.wait; "granny2".postln; ~granny2.play; 9.982.wait; "grannyjump".postln; ~syncopation.play; ~granny3.play; 9.wait; ~electricguitar3.play; ~electricguitar4.play; 0.893.wait; ~granny3.play; 9.wait; "wow".postln; ~granny2.play; 5.3.wait; ~electricguitar.play; ~electricguitar2.play; 4.55.wait; "granny3".postln; ~granny3.play; 2.wait; ~electricguitar.play; 2.wait; "electricguitar2".postln; ~electricguitar2.play; 5.7.wait; ~granny2.play; "electricguitar2".postln; ~electricguitar2.play; 9.789.wait; "bridge2".postln; ~granny3.play; 9.9.wait; "wow2".postln; ~granny3.play; ~riff5.play; 2.wait; ~syncopation5.play; 2.wait; ~electricguitar5.play; 2.wait; "ahoj".postln; ~granny2.play; ~symbals5.play; 6.wait; "hi".postln; ~syncopation6.play; ~electricguitar6.play; "end".postln; }.fork; )