Forgot a help fix: Drag a dock's title bar, not divider, to reposition
[supercollider.git] / HelpSource / Classes / RunningSum.schelp
blob433f6f462a443a2784ff2f028d2f32703ffb3219
1 class:: RunningSum
2 summary:: Running sum over n frames
3 categories:: UGens>Analysis, UGens>Maths
5 description::
6 A running sum over a user specified number of samples, useful for running RMS power windowing.
8 classmethods::
9 method:: ar, kr
10 argument::in
11 Input signal
12 argument::numsamp
13 How many samples to take the running sum over (initialisation time only, not modulatable. default: 40)
15 examples::
17 code::
18 // distorts of course - would need scaling
19 { RunningSum.ar(SoundIn.ar) }.play
21 // Running Average over x samples
24     var x = 100;
25     RunningSum.ar(LFSaw.ar, x) * (x.reciprocal)
26  }.play
30 code::
31 // RMS Power
34     var input, numsamp;
36     input = LFSaw.ar;
37     numsamp = 30;
39     (RunningSum.ar(input.squared, numsamp) / numsamp).sqrt
40 }.play
44 code::
45 // shortcut in class
46 { RunningSum.rms(SoundIn.ar) }.play
49 code::
50 // play around
53     var input, numsamp, power;
54     numsamp = 500;
55     input = SoundIn.ar;
56     power = MouseX.kr(0.1, 4);
58     (RunningSum.ar(input ** power, numsamp)/numsamp) ** (power.reciprocal)
59 }.play