// title: 115 final project // author: Mason McCormack // description: // 115 final project // // https://soundcloud.com/macdaddymase/music-115-final-project // code: // ================================= // 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 = Buffeer.read(s,"/Users/Mason/Desktop/music class /some of them want to use you mono.wav"); c = Buffer.read(s, "/Users/Mason/Desktop/Sweet Dreams Eurythmics mono.wav"); d = Buffer.read(s, "/Users/Mason/Desktop/final project final/Sweet Dreams Eurythmics start monosup.wav"); e = Buffer.read(s, "/Users/Mason/Desktop/music class /Nena ‎- 99 Luftballons cut 1 mono.wav"); // buffer handy tools: b.play; // check number of channels b.numChannels; // check duration b.duration; // check how many samples are in the sample b.numFrames; c.play; d.play e.play f.play; // 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; ) ( ~threeA= Pbind( \instrument, "granny1", // notice I'm using granny2 synthdef here \rate, Pseq([ 0.8], ), \amp, 1, // boosted to 5 because filtering attenuates a lot of the sound \attack, 10, \release, 0.01, \buffer, c, // which buffer to play from \dur, 0.09, \startPos, Pseq([0.20], inf), \panning, Pwhite(-0.5, 0.5) ); ~threeA.play; ) ( ~threeB = Pbind( \instrument, "granny1", // notice I'm using granny2 synthdef here \rate, Pseq([1, ], inf), \amp, 1, // boosted to 5 because filtering attenuates a lot of the sound \attack, 0.06, \release, 0.7, \buffer, e, // which buffer to play from \dur, 0.45, \panning, Pwhite(-0.5, 0.5) ); ~threeB.play; ) ( ~threeC = Pbind( \instrument, "granny1", // notice I'm using granny2 synthdef here \rate, Pseq([ 1], ), \amp, 1, // boosted to 5 because filtering attenuates a lot of the sound \attack, 1, \release, 15, \buffer, e, // which buffer to play from \dur, 2.5, \startPos, Pseq([0.3], inf), \panning, Pwhite(-0.5, 0.5) ); ~threeC.play; ) ( ~threeD = Pbind( \instrument, "granny1", // notice I'm using granny2 synthdef here \rate, Pseq([1.1, ], inf), \amp, 1, // boosted to 5 because filtering attenuates a lot of the sound \attack, 0.06, \release, 0.7, \buffer, e, // which buffer to play from \dur, 0.45, \panning, Pwhite(-0.5, 0.5) ); ~threeD.play; ) ( ~threeE = Pbind( \instrument, "granny1", // notice I'm using granny2 synthdef here \rate, Pseq([0.5, ],), \amp, 1, // boosted to 5 because filtering attenuates a lot of the sound \attack, 0.0001, \release,10, \buffer, e, // which buffer to play from \dur, 0.01, \panning, Pwhite(-0.5, 0.5) ); ~threeE.play; ) ( ~threeF = Pbind( \instrument, "granny1", // notice I'm using granny2 synthdef here \rate, Pseq([0.5, ],), \amp, 1, // boosted to 5 because filtering attenuates a lot of the sound \attack, 1, \release,17, \buffer, c, // which buffer to play from \dur, 1, \panning, Pwhite(-0.5, 0.5) ); ~threeF.play; ) // Some testing Pbinds // One ( ~one = Pbind( \instrument, "granny1", // notice I'm using granny2 synthdef here \rate, Pseq([1, ]), \amp, 2, // boosted to 5 because filtering attenuates a lot of the sound \attack, 0.06, \release, 0.8, \ffreq, Pseq([500], inf), \rq, 0.11, \buffer, d, // which buffer to play from \dur, 1.5, \panning, Pwhite(-0.5, 0.5) ); ) ~one.play; // Two ( ~two = Pbind( \instrument, "granny2", // notice I'm using granny2 synthdef here \rate, Pseq([0.89, ], inf), \amp, 10, // boosted to 5 because filtering attenuates a lot of the sound \attack, 0.06, \release, 0.7, \ffreq, Pseq([375], inf), \rq, 0.11, \buffer, e, // which buffer to play from \dur, 0.45, \panning, Pwhite(-0.5, 0.5) ); ) ~two.play; // Three (this one uses granny2, with the filter) ( ~three = Pbind( \instrument, "granny2", // notice I'm using granny2 synthdef here \rate, Pseq([1, ], inf), \amp, 10, // boosted to 5 because filtering attenuates a lot of the sound \attack, 0.06, \release, 0.7, \ffreq, Pseq([375], inf), \rq, 0.11, \buffer, e, // which buffer to play from \dur, 0.45, \panning, Pwhite(-0.5, 0.5) ); ) ~three.play ( ~four = Pbind( \instrument, "granny2", // notice I'm using granny2 synthdef here \rate, Pseq([2, ], inf), \amp, 10, // boosted to 5 because filtering attenuates a lot of the sound \attack, 0.06, \release, 0.7, \ffreq, Pseq([375], inf), \rq, 0.11, \buffer, e, // which buffer to play from \dur, 0.45, \panning, Pwhite(-0.5, 0.5) ); ) ~four.play ( ~five = Pbind( \instrument, "granny2", // notice I'm using granny2 synthdef here \rate, Pseq([1.5, ], inf), \amp, 10, // boosted to 5 because filtering attenuates a lot of the sound \attack, 0.06, \release, 0.7, \ffreq, Pseq([375], inf), \rq, 0.11, \buffer, e, // which buffer to play from \dur, 0.45, \panning, Pwhite(-0.5, 0.5) ); ) ~five.play; ( ~six = Pbind( \instrument, "granny2", // notice I'm using granny2 synthdef here \rate, Pseq([1.7, ], inf), \amp, 10, // boosted to 5 because filtering attenuates a lot of the sound \attack, 0.06, \release, 0.7, \ffreq, Pseq([375], inf), \rq, 0.11, \buffer, e, // which buffer to play from \dur, 0.45, \panning, Pwhite(-0.5, 0.5) ); ) ~six.play; ); ( ~seven = Pbind( \instrument, "granny2", // notice I'm using granny2 synthdef here \rate, Pseq([1.9, ], inf), \amp, 10, // boosted to 5 because filtering attenuates a lot of the sound \attack, 0.06, \release, 0.7, \ffreq, Pseq([375], inf), \rq, 0.11, \buffer, e, // which buffer to play from \dur, 0.45, \panning, Pwhite(-0.5, 0.5) ); ) ~seven.play; ); ( ~eight = Pbind( \instrument, "granny2", // notice I'm using granny2 synthdef here \rate, Pseq([2, ], inf), \amp, 10, // boosted to 5 because filtering attenuates a lot of the sound \attack, 0.06, \release, 0.7, \ffreq, Pseq([375], inf), \rq, 0.11, \buffer, e, // which buffer to play from \dur, 0.45, \panning, Pwhite(-0.5, 0.5) ); ) ( ~nine = Pbind( \instrument, "granny2", // notice I'm using granny2 synthdef here \rate, Pseq([2.1, ], inf), \amp, 10, // boosted to 5 because filtering attenuates a lot of the sound \attack, 0.06, \release, 0.7, \ffreq, Pseq([375], inf), \rq, 0.11, \buffer, e, // which buffer to play from \dur, 0.45, \panning, Pwhite(-0.5, 0.5) ); ) ( ~ten = Pbind( \instrument, "granny2", // notice I'm using granny2 synthdef here \rate, Pseq([1,1,1 ],), \amp, 10, // boosted to 5 because filtering attenuates a lot of the sound \attack, 0.06, \release, 0.7, \ffreq, Pseq([575], inf), \rq, 0.11, \buffer, c, // which buffer to play from \dur, 0.45, \panning, Pwhite(-0.5, 0.5) ); ) ( ~eleven = Pbind( \instrument, "granny2", // notice I'm using granny2 synthdef here \rate, Pseq([1,1,1 ],), \amp, 10, // boosted to 5 because filtering attenuates a lot of the sound \attack, 0.06, \release, 0.7, \ffreq, Pseq([650], inf), \rq, 0.11, \buffer, c, // which buffer to play from \dur, 0.45, \panning, Pwhite(-0.5, 0.5) ); ) ) ~one.play; ~two.play; ~three.play; ~four.play; ~five.play; ~seven.play; ~eight.play; ~nine.play; ~ten.play; ~threeb.play; ( { ~threeAplay=~threeA.play; 9.wait; ~threeAplay.stop; 1.5.wait; ~threeplay=~three.play; 4.5.wait; ~threeplay.stop; ~fourplay=~four.play; 0.3.wait; ~fourplay.stop; ~fiveplay=~five.play; 4.5.wait; ~fiveplay.stop; ~fourplay=~four.play; 0.3.wait; ~fourplay.stop; ~sixplay=~six.play; 4.5.wait; ~sixplay.stop; ~sevenplay=~seven.play; 1.2.wait; ~sevenplay.stop; ~sixplay=~six.play; 1.2.wait; ~sixplay.stop; ~fiveplay=~five.play; 1.2.wait; ~fiveplay.stop; ~fourplay=~four.play; 0.3.wait; ~threeplay=~three.play; 4.wait; ~threeplay.stop; ~fourplay.stop; ~threeplay.stop; ~fourplay=~four.play; 0.3.wait; ~fourplay.stop; ~fiveplay=~five.play; 4.5.wait; ~fiveplay.stop; ~fourplay=~four.play; 0.3.wait; ~fourplay.stop; ~sixplay=~six.play; 4.5.wait; ~sixplay.stop; ~fourplay=~four.play; 0.3.wait; ~fourplay.stop; ~sevenplay=~seven.play; 1.2.wait; ~sevenplay.stop; ~sixplay=~six.play; 1.2.wait; ~sixplay.stop; ~fiveplay=~five.play; 1.2.wait; ~fiveplay.stop; ~fourplay=~four.play; 0.3.wait; ~fourplay.stop; ~threeBplay=~threeB.play; 4.6.wait; ~threeBplay.stop; ~fourplay=~four.play; 0.3.wait; ~fourplay.stop; ~threeplay=~three.play; 4.5.wait; ~fourplay=~four.play; 0.3.wait; ~fourplay.stop; ~threeplay.stop; ~fiveplay=~five.play; 4.5.wait; ~fiveplay.stop; ~fourplay=~four.play; 0.3.wait; ~fourplay.stop; ~sixplay=~six.play; 3.6.wait; ~sixplay.stop; ~sevenplay=~seven.play; 1.2.wait; ~sevenplay.stop; ~eightplay=~eight.play; 3.6.wait; ~eightplay.stop; ~threeEplay=~threeE.play; 7.wait; ~threeEplay.stop; ~threeDplay=~threeD.play; 4.9.wait; ~threeDplay.stop; ~fourplay=~four.play; 0.3.wait; ~fourplay.stop; ~threeBplay=~threeB.play; 4.9.wait; ~threeplay=~three.play; ~threeBplay.stop; 0.3.wait; ~threeplay.stop; ~threeDplay=~threeD.play; 1.2.wait; ~threeDplay.stop; ~twoplay=~two.play; 1.2.wait; ~threeplay=~three.play; ~twoplay.stop; 1.2.wait; ~threeplay.stop; ~fourplay=~four.play; 3.wait; ~fourplay.stop; ~threeplay=~three.play; 3.wait; ~threeplay.stop; ~sixplay=~six.play; 4.5.wait; ~sixplay.stop; ~sevenplay=~seven.play; 1.2.wait; ~sevenplay.stop; ~sixplay=~six.play; 1.2.wait; ~sixplay.stop; ~fiveplay=~five.play; 1.2.wait; ~fiveplay.stop; ~threeDplay=~threeD.play; 4.5.wait; ~threeDplay.stop; ~threeBplay=~threeB.play; 4.5.wait; ~threeBplay.stop; ~twoplay=~two.play; 1.2.wait; ~threeplay=~three.play; ~twoplay.stop; 1.2.wait; ~threeplay.stop; ~fiveplay=~five.play; 1.2.wait; ~fiveplay.stop; ~twoplay=~two.play; 1.2.wait; ~threeplay=~three.play; 1.wait; ~twoplay.stop; ~fourplay=~four.play }.fork; )