2 summary:: Spectral centroid
4 related:: Classes/SpecFlatness, Classes/SpecPcile
7 Given an link::Classes/FFT:: strong::chain::, this measures the emphasis::spectral:: centroid, which is the weighted mean frequency, or the "centre of mass" of the spectrum. (DC is ignored.)
9 This can be a useful indicator of the perceptual emphasis::brightness:: of a signal.
15 an link::Classes/FFT:: chain.
19 A link::Classes/Blip:: oscillator is ideal for demonstrating this because the number of harmonics is directly manipulated: as the number of harmonics increases, the centroid is pushed higher. In the example, left-to-right changes the number of harmonics, but up-to-down changes the fundamental pitch; note the different effects of these two on the centroid.
23 b = Buffer.alloc(s,2048,1);
26 var in, chain, freq, rq, centroid;
28 //freq = LFPar.kr(0.3).exprange(100, 1000);
29 freq = MouseY.kr(1000, 100, 1);
31 in = Blip.ar(freq, MouseX.kr(1, 100, 1));
35 centroid = SpecCentroid.kr(chain);
37 Out.ar(0, in.dup * 0.1);