This morning I started to work on a granular machine in SuperCollider. This is what I got so far:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
// load buffers p = "/home/random/SAMPLES/ironmaiden/RENAMED/gentleandbass.wav"; b = Buffer.readChannel(s,p, channels:1); b.free; // SynthDef granulator ( SynthDef(\Granny, { arg bufnum, freq = 10, fvar = 1, dur = 0.1, durvar = 0 ; var signal; signal = GrainBuf.ar( numChannels: 2, // we want stereo! trigger: Impulse.kr(freq + (freq * (fvar * LFNoise2.kr(freq)))), // a UGen? dur: dur + (durvar * LFNoise2.kr(freq)), // in seconds sndbuf: bufnum, rate: LFNoise1.kr.range(0.98, 1.02), // pitch pos: SinOsc.kr(0.1).range(0.1,0.9), // position 0-1 interp: 2, // interpolation for pitchshifting pan: LFNoise1.kr(10).range(-0.2, 0.2), // if numChannels=2, similar to Pan2, -1 left, +1 right // envbunum: -1, // the buffer number cont. grain envelope maxGrains: 512, mul: 0.5, add: 0 ); Out.ar(0, signal); }).send(s) ) x = Synth(\Granny, [\bufnum, b]); x.set(\freq, 5); x.set(\fvar, 0); x.set(\dur, 0.2); x.set(\durvar, 0.2); |