scide: implement selectionLength for openDocument
[supercollider.git] / HelpSource / Classes / Peak.schelp
blob067293dd89f62ea42e488f894d79477cafa0e152
1 class:: Peak
2 summary:: Track peak signal amplitude.
3 related:: Classes/PeakFollower
4 categories::  UGens>Analysis>Amplitude
7 Description::
9 Outputs the peak amplitude of the signal received at the input. When
10 a trigger occurs at the  code::reset::  input, the maximum
11 output value is reset to the current value.
14 Internally, the absolute value of the signal is used, to prevent
15 underreporting the peak value if there is a negative DC offset. To obtain
16 the minimum and maximum values of the signal as is, use the
17 link::Classes/RunningMin::  and  link::Classes/RunningMax::  UGens.
20 classmethods::
22 method::ar, kr
24 argument::in
26 The input signal.
28 argument::trig
30 Trigger. Resets the output value to the current input value. A trigger happens when the signal changes from non-positive to positive.
33 Examples::
35 code::
39         SinOsc.ar(
40                         Peak.ar(Dust.ar(20), Impulse.ar(0.4)) * 500 + 200,
41                         0, 0.2
42         )
44 }.play;
47 // follow a sine lfo, reset rate controlled by mouse x
50         SinOsc.ar(
51                         Peak.kr(SinOsc.kr(0.2), Impulse.kr(MouseX.kr(0.01, 2, 1))) * 500 + 200,
52                         0, 0.2
53         )
55 }.play;