Submit
Browse
Anonymous
Login
RSS
SuperCollider Code
Fork Code: Colby's 115granular
name
code content
/* 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, "C:/Users/colby/Desktop/Musc115sample.wav"); c = Buffer.read(s, "C:/Users/colby/Downloads/bad-mono.wav"); // buffer handy tools: b.play; c.play; // checknumber of channels b.numChannels; // check duration b.duration; // check how many samples are in the sample b.numFrames; // SynthDefs ( // simple synthdef, no filters or effects, just env and panning control SynthDef("granny1", {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; // Same as above, but adding a filter just for fun 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: 1, 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; // Same as above, but adding an echo effect (CombC) SynthDef("granny3", {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; ) ( // One ~one = Pbind( \instrument, "granny1", \rate, Pseq([0.5,1, 0.6, 0.92], 4), // notice this one ENDS after 4 cycles \amp, 1, \startPos, 0.1, \attack, 0.01, \release, 0.4, \buffer, c, // which buffer to play from \dur, Prand([0.5, 1], inf), ); // Two ~two = Pbind( \instrument, "granny1", \rate, Pseq([0.2,0.3,0.1,0.13], inf), \amp, 1, \startPos, 0.13, \attack, 0.01, \release, 0.6, \buffer, b, // which buffer to play from \dur, 0.9, ); // Three (this one uses granny2, with the filter) ~three = Pbind( \instrument, "granny2", // notice I'm using granny2 synthdef here \rate, Pseq([1,2,3,4],inf), \amp, 5, // boosted to 5 because filtering attenuates a lot of the sound \startPos, 0.13, \attack, 0.02, \release, 0.4, \ffreq, Pseq([9000, 1000, 2000], inf), \rq, 0.01, \buffer, b, // which buffer to play from \dur, 0.25, \panning, Pwhite(-1, 1.0); ); // Four (this one uses granny3, with a filter AND a CombC (the delay/echo)) ~four = Pbind( \instrument, "granny3", // notice I'm using granny2 synthdef here \rate, Pseq([2, -4, 1, 1,1/2,5,-6], inf), \amp, 1, // boosted to 5 because filtering attenuates a lot of the sound \startPos,0.5, \attack, 0.1, \release, 0.4, \ffreq, Prand([1000, 100, 2000], inf), \rq, 0.1, \delay, 0.1, \decay, 1.5, \buffer, c, // which buffer to play from \dur, 0.5, ); ~five = Pbind( \instrument, "granny2", // notice I'm using granny2 synthdef here \rate, Pseq([-1,0.9,2,-4],inf), \amp, 5, // boosted to 5 because filtering attenuates a lot of the sound \startPos, 0.13, \attack, 0.02, \release, 0.4, \ffreq, Pseq([900, 100, 200], inf), \rq, 0.01, \buffer, c, // which buffer to play from \dur, 0.5, \panning, Pwhite(-0.5, 0.5) ); ~six = Pbind( \instrument, "granny3", // notice I'm using granny2 synthdef here \rate, Pseq([2,3,4,1.5,0.5], inf), \amp, 1, // boosted to 5 because filtering attenuates a lot of the sound \startPos,0.5, \attack, 0.1, \release, 0.4, \ffreq, Prand([550, 1000, 2000], inf), \rq, 0.1, \delay, 0.15, \decay, 2, \buffer, b, // which buffer to play from \dur, 0.5, \panning, Pwhite(-1, 1.0); ); ) ~one.play;//wait till beat// player 5 ~two.play;//player2 ~three.play;//player4 ~four.play;//player6 ~five.play;//player1 ~six.play;//player3 ( { ~player1=~five.play; 5.wait; ~player2=~two.play; 2.wait; ~player2.stop; 1.wait; ~player3=~six.play; 4.wait; ~player4=~three.play; 2.wait; ~player1.stop; 5.wait; ~player1=~five.play; 3.wait; ~player6=~four.play; 7.wait; ~player3.stop; ~player2.stop; ~player4.stop; ~player5.stop; ~player6=~four.play; 4.wait; ~player1.stop; 3.wait; ~player3=~six.play; 4.wait; ~player2.play; 3.wait; ~player1.stop; ~player2.stop; ~player3.stop; ~player4.stop; ~player5.stop; ~player6.stop; }.fork; )
code description
https://soundcloud.com/user-52183734/colbys-project-3-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