SuperCollider CLASSES (extension)

OnsetStatistics
ExtensionExtension

Extract basic statistics from a series of onset triggers

Description

The UGen records all trigger (onset) events and their times within its window of operation. Basic statistics are calculated over the onsets and inter-onset-intervals.

Class Methods

*kr (input, windowsize: 1, hopsize: 0.1)

Operate feature extraction at control rate

Arguments:

input

Triggers at the control rate input are stored with their associated time of activation

windowsize

Size of operating window (from now into the past) in seconds. Any onset triggers within this time are taken into account

hopsize

Not used at present, re-calculates every block

Returns:

(describe returnvalue here) [0] Density of onsets (number of triggers) in the window [1] Mean of IOIs (in seconds) [2] Standard deviation of IOIs

Inherited class methods

Instance Methods

Inherited instance methods

Examples

//[0] density (number of onsets in window)
//[1] mean IOI
//[2] variance IOI

b = Buffer.read(s, Platform.resourceDir +/+ "sounds/a11wlk01.wav")

//minimal example
(
{
    //var source = SoundIn.ar;

    var source = PlayBuf.ar(1,b,loop:1);
    
    var onsetanalysis =
    OnsetStatistics.kr(Onsets.kr(FFT(LocalBuf(512),source),0.125),2.0);

    onsetanalysis.poll(10);

    source
}.play; 
)