Merge pull request #506 from andrewcsmith/patch-2
[supercollider.git] / HelpSource / Classes / Slope.schelp
blob66efae85d52d621733000991742b1dc993663c09
1 class:: Slope
2 summary:: Slope of signal
3 categories:: UGens>Analysis, UGens>Filters>Linear, UGens>Maths
5 description::
6 Measures the rate of change per second of a signal.
7 Formula implemented is:
9 code::
10 out[i] = (in[i] - in[i-1]) * sampling_rate
13 classmethods::
14 method:: ar, kr
15 argument::in
16 Input signal to measure.
17 argument::mul
18 argument::add
20 examples::
21 code::
24     var a, b, c, scale;
25     a = LFNoise2.ar(2000);  // quadratic noise
26     b = Slope.ar(a);        // first derivative produces line segments
27     c = Slope.ar(b);        // second derivative produces constant segments
28     scale = 0.0002; // needed to scale back to +/- 1.0
29     [a, b * scale, c * scale.squared]
30 }.plot
34 For another example of Slope see link::Classes/AbstractFunction#hypot#AbstractFunction:hypot::.