SuperCollider CLASSES (extension)

AttackSlope
ExtensionExtension

Detect onsets and assess the nature of the attack slope

Description

Detects onsets using an energy based detection function, and then assesses the nature of the attack slope in various ways.

Class Methods

*kr (input, windowsize: 1024, peakpicksize: 20, leak: 0.999, energythreshold: 0.01, sumthreshold: 20, mingap: 30, numslopesaveraged: 10)

control rate feature extraction

Arguments:

input

audio input

windowsize

Size in samples of the operating window for detection

peakpicksize

parameter of onset detection

leak

parameter of onset detection

energythreshold

parameter of onset detection

sumthreshold

parameter of onset detection

mingap

Do not retrigger for detected onsets unless this number of control periods has elapsed

numslopesaveraged

number of slopes to average (number of previous slopes to store)

Returns:

(describe returnvalue here) //[0] onset trigger (can be used as an onset detector) //[1] corrected to minima time of last onset //[2] most recent slope measurement //[3] average slope calculation //[4] raw detection function //[5] raw peakpick function

Inherited class methods

Instance Methods

Inherited instance methods

Examples

//[0] onset trigger 
//[1] corrected to minima time of last onset
//[2] most recent slope measurement
//[3] average slope calculation 
//[4] raw detection function
//[5] raw peakpick function
 
b = Buffer.read(s, Platform.resourceDir +/+ "sounds/a11wlk01.wav")
//minimal example
(
{    
//var source = SoundIn.ar; 
var source = PlayBuf.ar(1,b,loop:1);
var slopeanalysis = AttackSlope.kr(source,peakpicksize:20,sumthreshold:40); 

//slopeanalysis.poll;

K2A.ar(slopeanalysis);

//old now [4,5,1]
//K2A.ar([slopeanalysis[0],100*slopeanalysis[1],slopeanalysis[2]])

//K2A.ar([slopeanalysis[0],100*slopeanalysis[1],slopeanalysis[2]])


}.plot(10.0,minval:0.0,maxval:1.0)
)