GrainBuf:
Filter:
Classes | UGens > Buffer | UGens > Generators > Granular

GrainBuf : MultiOutUGen : UGen : AbstractFunction : Object

Granular synthesis with sound stored in a buffer

Class Methods

GrainBuf.ar(numChannels: 1, trigger: 0, dur: 1, sndbuf, rate: 1, pos: 0, interp: 2, pan: 0, envbufnum: -1, maxGrains: 512, mul: 1, add: 0)

Arguments:

numChannels

the number of channels to output. If 1, mono is returned and pan is ignored.

trigger

a kr or ar trigger to start a new grain. If ar, grains after the start of the synth are sample accurate.

dur

size of the grain (in seconds).

sndbuf

the buffer holding a mono audio signal. If using multi-channel files, use Buffer.readChannel.

rate

the playback rate of the sampled sound

pos

the playback position for the grain to start with (0 is beginning, 1 is end of file)

interp

the interpolation method used for pitchshifting grains:

  • 1 = no interpolation
  • 2 = linear
  • 4 = cubic interpolation (more computationally intensive)
pan

determines where to pan the output.

  • If numChannels = 1, no panning is done.
  • If numChannels = 2, panning is similar to Pan2.
  • If numChannels > 2, panning is the same as PanAz.
envbufnum

the buffer number containing a signal to use for the grain envelope. -1 uses a built-in Hann envelope.

maxGrains

the maximum number of overlapping grains that can be used at a given time. This value is set at the UGens init time and can't be modified. Defaults to 512. This can be set lower for more efficient use of memory.

WARNING: The above parameter is new (post SC 3.3.1) and has the potential to break code written <= 3.3.1. This parameter is BEFORE the mul slot, and you may need to update code to account for this difference.
mul
add

Discussion:

All args except numChannels and trigger are polled at grain creation time.

Inherited class methods

Instance Methods

Inherited instance methods

Examples