SuperCollider Granular Example
The TGrains
UGen is an easy to use granular synth. It uses a Hanning window
for each grain and offers control over position, pitch and length of the grains.
The help files offer multiple examples for using this unit generator.
The following example uses a simple pulse train for triggering grains.
Reading Channels
A single channel is loaded to a buffer from a sample for this granular example. The duration in seconds can be queried from the buffer object, once loaded.
The Granular Node
The granular node uses an Impulse
UGen to create a trigger signal for the TGrains
UGen.
This node has several arguments to control the granular process:
The density defines how often a grain is triggered per second.
Every grain can be pitch shifted by a value (1 = default rate).
The grain duration is specified in seconds.
The grain center is defined in seconds.
A gain parameter can be used for amplification.
buffer specifies the index of the buffer to be used.
Once the node has been created with a nil
buffer, the buffer index of the
previously loaded sample can be passed. Depending on the nature of the sample,
this can already result in something audible:
Manual Parameter Setting
As with any node, the arguments of the granular process can be set, manually. Since the center is specified in seconds, the buffer duration is useful at this point.