File: Unpack1FFT.schelp

package info (click to toggle)
supercollider 1%3A3.6.6~repack-2-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 23,792 kB
  • ctags: 25,269
  • sloc: cpp: 177,129; lisp: 63,421; ansic: 11,297; python: 1,787; perl: 766; yacc: 311; sh: 286; lex: 181; ruby: 173; makefile: 168; xml: 13
file content (56 lines) | stat: -rw-r--r-- 1,555 bytes parent folder | download
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
class:: Unpack1FFT
summary:: Unpack a single value (magnitude or phase) from an FFT chain
categories:: UGens>FFT
related:: Classes/PackFFT, Classes/UnpackFFT


Unpack1FFT(chain, bufsize, binindex, whichmeasure=0)

description::
Takes an FFT chain and extracts a single scalar value as a demand-rate stream. To call it you need a "demander" which fires whenever the FFT chain fires - this is normally achieved using link::Classes/PackFFT:: but can also be done using link::Classes/Demand::.

Note::
The main purpose of this UGen is as a component in pvcollect, pvcalc, and pvcalc2 processes. You're welcome to use it on its own - the example below shows basic usage. But most people won't typically need to use it directly.
::

classmethods::
private:: categories

method:: new

argument:: chain
an FFT chain
argument:: bufsize
the size of the expected input FFT frames
argument:: binindex
the integer index of the bin you want to query
argument:: whichmeasure
0 for magnitude and 1 for phase. None of these arguments can be modulated.

examples::
code::
(
s.boot.doWhenBooted{
	c = Buffer.read(s, Platform.resourceDir +/+ "sounds/a11wlk01.wav");
}
)

// Let's extract the DC component - i.e. the magnitude at index zero.
(
x = {
	var fftsize = 1024;
	var sig, chain, unp;
	sig = PlayBuf.ar(1, c, BufRateScale.kr(c), loop: 1);
	chain = FFT(LocalBuf(fftsize), sig);

	unp = Unpack1FFT(chain, b.numFrames, 0, 0);

	// Demand some data from the unpacker
	Demand.kr(chain>=0, 0, unp).poll(chain>=0, "unpacked value");

	(sig*0.1).dup;
}.play(s);
)
x.free;
::