SuperCollider CLASSES

DetectSilence

When input falls below a threshold, evaluate doneAction.
Inherits from: Filter : PureUGen : UGen : AbstractFunction : Object

Description

When input falls below a threshold, evaluate doneAction.

// this frees after the Decay has become quiet enough for a long enough time
{ var signal = Decay.ar(Impulse.ar(0), 2, PinkNoise.ar(0.2)); DetectSilence.ar(signal, doneAction:2); signal }.play;
NOTE: If the input signal starts with silence at the beginning of the synth's duration, then DetectSilence will wait indefinitely until the first sound before starting to monitor for silence. To avoid a hanging silent sound where the input may remain zero, you can add an envelope to its input

Class Methods

*ar (in: 0, amp: 0.0001, time: 0.1, doneAction: 0)

*kr (in: 0, amp: 0.0001, time: 0.1, doneAction: 0)

Arguments:

in

The input signal.

amp

When input falls below this for long enough, evaluate

doneAction .

time

The minimum duration for which input must fall below

amp before this triggers.

doneAction

An integer representing the doneAction. See

UGen done-actions for more detail.

Returns:

This UGen outputs 1 if silence is detected, otherwise 0.

Inherited class methods

Instance Methods

Inherited instance methods

Undocumented instance methods

-canFreeSynth

From extension in /usr/local/share/SuperCollider/SCClassLibrary/Common/Audio/canFreeSynth.sc

-optimizeGraph

Examples

(
SynthDef("detectSilence-help", { arg out;
    var z;
    z = SinOsc.ar(Rand(400, 700), 0, LFDNoise3.kr(8).max(0)).softclip * 0.3;
    DetectSilence.ar(z, doneAction:2);
    Out.ar(out, z);
}).add;
)

Synth("detectSilence-help");
Synth("detectSilence-help");
Synth("detectSilence-help");


(
Task({
    loop({
        Synth("detectSilence-help");
        [0.5, 1].choose.wait;
    })
}).play;
)