(extension) GranularSynthesis


analyse soundfiles into short fragments for granular synthesis


Wavesets analyses soundfiles into short fragments called wavesets, and contains these waveset data and their info. It can support a variety of waveset based synthesis instruments.

By Trevor Wishart's definition, a waveset is a segment of an audio signal between one non-positive to positive zero crossing and the next. [ see T. Wishart (1994): Audible Design. ] Note that this definition only applies to mono signals.

In extension of that concept, the Wavesets class provides fractional zero crossings, amplitude analyses, and other statistical data.

See also the end of Chapter 16, Microsound, in the SuperCollider Book at MIT Press for detailed examples - code available here:


Class Methods


prepare some basic synthdefs that can be used for Wavesets synthesis (when using the eventFor method).


global dict for all instances of Wavesets


access instances in Wavesets.all by name (key).



a symbol.


clear all existing wavesets from the Wavesets.all.


make a Wavesets from a MONO soundfile at path.



the path to the soundfile.


the name by which to store the Wavesets instance.


flag whether to make a buffer that that soundfile. default = true.


the server on which to load the soundfile. default = s.


make a new Wavesets instance. *from is much more common.


The minimum number of sample points a single Waveset can have. This is used to avoid lots of extremely short samples in noisy samples. Logical minimum is 2, default is 10.


get and set the name of the default synthdef to use in Wavesets event-related methods.

Instance Methods

Instance variables


the audio signal that was analysed.


the wavesets name in the global dictionary


a buffer on the server that was created from the same soundfile


the number of frames of the soundfile, the buffer and the Wavesets


the sample rate of the signal/buffer. default is s.sampleRate

These variables are analysis result lists


all integer indices of the zero crossings found


total number of zero crossings found


lengths of all wavesets


peak amplitude of every waveset


indices of positive maximum value in every waveset


indices of negative minimum value in every waveset


the calculated fractional zerocrossing points. This allows for more precise pitch information and waveset transitions, resulting in smoother sound.


fractional lengths - in effect, this is 1/wavesetFreq.

These are overall statistics of the entire Wavesets


shorted waveset


longest waveset


average length of all wavesets


weighted average length - so bigger wavesets have a larger impact


softest waveset amplitude


loudest waveset amplitude


average amplitude of the entire waveset


weighted average of (squared) amplitude of the entire waveset

Further instance methods


generate an event for a given combination of start waveset index, number of wavesets, repeats, playback rate, and use of fractional crossings.


startWs, numWs, repeats, playRate, useFrac




analyse the entire soundfile, then do finishFunc


analyse the soundfile from given startFrame to endFrame


analysis to do after loading.


create a buffer for the Waevesets on the server given.


plot a section of <length> Wavesets from <startWs>


Task Examples

To play a waveset (or group) for a precise number of repetitions, one can use a SynthDef with a hard cutoff envelope, as below. Note that adding an offset outside the phasor works better; Phasor.ar(0, playRate, start, end) is sometimes off by a few samples. This is likely a 32bit float precision problem.