Submit
Browse
Anonymous
Login
RSS
SuperCollider Code
Fork Code: A3 - Granular Sampling
name
code content
//BEN BATES //PROFESSOR RUVIARO //A3 - GRANULAR SAMPLING //11.29.2016 //---------------------------------------------------------------------------------------------- //SYNTH DEFS:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //______________________________________________________________________________________________ ( ~buf1 = Buffer.readChannel(s, "/Users/benbates/Desktop/AF/Texture/INNOCENT_C3.wav", channels: [0]); ~buf2 = Buffer.readChannel(s, "/Users/benbates/Desktop/AF/SS_Percussion/Kick/winning.aif", channels: [0]); ~buf3 = Buffer.readChannel(s, "/Users/benbates/Desktop/AF/Texture/CELLO_C2.wav", channels: [0]); ~buf4 = Buffer.readChannel(s, "/Users/benbates/Desktop/AF/samples/SoundSnap/Jungle-Sci-Fi.wav", channels: [0]); SynthDef("wn", {arg out = 0, amp = 0.1, att = 0.01, sus = 1, rel = 0.08, ffreq = 10000, pan = 0; var env, snd; env = Env.perc(att, sus, rel, amp).kr(doneAction: 2); snd = BPF.ar( in: WhiteNoise.ar, freq: ffreq, mul: env ); Out.ar(out, Pan2.ar(snd, pan)); }).add; SynthDef("1", {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: ~buf1, rate: rate, startPos: startPos.linlin(0, 1, 0, BufFrames.kr(buffer)) ); snd = snd * env; snd = Pan2.ar(snd, panning); Out.ar(0, snd); }).add; SynthDef("2", {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: ~buf2, rate: rate, startPos: startPos.linlin(0, 1, 0, BufFrames.kr(buffer)) ); snd = snd * env; snd = Pan2.ar(snd, panning); Out.ar(0, snd); }).add; SynthDef("3", {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: ~buf3, rate: rate, startPos: startPos.linlin(0, 1, 0, BufFrames.kr(buffer)) ); snd = snd * env; snd = Pan2.ar(snd, panning); Out.ar(0, snd); }).add; SynthDef("4", {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: ~buf4, rate: rate, startPos: startPos.linlin(0, 1, 0, BufFrames.kr(buffer)) ); snd = snd * env; snd = Pan2.ar(snd, panning); Out.ar(0, snd); }).add; ) //-----------------------------------------------------------------------------------------------//PATTERNS::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //______________________________________________________________________________________________ ( ~synth = Pbind( \instrument, "1", \dur, 2, \note, Pseq([ Pseq([0, 0, Rest(1), Rest(1)], inf), Pseq([0, -5, -6, -5, -4, -3, -2, -1], 1), ], inf), \amp, Pseq([0.12, 0.13, 0.12, 0.10, 0.09, 0.11], inf), \attack, Pseq([0.1, 2], inf) , \release, Pseq([2, 0.1], inf), \rate, Pseq([0.5, [1, 1.5, 2]], inf) , ).play; ) ( ~kick = Pbind( \instrument, "2", \dur, 0.25, \note, Pseq([1, 1, Rest(1), Rest(1), Rest(1), Rest(1), Rest(1), Rest(1)], inf), \rate, Pseq([0.5, 1], inf) , ).play; ) ( ~cello = Pbind( \instrument, "3", \dur, 0.5, \note, Pseq([1, 1, Rest(1), Rest(1), Rest(1), Rest(1), Rest(1), Rest(1),], inf), \rate, Pseq([1, 1.5, 1.4, 1.5, 1.25, 1.5], inf), \attack, 3, \release, 5, ).play; ) ( ~jungle = Pbind( \instrument, "4", \dur, 0.125, \rate, Pseq([1, 1.5, 0.5, 1.5, 1.25, 1.12, 1.05, 1.18, 1.22, 0.98, 1.67, 0.92], 16), \attack, Pseq([0.1, 0.2, 0.05, 0.9, 0.12, 0.2, 0.1, 0.05], inf), \release, 0.1, ).play; ) ( ~jungle2 = Pbind( \instrument, "4", \dur, 8, \rate, Pseq([1], 1), \attack, 5, \release, 10, ).play; ) ( ~wn = Pbind( \instrument, "wn", \note, Pseq([1], 56), \amp, Pseq([0.1, 0.12, 0.8, 1.4], 16), ).play; ) //---------------------------------------------------------------------------------------------- //QUICK TEST:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //______________________________________________________________________________________________ //BUF1 ( {Splay.ar(PlayBuf.ar(1, ~buf1, 1, loop: 1))}.play; {Splay.ar(PlayBuf.ar(1, ~buf1, 0.75, 0, 0, 1,))}.play; {Splay.ar(PlayBuf.ar(1, ~buf1, 0.625, 0, 0, 1,))}.play; {Splay.ar(PlayBuf.ar(1, ~buf1, 0.5, loop: 1))}.play; ) //BUF2 ( {Splay.ar(PlayBuf.ar(1, ~buf2, 1, loop: 0))}.play; ) //BUF3 ( {Splay.ar(PlayBuf.ar(1, ~buf3, 2, 0, 0, 1,))}.play; {Splay.ar(PlayBuf.ar(1, ~buf3, 1.5, 0, 0, 1,))}.play; {Splay.ar(PlayBuf.ar(1, ~buf3, 1.25, 0, 0, 1,))}.play; {Splay.ar(PlayBuf.ar(1, ~buf3, 1, 0, 0, 1,))}.play; ) //---------------------------------------------------------------------------------------------- //COMPOSITION/////////////////////////////////////////////////////////////////////////////////// //______________________________________________________________________________________________ s.record; s.stopRecording; ( { Pbind( \instrument, "4", \dur, 8, \rate, Pseq([1], 1), \attack, 5, \release, 50, ).play; 8.wait; ~wn.play; ~synth.play; 12.wait; ~kick.play; ~cello.play; ~jungle.play; 16.wait; Pbind( \instrument, "4", \dur, 16, \rate, Pseq([1], 1), \attack, 5, \release, 10, ).play; }.fork; )
code description
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