[flocking-users] Improvements to buffer management and playback

Colin Clark colin at COLINCLARK.ORG
Thu Dec 5 11:48:36 EST 2013

Hi everyone,

I’ve just pushed some significant improvements to Flocking’s internal buffer management code. This should make loading and sharing buffers faster and more efficient, and fixes a few subtle bugs in the implementation. By default, audio files are now loaded and decoded asynchronously using a Web Worker, which frees up the main thread to continue being responsive to the user.

More interestingly, I have added several new features to the flock.ugen.playBuffer unit generator, including the ability to:

 * Set start and end points for playing back only portions of a buffer
 * Triggering a reset of the current play position, moving back to the start of the sound file

I also created a new unit generator called flock.ugen.readBuffer, which is comparable to SuperCollider’s BufRd unit generator. It allows you to modulate the playback rate and position in a very fine-grained way using a phase input. readBuffer only moves its read point based on the value of its phase input, so it is typically used with other unit generators such as flock.ugen.line or flock.ugen.phasor.

I’ve added a handful of quick examples to the Flocking playground demonstrating how both unit generators can be used:


There are several new unit generators that I will also release soon, including lag, quantize, indexArray, and pulseToFreq. Stay tuned.


More information about the flocking mailing list