File: FFTSpread.schelp

package info (click to toggle)
supercollider-sc3-plugins 3.7.1~repack-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 14,332 kB
  • ctags: 11,704
  • sloc: cpp: 140,180; lisp: 14,746; ansic: 2,133; xml: 86; makefile: 82; haskell: 21; sh: 8
file content (41 lines) | stat: -rw-r--r-- 1,063 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
CLASS:: FFTSpread
summary:: Spectral spread
categories:: UGens>Analysis, UGens>FFT
related:: Classes/SpecCentroid

DESCRIPTION::
Given an FFT chain, this measures the spectral spread, which is the magnitude-weighted variance. This measure can serve as an (approximate) clue towards the bandwidth of a signal (although the value is not a frequency).

The centroid should be supplied, typically using a link::Classes/SpecCentroid:: unit - if you don't fill in this argument then a SpecCentroid unit will automatically be added.

CLASSMETHODS::

METHOD:: kr
argument:: buffer
argument:: centroid

EXAMPLES::

code::
// Very artificial example - just filtering some noise.
s.boot;
b = Buffer.alloc(s,2048,1);
(
x = {
var in, chain, freq, rq, val;
//freq = LFPar.kr(0.3).exprange(100, 1000);
freq = MouseY.kr(1000, 100, 1);
rq = MouseX.kr(0.001, 10, 1);
in = BPF.ar(WhiteNoise.ar, freq, rq);
chain = FFT(b.bufnum, in);

val = FFTSpread.kr(chain);

Out.ar(0, in.dup * 0.1);
(val * 0.000001).poll(10); // Poll but scaled down so more readable!
}.play(s);
)

x.free;
::