Hi there, wonderful people of SC!
I’m practicing with the GrainBuf Ugen on a machine with Windows, SC 3.7.2 version.
In the Help documentation, I’ve found this first example :
s.boot;
(
var winenv;
b = Buffer.read(s, Platform.resourceDir +/+ “sounds/a11wlk01-44_1.aiff”);
// a custom envelope
winenv = Env([0, 1, 0], [0.5, 0.5], [8, -8]);
z = Buffer.sendCollection(s, winenv.discretize, 1);
SynthDef(\buf_grain_test, { |out, gate = 1, amp = 1, sndbuf, envbuf|
var pan, env, freqdev;
// use mouse x to control panning
pan = MouseX.kr(-1, 1);
env = EnvGen.kr(
Env([0, 1, 0], [1, 1], \sin, 1),
gate,
levelScale: amp,
doneAction: 2);
Out.ar(out,
GrainBuf.ar(2, Impulse.kr(10), 0.1, sndbuf, LFNoise1.kr.range(0.5, 2),
LFNoise2.kr(0.1).range(0, 1), 2, pan, envbuf) * env)
}).add;
)
// use built-in env
x = Synth(\buf_grain_test, [\sndbuf, b, \envbuf, -1])
// switch to the custom env
x.set(\envbuf, z)
x.set(\envbuf, -1);
x.set(\gate, 0);
Now, everything is fine, and I like the idea of building a customized envelope for the individual grains.
But I’m having a hard time with two topics :
- I can’t figure out what the method .discretize really means, although I can imagine it. Alas, Help file doesn’t really help here.
- I’m trying to understand the difference between the .sendCollection and . loadCollection
I’m quite surprised as well to find out that the info on the Help file about this latter method (.sendCollection) are not matching:
Help file reports this :
sendCollection (collection, startFrame: 0, wait: -1, action),
while on the IDE I can see this :
sendCollection (server, collection, numChannels, wait, action).
Is this a known bug or error?
Thank you in advance for your kind help!