ark_d.amorphic/lib/bufCyc.scd

31 lines
644 B
Plaintext

SynthDef(\bufCyc, {
arg bufnum, gate=1, freq=440, chanDetune=1, out=0, amp = 1,
attackTime=0.01, releaseTime=1
//, lpf=10, freso=0, fdist=0
;
var snd, env, lpfreq;
env = Linen.kr(gate, attackTime:attackTime, releaseTime:releaseTime, doneAction:2);
freq = [freq, freq * (1 + (chanDetune * 0.0005))];
snd = BufRd.ar(
numChannels: 1,
bufnum: bufnum,
phase: LFSaw.ar(freq).range(0, BufFrames.ir(bufnum)),
loop: 1,
interpolation: 2);
/* lpfreq = freq * lpf;
lpfreq = lpfreq.max(100);
lpfreq = lpfreq.min(18000);
//snd = RLPFD.ar(snd, lpfreq, freso, fdist) * 3;
*/
snd = snd * amp * env;
Out.ar(out, snd);
}).add;