I think the starting point here is – what is granular synthesis?
It’s a cloud of overlapping grains.
Then… what is a grain? It’s a segment of audio under an envelope.
- Segment of audio: There are all kinds of ways to handle that. Assuming that the audio source is a buffer, the most likely UGen would be PlayBuf.
- Envelope: Could be EnvGen, could be a function saved in a buffer, could be… anything.
Then you need to parcel out triggers to handle the overlap.
There’s a neat trick with PulseDivider to spread the grain triggers out across several parallel signal chains. Parallel chains can overlap. The maximum amount of overlap has to be hardcoded into the SynthDefs structure, but that shouldn’t be a big problem.
(
a = {
// use something of your own with PlayBuf here
var sig = SinOsc.ar((2..6) * 110);
var trig = Impulse.kr(4);
// here we get 5 parallel signal chains
var trigs_x5 = PulseDivider.kr(trig, 5, (0..4));
// here, use whatever you want to get your envelope shape
var envs_x5 = EnvGen.kr(Env.perc(0.01, 0.97), trigs_x5);
((sig * envs_x5).sum * 0.1).dup
}.play;
)
In that PulseDivider overlap design, you could substitute your own buffer readers in place of the sine waves, and your own click-on-start envelope.
GrainBuf and TGrains make it easier to do with granular synthesis, but if SC didn’t have them, you would still be able to do granular synthesis by going back to the fundamentals.
hjh