Skip to content

Instantly share code, notes, and snippets.

@tatecarson
Created October 9, 2016 19:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tatecarson/e104ae710954cfc5175b50172fa51a12 to your computer and use it in GitHub Desktop.
Save tatecarson/e104ae710954cfc5175b50172fa51a12 to your computer and use it in GitHub Desktop.
SynthDef(\gran_2b, { |out = 0, pos = 0, sndBuf = 0, windowBuf = 1, granDur = 0.1,
rate = 1, loop = 1, panMax = 0, amp = 0, bpFreq = 500, bpRQ = 0.5, bpWet = 1,
ltime = 1|
var window, granSrc, src;
granSrc = PlayBuf.ar(2, sndBuf, BufRateScale.kr(sndBuf) * rate,
1, round(pos * BufFrames.kr(sndBuf)), loop, 2);
window = BufRd.ar(1, windowBuf,
EnvGen.ar(Env([0, BufFrames.kr(windowBuf)], [granDur]),
doneAction: 2), loop, 4);
src = (BPF.ar(granSrc, bpFreq, bpRQ, mul: (bpRQ ** -1) * (400 / bpFreq ** 0.5)) *
bpWet + (granSrc * (1 - bpWet)));
OffsetOut.ar(out, Pan2.ar(src, panMax, amp) * window);
}).add;
w = Buffer.sendCollection(s, Signal.hanningWindow(1024));
/drone gran
~posLo = 0.19; //where to granulate
~posHi = 0.20; //make very small to keep drone
~posRate = 0.1; // to create drone effect
~posDev = 0.001; //more droney
Pbindef(\gran,
\instrument, \gran_2b,
\sndBuf, b[\cuts][rrand(0, 13).debug('current gran buffer')],
\windowBuf, w,
\dur, 1 / 200,
\granDur, 0.15,
\time, Ptime(),
\posRate, 0.1,
\pos, Pfunc { |e|
var relTime = ~posRate * e.time / 1, relDif;
relDif = (~posHi - ~posLo) * rrand(1, 1.1);
relTime + rand2(~posDev) % relDif + ~posLo;
},
\rate, 1,
\bpFreq, 100,
\bpRQ, 0.07,
\bpWet, 0,
\amp, 0.0,
\out, 0
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment