ark_d.amorphic/lib/granulators.scd

33 lines
925 B
Plaintext
Raw Normal View History

2020-04-08 15:04:49 +02:00
(
SynthDef(\granulator, {
arg out = 0, bufnum = ~smpBuffers.ar(0), grainDur=0.2, grainFreq=140, amp=0.8,
gate = 1, attackTime = 0.1, susLevel = 1.0, releaseTime = 1.0,
spread = 1, pan = 0, seed = 1924, id=0;
var snd, env;
RandID.ir(id);
RandSeed.ir(1, seed);
spread = spread * abs(abs(pan)-1);
env = Linen.kr(gate, attackTime, susLevel, releaseTime);
snd = GrainBuf.ar(numChannels: 1,
trigger: Impulse.kr(grainFreq * LFNoise0.kr(grainFreq).range(0.5,1.5)),
dur: grainDur,
sndbuf: bufnum,
rate: [0.2,0.3,0.4,0.5],
pos:LFTri.ar(0.0001, iphase:[IRand(0,1),IRand(0,1),IRand(0,1),IRand(0,1)]).range(0,1),
interp: 4,
maxGrains: 1024,
pan: [ LFNoise1.kr(0.1).range(-1,1),
LFNoise1.kr(0.1).range(-1,1),
LFNoise1.kr(0.1).range(-1,1),
LFNoise1.kr(0.1).range(-1,1) ]
);
snd = Splay.ar(snd, spread:spread, level:amp, center: pan);
snd = snd * env;
Out.ar(out, snd);
}).add;
);