QcPenPrinter: no need to allocate QPrintDialog on heap
[supercollider.git] / HelpSource / Classes / DetectSilence.schelp
blob70051ff80c6cb8f758c41e5572ef5e61487105b6
1 class:: DetectSilence
2 summary:: When input falls below a threshhold, evaluate doneAction.
3 categories::  UGens>Synth control, UGens>Analysis>Amplitude
6 Description::
8 When input falls below a threshhold, evaluate doneAction. If the input
9 signal starts with silence at the beginning of the synth's duration, then
10 DetectSilence will wait indefinitely until the first sound before
11 starting to monitor for silence.
14 classmethods::
16 method::ar, kr
18 argument::in
20 The input signal.
23 argument::amp
25 When input falls below this, evaluate
27 code::doneAction:: .
30 argument::time
32 The minimum duration for which input must fall below
34 code::amp::  before this triggers.
37 argument::doneAction
39 An integer representing the doneAction. See
41 link::Reference/UGen-doneActions::  for more detail.
43 returns::
44 This UGen outputs 1 if silence is detected, otherwise 0.
46 Examples::
48 code::
51 SynthDef("detectSilence-help", { arg out;
52         var z;
53         z = SinOsc.ar(Rand(400, 700), 0, LFNoise2.kr(8, 0.2).max(0));
54         DetectSilence.ar(z, doneAction:2);
55         Out.ar(out, z);
56 }).send(s);
59 s.sendMsg("/s_new", "detectSilence-help", -1);
60 s.sendMsg("/s_new", "detectSilence-help", -1);
61 s.sendMsg("/s_new", "detectSilence-help", -1);
64 Task({
65         loop({
66                 s.sendMsg("/s_new", "detectSilence-help", -1);
67                 [0.5, 1].choose.wait;
68         })
69 }).play;