1
0
Fork 0
Rhizosphere/lib/granSoil.scd

37 lines
916 B
Plaintext

(
SynthDef(\granSoil, {
arg out=0, gate = 1, amp = 0.5, sndbuf, envbuf = -1, fadeTime=1, rate=0.8, dur=0.01;
var snd, env, freqdev;
// use mouse x to control panning
//pan = MouseX.kr(-1, 1);
env = EnvGen.kr(
Env([0, 1, 0], [fadeTime, fadeTime], \sin, 1),
gate,
//levelScale: amp,
doneAction: Done.freeSelf);
snd = GrainBuf.ar(
numChannels: 1,
trigger: Impulse.kr(200 * LFNoise2.kr(0.1).range(0.9,1.1)),
//dur: MouseY.kr.range(0.001,1),
//dur: SinOsc.kr(0.1).range(0.001,0.1),
dur: dur,
sndbuf: sndbuf,
rate: rate, // the playback rate of the sampled sound
//pos: MouseX.kr.range(0, 25) * LFNoise2.kr(20).range(0.999,1.001),
pos: LFNoise2.kr(0.001).range(0, 25) * LFNoise2.kr(20).range(0.999,1.001),
interp: 4, // 2: liner, 4: cubic
pan: 0,
envbufnum: envbuf,
maxGrains: 1024);
snd = snd * env * amp;
Out.ar(out, snd);
}).add;
)