cmake: supernova - missing include_directories() for Jack
[supercollider.git] / Help / UGens / FFT / SpecCentroid.html
blob68b7dd1d2cf5ccc4975ff207db0ef25775f25b07
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <meta http-equiv="Content-Style-Type" content="text/css">
6 <title></title>
7 <meta name="Generator" content="Cocoa HTML Writer">
8 <meta name="CocoaVersion" content="824.44">
9 <style type="text/css">
10 p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Helvetica}
11 p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px}
12 p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}
13 p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco}
14 p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px}
15 p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #a32011}
16 span.s1 {color: #0d2bf0}
17 span.s2 {color: #0018f7}
18 span.s3 {color: #0a20b3}
19 span.s4 {color: #0012b9}
20 span.Apple-tab-span {white-space:pre}
21 </style>
22 </head>
23 <body>
24 <p class="p1"><b>SpecCentroid<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>Spectral centroid</b></p>
25 <p class="p2"><br></p>
26 <p class="p3"><b><span class="Apple-tab-span"> </span>SpecCentroid.kr(chain)</b></p>
27 <p class="p2"><br></p>
28 <p class="p3">Given an <a href="FFT.html"><span class="s1">FFT</span></a> <b>chain</b>, this measures the <i>spectral centroid</i>, which is the weighted mean frequency, or the "centre of mass" of the spectrum. (DC is ignored.)</p>
29 <p class="p2"><br></p>
30 <p class="p3">This can be a useful indicator of the perceptual <i>brightness</i> of a signal.</p>
31 <p class="p2"><br></p>
32 <p class="p2"><br></p>
33 <p class="p3"><b>Example</b></p>
34 <p class="p2"><br></p>
35 <p class="p3">A <a href="../Oscillators/Blip.html"><span class="s2">Blip</span></a> 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.</p>
36 <p class="p2"><br></p>
37 <p class="p4">s.boot;</p>
38 <p class="p4">b = <span class="s3">Buffer</span>.alloc(s,2048,1);</p>
39 <p class="p4">(</p>
40 <p class="p4">x = {</p>
41 <p class="p4"><span class="s4">var</span> in, chain, freq, rq, centroid;</p>
42 <p class="p5"><br></p>
43 <p class="p6">//freq = LFPar.kr(0.3).exprange(100, 1000);</p>
44 <p class="p4">freq = <span class="s4">MouseY</span>.kr(1000, 100, 1);</p>
45 <p class="p5"><br></p>
46 <p class="p4">in = <span class="s4">Blip</span>.ar(freq, <span class="s4">MouseX</span>.kr(1, 100, 1));</p>
47 <p class="p5"><br></p>
48 <p class="p4">chain = <span class="s4">FFT</span>(b, in);</p>
49 <p class="p5"><br></p>
50 <p class="p4">centroid = <span class="s4">SpecCentroid</span>.kr(chain);</p>
51 <p class="p5"><br></p>
52 <p class="p4"><span class="s4">Out</span>.ar(0, in.dup * 0.1);</p>
53 <p class="p4">centroid.poll(10);</p>
54 <p class="p4">}.play(s);</p>
55 <p class="p4">)</p>
56 <p class="p5"><br></p>
57 <p class="p4">x.free;</p>
58 </body>
59 </html>