SuperCollider CLASSES (extension)

Coyote
ExtensionExtension

an amplitude tracking based onset detector
Inherits from: UGen : AbstractFunction : Object

Description

Coyote is an onset detector which tries to find onset attacks in a signal without using FFT processing. It tracks the amplitude changes in the incoming signal and sends a trigger when an onset is found. To get the best tracking for a particular signal by tweaking the arguments, one needs to understand how the onset detection works inside the UGen:

Coyote compares three different analysis results in parallel and tries to report an onset event in the signal. The first phase is amplitude tracking. The trackFall argument is the 60dB convergence time of the decaying signal(the attack time is constant: 0.001, the process is the same with the Amplitude UGen, trackFall is the releaseTime). The output of this tracking is divided to 3 inputs inside. The first two are smoothers(lowpass filters) with different lag times. slowLag is the lag time of the slow smoother, and the fastLag is the lag time of the fast one. The fast smoother is multiplied by a value(fastMul argument) which should be between 0 and 0.9 so its output is always below the slow smoother, except in onsets. So when an onset occurs, the fast smoother output rises quicker than the slow smoother, and when the fast one exceeds the slower at an instant(occurs only at onsets), a trigger is sent to the output from the UGen. For the next trigger to happen, a specified time should pass which is defined by the minDur parameter. So minDur defines the minimum time between events/triggers.

This approach is extremely fast in response(compared to FFT based detectors) when detecting onsets and works well on most contexts(guitar, percussion, etc...). But it has a drawback when there are sustaining sounds present from the same instrument at the moment of an onset, so there is a third unit inside that averages the input beginning from the last trigger whose output is also smoothed by a smoother(lag time is also set to slowLag) and it too is compared with the output of fast smoother to make the tracking work better when there are sustaining sounds present at the moment of an onset.

The default values are a good starting point and works well on many contexts.

Class Methods

*kr (in: 0, trackFall: 0.2, slowLag: 0.2, fastLag: 0.01, fastMul: 0.5, thresh: 0.05, minDur: 0.1)

Arguments:

in

Signal input.

trackFall

60dB convergence time for the initial amplitude tracker.

slowLag

Lag time for the slow smoother.

fastLag

Lag time for the fast smoother.

fastMul

Multiplier for the fast smoother. At the instant of onsets, fast smoother output will exceed the slow smoother and trigger an onset report. If you want to tweak the sensitivity of the tracking, you should try tweaking this value first. Higher values(approaching to 1) makes the tracking more sensitive.

thresh

The minimum threshold for the input to begin tracking onsets.

minDur

Minimum duration between events.

Inherited class methods

Instance Methods

Inherited instance methods

Examples

// Right speaker is the source and at left is a burst of noise when an onset is detected
(
SynthDef("coyote", {  var sounds = Mix.fill(3, { var trig = Dust.kr(1);
                                                 Saw.ar(TRand.kr(50, 880, trig),
                                                        Decay.kr(trig,
                                                                 TRand.kr(0.1, 2, trig),
                                                                 3.reciprocal)); } );

                      var detect = PinkNoise.ar(Decay.kr(Coyote.kr(sounds,
                                                                   fastMul: 0.6,
                                                                   thresh: 0.001), 0.2));

                      Out.ar(0, [detect, sounds]); } ).send(s);
)

x = Synth.new("coyote")
x.free;