Allocate a local buffer
numFrames |
number of frames (default: 1) |
numChannels |
number of channels for multiple channel buffers (default: 1) |
a new buffer – the ugen outputs its buffer number and can thus be used in any other ugen that requires a buffer number input.
Allocates a new buffer from a given list of values
list |
The list may be two-dimensional for numChannels > 1. It is then reshaped into the buffer's current format by flattening. |
a new buffer
Since newFrom is called by the as message, one may thus convert an array to a LocalBuf:
set the buffer slots with a list of values.
If list is smaller than numFrames, it will only set part of the buffer. The list may be two-dimensional for numChannels > 1. offset is the starting index (default: 0)
If the buffer is large but holds a smaller number of unique values, e.g. Array.fill(88200, { #[0, 0.25, 0.5, 0.75, 1.0].choose })
, this is no problem. SynthDef compacts the large array for the list of constants.
set the buffer slot to zero.
This is important when randomly accessing buffer slots (e.g. with a BufRd) or not overwriting them. Clear is not an efficient real time operation for larger buffers, so it should be only used when really needed - but then it is essential: a LocalBuf is "created" in each new synth, and it may reuse old space. So if an older synth has already ended, this part of memory may be the same as the new synth's.