Wavesets:
Filter:
(extension) GranularSynthesis

Wavesets
ExtensionExtension

analyse soundfiles into short fragments for granular synthesis

Description

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:

http://supercolliderbook.net/

Class Methods

.prepareSynthDefs

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

.all

global dict for all instances of Wavesets

.at

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

Arguments:

key

a symbol.

.clear

clear all existing wavesets from the Wavesets.all.

.from

make a Wavesets from a MONO soundfile at path.

Arguments:

path

the path to the soundfile.

name

the name by which to store the Wavesets instance.

toBuffer

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

server

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

.new

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

.minLength

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.

.defaultInst

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

Instance Methods

Instance variables

.signal

the audio signal that was analysed.

.name

the wavesets name in the global dictionary

.buffer

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

.numFrames

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

.sampleRate

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

These variables are analysis result lists

.xings

all integer indices of the zero crossings found

.numXings

total number of zero crossings found

.lengths

lengths of all wavesets

.amps

peak amplitude of every waveset

.maxima

indices of positive maximum value in every waveset

.minima

indices of negative minimum value in every waveset

.fracXings

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

.fracLengths

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

These are overall statistics of the entire Wavesets

.minSet

shorted waveset

.maxSet

longest waveset

.avgLength

average length of all wavesets

.sqrAvgLength

weighted average length - so bigger wavesets have a larger impact

.minAmp

softest waveset amplitude

.maxAmp

loudest waveset amplitude

.avgAmp

average amplitude of the entire waveset

.sqrAvgAmp

weighted average of (squared) amplitude of the entire waveset

Further instance methods

.eventFor

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

Arguments:

startWs, numWs, repeats, playRate, useFrac

.minima

.frameFor

.analyse

analyse the entire soundfile, then do finishFunc

.analyseFromTo

analyse the soundfile from given startFrame to endFrame

.calcAverages

analysis to do after loading.

.toBuffer

create a buffer for the Waevesets on the server given.

.plot

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

Examples

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.