Submit
Browse
Anonymous
Login
RSS
SuperCollider Code
Fork Code: Good Life 115granular
name
code content
// ================================= // A4 - musc-115-granular // GRANULAR SAMPLING // ================================= /* The code below is exactly what we built in class. You will need a MONO sample. */ // make sure to boot server first // load a sound file (or two...) b = Buffer.read(s, "/Users/harrisonwright/Desktop/Good life .wav"); c = Buffer.read(s, "/Users/harrisonwright/Desktop/acapella good life beginning sc.wav"); d = Buffer.read(s, "/Users/harrisonwright/Desktop/play 2nd vocals.wav"); e = Buffer.read(s, "/Users/harrisonwright/Desktop/LSE Kick 3 copy.wav"); f = Buffer.read(s, "/Users/harrisonwright/Desktop/good life saying.wav"); g = Buffer.read(s, "/Users/harrisonwright/Desktop/riser.wav"); k = Buffer.read(s, "/Users/harrisonwright/Desktop/four.wav"); // buffer handy tools: g.play; // check number of channels d.numChannels; // check duration h.duration; // check how many samples are in the sample c.numFrames; // SynthDefs ( SynthDef("shortcuts", {arg rate = 1, amp = 1, buffer, startPos = 0, attack = 0.02, release = 0.5, ffreq = 1000, rq = 0.1, panning = 0; var snd, env; env = Env.perc(attackTime: attack, releaseTime: release, level: amp).kr(doneAction: 2); snd = PlayBuf.ar( numChannels: 2, bufnum: buffer, rate: rate, startPos: startPos.linlin(0, 1, 0, BufFrames.kr(buffer)) ); snd = snd * env; snd = BPF.ar(snd, ffreq, rq); snd = Pan2.ar(snd, panning); Out.ar(0, snd); }).add; SynthDef("play", {arg rate = 1, amp = 1, buffer, startPos = 0, attack = 0.02, release = 0.5, panning = 0, ffreq, dur; var snd, env; env = Env.linen(attackTime: 0, sustainTime: dur, releaseTime: 0, level: amp).kr(doneAction: 2); snd = PlayBuf.ar( numChannels: 2, bufnum: buffer, rate: rate, startPos: startPos.linlin(0, 1, 0, BufFrames.kr(buffer)) ); snd = snd; snd = HPF.ar(snd, ffreq, env); snd = Pan2.ar(snd, panning); Out.ar(0, snd); }).add; SynthDef("granny2", {arg rate = 1, amp = 1, buffer, startPos = 0, attack = 0.02, release = 0.5, ffreq = 1000, rq = 0.1, panning = 0; var snd, env; env = Env.perc(attackTime: attack, releaseTime: release, level: amp).kr(doneAction: 2); snd = PlayBuf.ar( numChannels: 2, bufnum: buffer, rate: rate, startPos: startPos.linlin(0, 1, 0, BufFrames.kr(buffer)) ); snd = snd * env; snd = BPF.ar(snd, ffreq, rq); snd = Pan2.ar(snd, panning); Out.ar(0, snd); }).add; SynthDef("clap", { |out = 0, amp = 0.5, pan = 0, dur = 1| var env1, env2, snd, noise1, noise2; env1 = EnvGen.ar( Env.new( [0, 1, 0, 0.9, 0, 0.7, 0, 0.5, 0], [0.001, 0.009, 0, 0.008, 0, 0.01, 0, 0.03], [0, -3, 0, -3, 0, -3, 0, -4] ) ); noise1 = WhiteNoise.ar(env1); noise1 = HPF.ar(noise1, 600); noise1 = LPF.ar(noise1, XLine.kr(7200, 4000, 0.03)); noise1 = BPF.ar(noise1, 1620, 3); env2 = EnvGen.ar(Env.new([0, 1, 0], [0.02, 0.18], [0, -4]), doneAction:2); noise2 = WhiteNoise.ar(env2); noise2 = HPF.ar(noise2, 1000); noise2 = LPF.ar(noise2, 7600); noise2 = BPF.ar(noise2, 1230, 0.7, 0.7); snd = noise1 + noise2; snd = snd * 2; snd = snd.softclip; Out.ar(out, Pan2.ar(snd,pan,amp)); }).add; ) // Some testing Pbinds ( ~one = Pbind( \instrument, "play", \rate, 1, \dur, 64, \amp, Pseq([0.25], 1), \startPos, 0, \buffer, c, \panning, 0, \ffreq, 20, ); ~two = Pbind( \instrument, "play", \rate, 1, \dur, 32.041666667, \amp, Pseq([0.25], 1), \startPos, 0, \buffer, d, \panning, 0, \ffreq, 20, ); ~kick = Pbind( \instrument, "play", \rate, 1, \dur, 1, \amp, Pseq([0.1], 4), \startPos, 0, \buffer, e, \panning, 0, \ffreq, 20, ); ~good = Pbind( \instrument, "play", \rate, 1, \dur, 6.0416666667, \amp, Pseq([0.25], 1), \startPos, 0, \buffer, f, \panning, 0, \ffreq, 20, ); ~rise = Pbind( \instrument, "play", \rate, 1, \dur, 6.045, \amp, Pseq([0.45], 1), \startPos, 0, \buffer, g, \panning, 0, \ffreq, 2500, ); ~three = Pbind( \instrument, "shortcuts", \rate, -1, \dur, Pseq([ 5/6, 4/6, 3/6, 3/12, 3/12, 3/12, 9/12, 6/12, 5/6, 4/6, 3/6, 3/6, 3/6, 3/6, 3/6, 5/6, 4/6, 3/6, 3/12, 3/12, 3/12, 9/12, 3/6, 5/6, 4/6, 3/6, 3/6, 3/6, 3/6, 3/6], 1), \amp, 8, \startPos,0.5, \attack, 0.02, \release, 0.4, \ffreq, Pseq([220, 220, 220, 220, 330, 440, 220, 262, 196, 196, 196, 196, 392, 220, 440, 175, 175, 175, 175, 262, 349, 175, 196, 147, 147, 131, 147, 294, 165, 330], 1), \rq, 0.01, \buffer, b, \panning, Pwhite(-0.5, 0.5) ); ~voc = Pbind( \instrument, "granny2", \rate, Prand([2, 2, 2], inf), \amp, 15, \startPos, Pseq([0.25], inf), \attack, 0.02, \release, 0.4, \ffreq, Pseq([165, 165, 165, 165, 165, 147, 147, 147, 147, 147, 130, 130, 130, 130, 130, 110, 110, 110, 110, 110], inf), \rq, 0.01, \buffer, b, \dur, Pseq([5/6, 4/6, 6/6, 6/6, 3/6], 4), \panning, 0, ); ~voc2 = Pbind( \instrument, "granny2", \rate, Prand([2, 2, 2], inf), \amp, 30, \startPos, Pseq([0.25], inf), \attack, 0.02, \release, 0.4, \ffreq, 165, \rq, 0.01, \buffer, b, \dur, Pseq([5/6, 5/6, 5/6, 5/6, 5/6, 5/12, 5/12, 5/12, 5/24, 5/24, 5/24, 5/24], 1), \panning, 0, ); ~three2 = Pbind( \instrument, "shortcuts", \rate, -1, \dur, Pseq([5/6, 5/6, 5/6, 5/6, 5/6, 5/12, 5/12, 5/12, 5/24, 5/24, 5/24, 5/24], 1), \amp, 4, \startPos, 0.5, \attack, 0.02, \release, Pseq([0.4, 0.4, 0.4, 0.4, 0.4, 0.2, 0.2, 0.2, 0.1, 0.1, 0.1, 0.1], 1), \ffreq, 220, \rq, 0.01, \buffer, b, \panning, Pwhite(-0.5, 0.5) ); ~clap = Pbind( \instrument, "clap", \freq, 60, \dur, Pseq([ Rest(1), 2, 2, 2, 2, 2, 2, 2], 1), \amp, 0.5 ); ~clap2 = Pbind( \instrument, "clap", \freq, 60, \dur, Pseq([ Rest(1), 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2], 1), \amp, 0.5 ); ~drops = Pbind( \instrument, "granny2", \rate, Prand([2, 2, 2], inf), \amp, 25, \startPos, Pseq([0.18], inf), \attack, 0.02, \release, 0.4, \ffreq, Pseq([165, 165, 165, 165, 165, 147, 147, 147, 147, 147, 130, 130, 130, 130, 130, 110, 110, 110, 110, 110], inf), \rq, 0.05, \buffer, d, \dur, Pseq([5/6, 4/6, 6/6, 6/6, 3/6], 4), \panning, 0, ); ~drops2 = Pbind( \instrument, "granny2", \rate, Prand([2, 2, 2], inf), \amp, 25, \startPos, Pseq([0.47], inf), \attack, 0.02, \release, 0.4, \ffreq, Pseq([165, 165, 165, 165, 165, 147, 147, 147, 147, 147, 130, 130, 130, 130, 130, 110, 110, 110, 110, 110], inf), \rq, 0.05, \buffer, d, \dur, Pseq([5/6, 4/6, 6/6, 6/6, 3/6], 4), \panning, 0, ); ~drops3 = Pbind( \instrument, "granny2", \rate, Prand([ 2, 2, 1, 2, 3, 1, 1, 1, 1], inf), \amp, 25, \startPos, 0.47, \attack, 0.02, \release, 0.4, \ffreq, Pseq([165, 165, 165, 165, 165, 147, 147, 147, 147, 147, 130, 130, 130, 130, 130, 110, 110, 110, 110, 110], inf), \rq, 0.05, \buffer, d, \dur, Pseq([5/6, 4/6, 6/6, 6/6, 3/6], 4), \panning, 0, ); ~dropfour = Pbind( \instrument, "play", \rate, 1, \dur, 2, \amp, Pseq([0.1], 1), \startPos, 0, \buffer, k, \panning, 0, \ffreq, 20, ); ) //Test Plays ~one.play(TempoClock(126/60)); ~two.play(TempoClock(126/60)); ~kick.play(TempoClock(126/60)); ~good.play(TempoClock(126/60)); ~rise.play(TempoClock(126/60)); ~three.play(TempoClock(126/60)); ~voc.play(TempoClock(126/60)); ~voc2.play(TempoClock(126/60)); ~three2.play(TempoClock(126/60)); ~clap2.play(TempoClock(126/60)); ~dropfour.play(TempoClock(126/60)); // ================================= // Putting stuff together with Pspawner // ================================= ( Pspawner({ arg maestro; s.record; maestro.seq(Ppar([ ~three, ~voc], 1)); maestro.seq(Ppar([ ~clap2, Pseq([~three], 2), Pseq([~voc], 2)], 1)); maestro.seq(Ppar([ ~clap2, Pseq([~three], 2), Pseq([~voc], 2), Pseq([~kick], 8)], 1)); maestro.seq(Ppar([~good, ~voc2, ~three2, Pseq([~kick], 1.5) ], 1)); maestro.seq(Ppar([ ~drops, ~clap, Pseq([~three], 1), Pseq([~voc], 1), Pseq([~kick], 4)], 1)); maestro.seq(Ppar([ ~drops2, ~clap, Pseq([~three], 1), Pseq([~voc], 1), Pseq([~kick], 4)], 1)); maestro.seq(Ppar([ ~drops3, ~clap, Pseq([~three], 1), Pseq([~voc], 1), Pseq([~kick], 4)], 1)); maestro.seq( Ppar([ ~three, ~voc], 1)); maestro.seq(~dropfour); }).play(TempoClock(126/60)); ) s.stopRecording; s.makeWindow;
code description
https://soundcloud.com/user-665612115/good-life-115granular
use markdown for formating
category tags
comma separated, i.g. "wild, siren" (do not enter default SC class names, please)
ancestor(s)
comma separated identificators, i.g. "1-C,1-1,1-4M,1-x"
Private?
the code will be accessible by direct url and not visible in public activity
signup to submit public code without captcha
comment of change