SuperCollider CLASSES (extension)

SLOnset
ExtensionExtension

experimental time domain onset detector
Inherits from: UGen : AbstractFunction : Object

//SLUGens released under the GNU GPL as extensions for SuperCollider 3, by Nick Collins, http://composerprogrammer.com/index.html 

Description

Purely time domain onset detector

Works well for loud signals but fainter onsets are missed, and really loud onsets lead to multiple triggers.

(my note: needs some sort of log amplitude correction?)

Class Methods

Inherited class methods

Undocumented class methods

*kr (input, memorysize1: 20, before: 5, after: 5, threshold: 10, hysteresis: 10, mul: 1, add: 0)

Instance Methods

Inherited instance methods

Examples

(
x = {arg threshold=10.0; 

var input, onsets; 

input = SoundIn.ar(0); 

onsets= SLOnset.kr(input,20,5,5,threshold); 

Out.ar(0, SinOsc.ar(440,0,0.1)*Decay2.ar(K2A.ar(onsets), 0.01, 0.1)); 

}.play;
)


x.set(\threshold, 10.0)


x.free;


b = Buffer.read(s,"sounds/a11wlk01.wav"); // remember to free the buffer later.
b = Buffer.read(s,"sounds/break2"); // remember to free the buffer later.


(
x = {arg threshold=10.0, hysteresis=20; 

var input, onsets; 

input = PlayBuf.ar(1, b, BufRateScale.kr(b), loop:1);

onsets= SLOnset.kr(input,20,5,5,threshold,hysteresis); 

Out.ar(0, input + (SinOsc.ar(440,0,0.1)*Decay2.ar(K2A.ar(onsets), 0.01, 0.05))); 

}.play;
)


//by setting these appropriately can get somewhere...
x.set(\threshold, 50.0)
x.set(\hysteresis, 10.0)

b.free;