{
   "description" : "115 final project \r\n\r\nhttps://soundcloud.com/macdaddymase/music-115-final-project",
   "ancestor_list" : [],
   "author" : "Mason McCormack",
   "name" : "115 final project",
   "is_private" : null,
   "id" : "1-566",
   "code" : "// =================================\r\n// A4 - musc-115-granular\r\n// GRANULAR SAMPLING\r\n// =================================\r\n\r\n/*\r\nThe code below is exactly what we built in class.\r\nYou will need a MONO sample.\r\n\r\n*/\r\n\r\n// make sure to boot server first\r\n\r\n// load a sound file (or two...)\r\nb = Buffeer.read(s,\"/Users/Mason/Desktop/music class /some of them want to use you mono.wav\");\r\nc = Buffer.read(s, \"/Users/Mason/Desktop/Sweet Dreams Eurythmics mono.wav\");\r\nd = Buffer.read(s, \"/Users/Mason/Desktop/final project final/Sweet Dreams Eurythmics start monosup.wav\");\r\ne = Buffer.read(s, \"/Users/Mason/Desktop/music class /Nena ‎- 99 Luftballons cut 1 mono.wav\");\r\n\r\n\r\n\t\r\n\t\r\n// buffer handy tools:\r\nb.play;\r\n// check number of channels\r\nb.numChannels;\r\n// check duration\r\nb.duration;\r\n// check how many samples are in the sample\r\nb.numFrames;\r\n\r\nc.play;\r\nd.play\r\ne.play\r\nf.play;\r\n\r\n\r\n// SynthDefs\r\n(\r\n// simple synthdef, no filters or effects, just env and panning control\r\nSynthDef(\"granny1\", {arg rate = 1, amp = 1, buffer, startPos = 0, attack = 0.02, release = 0.5, panning = 0;\r\n    var snd, env;\r\n    env = Env.perc(attackTime: attack, releaseTime: release, level: amp).kr(doneAction: 2);\r\n    snd = PlayBuf.ar(\r\n        numChannels: 1,\r\n        bufnum: buffer,\r\n        rate: rate,\r\n        startPos: startPos.linlin(0, 1, 0, BufFrames.kr(buffer))\r\n    );\r\n    snd = snd * env;\r\n\tsnd = Pan2.ar(snd, panning);\r\n    Out.ar(0, snd);\r\n}).add;\r\n\r\n// Same as above, but adding a filter just for fun\r\nSynthDef(\"granny2\", {arg rate = 1, amp = 1, buffer, startPos = 0, attack = 0.02, release = 0.5, ffreq = 1000, rq = 0.1, panning = 0;\r\n    var snd, env;\r\n    env = Env.perc(attackTime: attack, releaseTime: release, level: amp).kr(doneAction: 2);\r\n    snd = PlayBuf.ar(\r\n        numChannels: 1,\r\n        bufnum: buffer,\r\n        rate: rate,\r\n        startPos: startPos.linlin(0, 1, 0, BufFrames.kr(buffer))\r\n    );\r\n    snd = snd * env;\r\n    snd = BPF.ar(snd, ffreq, rq);\r\n    snd = Pan2.ar(snd, panning);\r\n    Out.ar(0, snd);\r\n}).add;\r\n\r\n// Same as above, but adding an echo effect (CombC)\r\nSynthDef(\"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;\r\n    var snd, env;\r\n    env = Env.perc(attackTime: attack, releaseTime: release, level: amp).kr(doneAction: 2);\r\n    snd = PlayBuf.ar(\r\n        numChannels: 1,\r\n        bufnum: buffer,\r\n        rate: rate,\r\n        startPos: startPos.linlin(0, 1, 0, BufFrames.kr(buffer))\r\n    );\r\n    snd = snd * env;\r\n    snd = BPF.ar(snd, ffreq, rq);\r\n\tsnd = CombC.ar(snd, maxdelaytime: 2, delaytime: delay, decaytime: decay);\r\n    snd = Pan2.ar(snd, panning);\r\n    Out.ar(0, snd);\r\n}).add;\r\n\r\n\r\n\r\n)\r\n(\r\n~threeA= Pbind(\r\n    \\instrument, \"granny1\", // notice I'm using granny2 synthdef here\r\n\t\\rate, Pseq([ 0.8], ),\r\n\t\\amp, 1, // boosted to 5 because filtering attenuates a lot of the sound\r\n\r\n    \\attack, 10,\r\n    \\release, 0.01,\r\n    \\buffer, c, // which buffer to play from\r\n    \\dur, 0.09,\r\n\t\\startPos, Pseq([0.20], inf),\r\n\t\\panning, Pwhite(-0.5, 0.5)\r\n);\t\r\n~threeA.play;\r\n)\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n(\r\n~threeB = Pbind(\r\n    \\instrument, \"granny1\", // notice I'm using granny2 synthdef here\r\n\t\\rate, Pseq([1, ], inf),\r\n\t\\amp, 1, // boosted to 5 because filtering attenuates a lot of the sound\r\n\r\n    \\attack, 0.06,\r\n    \\release, 0.7,\r\n    \\buffer, e, // which buffer to play from\r\n    \\dur, 0.45,\r\n\t\\panning, Pwhite(-0.5, 0.5)\r\n);\r\n~threeB.play;\r\n)\r\n\r\n\r\n(\r\n~threeC = Pbind(\r\n    \\instrument, \"granny1\", // notice I'm using granny2 synthdef here\r\n\t\\rate, Pseq([ 1], ),\r\n\t\\amp, 1, // boosted to 5 because filtering attenuates a lot of the sound\r\n\r\n    \\attack, 1,\r\n    \\release, 15,\r\n    \\buffer, e, // which buffer to play from\r\n    \\dur, 2.5,\r\n\t\\startPos, Pseq([0.3], inf),\r\n\t\\panning, Pwhite(-0.5, 0.5)\r\n);\r\n~threeC.play;\r\n)\r\n\r\n\r\n(\r\n~threeD = Pbind(\r\n    \\instrument, \"granny1\", // notice I'm using granny2 synthdef here\r\n\t\\rate, Pseq([1.1, ], inf),\r\n\t\\amp, 1, // boosted to 5 because filtering attenuates a lot of the sound\r\n\r\n    \\attack, 0.06,\r\n    \\release, 0.7,\r\n    \\buffer, e, // which buffer to play from\r\n    \\dur, 0.45,\r\n\t\\panning, Pwhite(-0.5, 0.5)\r\n);\r\n\r\n~threeD.play;\r\n)\r\n\r\n\r\n(\r\n~threeE = Pbind(\r\n    \\instrument, \"granny1\", // notice I'm using granny2 synthdef here\r\n\t\\rate, Pseq([0.5, ],),\r\n\t\\amp, 1, // boosted to 5 because filtering attenuates a lot of the sound\r\n\r\n    \\attack, 0.0001,\r\n    \\release,10,\r\n    \\buffer, e, // which buffer to play from\r\n    \\dur, 0.01,\r\n\t\\panning, Pwhite(-0.5, 0.5)\r\n);\r\n\r\n~threeE.play;\r\n)\r\n\r\n(\r\n~threeF = Pbind(\r\n    \\instrument, \"granny1\", // notice I'm using granny2 synthdef here\r\n\t\\rate, Pseq([0.5, ],),\r\n\t\\amp, 1, // boosted to 5 because filtering attenuates a lot of the sound\r\n\r\n    \\attack, 1,\r\n    \\release,17,\r\n    \\buffer, c, // which buffer to play from\r\n    \\dur, 1,\r\n\t\\panning, Pwhite(-0.5, 0.5)\r\n);\r\n\r\n~threeF.play;\r\n)\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n// Some testing Pbinds\r\n\r\n// One\r\n(\r\n~one = Pbind(\r\n    \\instrument, \"granny1\", // notice I'm using granny2 synthdef here\r\n\t\\rate, Pseq([1, ]),\r\n\t\\amp, 2, // boosted to 5 because filtering attenuates a lot of the sound\r\n\r\n    \\attack, 0.06,\r\n    \\release, 0.8,\r\n\t\\ffreq, Pseq([500], inf),\r\n\t\\rq, 0.11,\r\n    \\buffer, d, // which buffer to play from\r\n    \\dur, 1.5,\r\n\t\\panning, Pwhite(-0.5, 0.5)\r\n);\r\n)\r\n~one.play;\r\n// Two\r\n(\r\n~two = Pbind(\r\n    \\instrument, \"granny2\", // notice I'm using granny2 synthdef here\r\n\t\\rate, Pseq([0.89, ], inf),\r\n\t\\amp, 10, // boosted to 5 because filtering attenuates a lot of the sound\r\n\r\n    \\attack, 0.06,\r\n    \\release, 0.7,\r\n\t\\ffreq, Pseq([375], inf),\r\n\t\\rq, 0.11,\r\n    \\buffer, e, // which buffer to play from\r\n    \\dur, 0.45,\r\n\t\\panning, Pwhite(-0.5, 0.5)\r\n);\r\n)\r\n~two.play;\r\n\r\n// Three (this one uses granny2, with the filter)\r\n(\r\n~three = Pbind(\r\n    \\instrument, \"granny2\", // notice I'm using granny2 synthdef here\r\n\t\\rate, Pseq([1, ], inf),\r\n\t\\amp, 10, // boosted to 5 because filtering attenuates a lot of the sound\r\n\r\n    \\attack, 0.06,\r\n    \\release, 0.7,\r\n\t\\ffreq, Pseq([375], inf),\r\n\t\\rq, 0.11,\r\n    \\buffer, e, // which buffer to play from\r\n    \\dur, 0.45,\r\n\t\\panning, Pwhite(-0.5, 0.5)\r\n);\r\n)\r\n~three.play\r\n\r\n\r\n(\r\n~four = Pbind(\r\n    \\instrument, \"granny2\", // notice I'm using granny2 synthdef here\r\n\t\\rate, Pseq([2, ], inf),\r\n\t\\amp, 10, // boosted to 5 because filtering attenuates a lot of the sound\r\n\r\n    \\attack, 0.06,\r\n    \\release, 0.7,\r\n\t\\ffreq, Pseq([375], inf),\r\n\t\\rq, 0.11,\r\n    \\buffer, e, // which buffer to play from\r\n    \\dur, 0.45,\r\n\t\\panning, Pwhite(-0.5, 0.5)\r\n);\r\n)\r\n~four.play\r\n\r\n\r\n(\r\n~five = Pbind(\r\n    \\instrument, \"granny2\", // notice I'm using granny2 synthdef here\r\n\t\\rate, Pseq([1.5, ], inf),\r\n\t\\amp, 10, // boosted to 5 because filtering attenuates a lot of the sound\r\n\r\n    \\attack, 0.06,\r\n    \\release, 0.7,\r\n\t\\ffreq, Pseq([375], inf),\r\n\t\\rq, 0.11,\r\n    \\buffer, e, // which buffer to play from\r\n    \\dur, 0.45,\r\n\t\\panning, Pwhite(-0.5, 0.5)\r\n);\r\n)\r\n\r\n~five.play;\r\n\r\n(\r\n~six = Pbind(\r\n    \\instrument, \"granny2\", // notice I'm using granny2 synthdef here\r\n\t\\rate, Pseq([1.7, ], inf),\r\n\t\\amp, 10, // boosted to 5 because filtering attenuates a lot of the sound\r\n\r\n    \\attack, 0.06,\r\n    \\release, 0.7,\r\n\t\\ffreq, Pseq([375], inf),\r\n\t\\rq, 0.11,\r\n    \\buffer, e, // which buffer to play from\r\n    \\dur, 0.45,\r\n\t\\panning, Pwhite(-0.5, 0.5)\r\n);\r\n)\r\n\r\n~six.play;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n);\r\n\r\n(\r\n~seven = Pbind(\r\n    \\instrument, \"granny2\", // notice I'm using granny2 synthdef here\r\n\t\\rate, Pseq([1.9, ], inf),\r\n\t\\amp, 10, // boosted to 5 because filtering attenuates a lot of the sound\r\n\r\n    \\attack, 0.06,\r\n    \\release, 0.7,\r\n\t\\ffreq, Pseq([375], inf),\r\n\t\\rq, 0.11,\r\n    \\buffer, e, // which buffer to play from\r\n    \\dur, 0.45,\r\n\t\\panning, Pwhite(-0.5, 0.5)\r\n);\r\n)\r\n\t~seven.play;\r\n);\r\n\r\n(\r\n~eight = Pbind(\r\n    \\instrument, \"granny2\", // notice I'm using granny2 synthdef here\r\n\t\\rate, Pseq([2, ], inf),\r\n\t\\amp, 10, // boosted to 5 because filtering attenuates a lot of the sound\r\n\r\n    \\attack, 0.06,\r\n    \\release, 0.7,\r\n\t\\ffreq, Pseq([375], inf),\r\n\t\\rq, 0.11,\r\n    \\buffer, e, // which buffer to play from\r\n    \\dur, 0.45,\r\n\t\\panning, Pwhite(-0.5, 0.5)\r\n);\r\n)\r\n\r\n(\r\n~nine = Pbind(\r\n    \\instrument, \"granny2\", // notice I'm using granny2 synthdef here\r\n\t\\rate, Pseq([2.1, ], inf),\r\n\t\\amp, 10, // boosted to 5 because filtering attenuates a lot of the sound\r\n\r\n    \\attack, 0.06,\r\n    \\release, 0.7,\r\n\t\\ffreq, Pseq([375], inf),\r\n\t\\rq, 0.11,\r\n    \\buffer, e, // which buffer to play from\r\n    \\dur, 0.45,\r\n\t\\panning, Pwhite(-0.5, 0.5)\r\n);\r\n)\r\n(\r\n~ten = Pbind(\r\n    \\instrument, \"granny2\", // notice I'm using granny2 synthdef here\r\n\t\\rate, Pseq([1,1,1 ],),\r\n\t\\amp, 10, // boosted to 5 because filtering attenuates a lot of the sound\r\n\r\n    \\attack, 0.06,\r\n    \\release, 0.7,\r\n\t\\ffreq, Pseq([575], inf),\r\n\t\\rq, 0.11,\r\n    \\buffer, c, // which buffer to play from\r\n    \\dur, 0.45,\r\n\t\\panning, Pwhite(-0.5, 0.5)\r\n);\r\n)\r\n\r\n(\r\n~eleven = Pbind(\r\n    \\instrument, \"granny2\", // notice I'm using granny2 synthdef here\r\n\t\\rate, Pseq([1,1,1 ],),\r\n\t\\amp, 10, // boosted to 5 because filtering attenuates a lot of the sound\r\n\r\n    \\attack, 0.06,\r\n    \\release, 0.7,\r\n\t\\ffreq, Pseq([650], inf),\r\n\t\\rq, 0.11,\r\n    \\buffer, c, // which buffer to play from\r\n    \\dur, 0.45,\r\n\t\\panning, Pwhite(-0.5, 0.5)\r\n);\r\n)\r\n\r\n\r\n\r\n\r\n\r\n)\r\n\r\n~one.play;\r\n~two.play;\r\n~three.play;\r\n~four.play;\r\n~five.play;\r\n~seven.play;\r\n~eight.play;\r\n~nine.play;\r\n~ten.play;\r\n~threeb.play;\r\n(\r\n{\r\n\r\n\t\r\n\t\r\n\t\r\n\t\r\n\t\r\n\t\r\n\t\r\n\t\r\n\t\r\n\t\r\n~threeAplay=~threeA.play;\r\n9.wait;\r\n~threeAplay.stop;\t\r\n1.5.wait;\r\n\r\n\t\r\n\t\r\n\r\n\t\r\n~threeplay=~three.play;\r\n4.5.wait;\r\n~threeplay.stop;\t\r\n~fourplay=~four.play;\r\n0.3.wait;\r\n~fourplay.stop;\t\r\n~fiveplay=~five.play;\r\n4.5.wait;\r\n~fiveplay.stop;\r\n~fourplay=~four.play;\r\n0.3.wait;\r\n~fourplay.stop;\r\n~sixplay=~six.play;\r\n4.5.wait;\r\n~sixplay.stop;\r\n~sevenplay=~seven.play;\r\n1.2.wait;\t\r\n~sevenplay.stop;\r\n~sixplay=~six.play;\r\n1.2.wait;\r\n~sixplay.stop;\r\n~fiveplay=~five.play;\r\n1.2.wait;\r\n~fiveplay.stop;\t\r\n\t\r\n\r\n\t\r\n\t\r\n~fourplay=~four.play;\r\n0.3.wait;\t\r\n~threeplay=~three.play;\r\n4.wait;\r\n~threeplay.stop;\r\n~fourplay.stop;\t\r\n\r\n\r\n~threeplay.stop;\r\n~fourplay=~four.play;\r\n0.3.wait;\r\n~fourplay.stop;\t\r\n~fiveplay=~five.play;\r\n4.5.wait;\r\n~fiveplay.stop;\r\n~fourplay=~four.play;\t\r\n\t\r\n\t\r\n\r\n\t\r\n\t\r\n0.3.wait;\r\n~fourplay.stop;\t\r\n~sixplay=~six.play;\r\n4.5.wait;\r\n~sixplay.stop;\t\r\n~fourplay=~four.play;\r\n0.3.wait;\r\n~fourplay.stop;\t\r\n~sevenplay=~seven.play;\r\n1.2.wait;\t\r\n~sevenplay.stop;\r\n~sixplay=~six.play;\r\n1.2.wait;\r\n~sixplay.stop;\r\n~fiveplay=~five.play;\r\n1.2.wait;\r\n~fiveplay.stop;\t\r\n\r\n\t\r\n~fourplay=~four.play;\r\n0.3.wait;\r\n~fourplay.stop;\t\r\n~threeBplay=~threeB.play;\r\n4.6.wait;\r\n~threeBplay.stop;\r\n\r\n\t\r\n\t\r\n~fourplay=~four.play;\t\r\n0.3.wait;\r\n~fourplay.stop;\t\r\n~threeplay=~three.play;\r\n4.5.wait;\r\n~fourplay=~four.play;\r\n0.3.wait;\r\n~fourplay.stop;\t\r\n~threeplay.stop;\r\n~fiveplay=~five.play;\t\r\n4.5.wait;\r\n~fiveplay.stop;\t\r\n~fourplay=~four.play;\r\n0.3.wait;\r\n~fourplay.stop;\t\r\n~sixplay=~six.play;\r\n3.6.wait;\r\n~sixplay.stop;\r\n~sevenplay=~seven.play;\r\n1.2.wait;\r\n~sevenplay.stop;\r\n~eightplay=~eight.play;\r\n3.6.wait;\r\n~eightplay.stop;\r\n\t\r\n\r\n~threeEplay=~threeE.play;\t\r\n7.wait;\r\n~threeEplay.stop;\r\n~threeDplay=~threeD.play;\r\n4.9.wait;\r\n~threeDplay.stop;\r\n~fourplay=~four.play;\r\n0.3.wait;\r\n~fourplay.stop;\t\r\n~threeBplay=~threeB.play;\r\n4.9.wait;\r\n\r\n\t\r\n\t\r\n\r\n\t\t\r\n~threeplay=~three.play;\t\r\n~threeBplay.stop;\r\n0.3.wait;\r\n~threeplay.stop;\t\r\n~threeDplay=~threeD.play;\r\n1.2.wait;\r\n~threeDplay.stop;\t\r\n~twoplay=~two.play;\r\n1.2.wait;\r\n~threeplay=~three.play;\t\t\r\n~twoplay.stop;\r\n1.2.wait;\r\n~threeplay.stop;\r\n~fourplay=~four.play;\t\r\n3.wait;\r\n~fourplay.stop;\r\n~threeplay=~three.play;\r\n3.wait;\r\n~threeplay.stop;\r\n\t\r\n\r\n~sixplay=~six.play;\r\n4.5.wait;\r\n~sixplay.stop;\r\n~sevenplay=~seven.play;\r\n1.2.wait;\t\r\n~sevenplay.stop;\r\n~sixplay=~six.play;\r\n1.2.wait;\r\n~sixplay.stop;\r\n~fiveplay=~five.play;\r\n1.2.wait;\r\n~fiveplay.stop;\t\r\n~threeDplay=~threeD.play;\r\n4.5.wait;\r\n~threeDplay.stop;\t\r\n~threeBplay=~threeB.play;\r\n4.5.wait;\r\n~threeBplay.stop;\t\r\n~twoplay=~two.play;\r\n1.2.wait;\r\n~threeplay=~three.play;\t\t\r\n~twoplay.stop;\r\n1.2.wait;\r\n~threeplay.stop;\r\n\t\r\n\t\r\n\t\r\n~fiveplay=~five.play;\r\n1.2.wait;\r\n~fiveplay.stop;\r\n~twoplay=~two.play;\r\n1.2.wait;\r\n~threeplay=~three.play;\r\n1.wait;\r\n~twoplay.stop;\r\n~fourplay=~four.play\r\n\r\n\r\n\t\r\n\t\t\r\n\t\r\n\t\r\n\t\r\n\t\r\n\t\r\n\t\r\n\t\r\n\r\n\t\r\n\r\n\t\r\n}.fork;\r\n)",
   "labels" : []
}
