GrainBuf granulates a Buffer with independently controllable trigger rate, grain duration, pitch, and position
GrainBuf is SuperCollider’s primary buffer-granulation UGen. Key arguments: trigger (non-positive-to-positive transitions generate grains), dur (grain length in seconds), sndbuf (buffer number), rate (playback speed within each grain — 1 = normal pitch), pos (0-1 fractional position in the buffer). High trigger density + short grains → smooth frozen-time effect. Moving pos over time → time stretching. Varying rate → pitch shifting without time change. Pitch and position control are independent, unlike PlayBuf. The pos argument can be modulated by any UGen — LFNoise for randomized scatter, a Line for controlled scrubbing.
Examples
{ GrainBuf.ar(2, Impulse.kr(20), 0.1, b, 1, LFNoise1.kr(0.1).range(0,1)) * 0.5 }.play;
— 20 grains/sec, 0.1s long, random buffer position.
Assessment
Describe the GrainBuf argument change that would time-stretch a buffer (slow it down without changing pitch). Then describe the change for pitch-shifting without time change.