SuperCollider CLASSES

Unpack1FFT

Unpack a single value (magnitude or phase) from an FFT chain
Inherits from: UGen : AbstractFunction : Object

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 PackFFT but can also be done using 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.

Class Methods

*new (chain, bufsize, binindex, whichmeasure: 0)

Arguments:

chain

an FFT chain

bufsize

the size of the expected input FFT frames

binindex

the integer index of the bin you want to query

whichmeasure

0 for magnitude and 1 for phase. None of these arguments can be modulated.

Inherited class methods

Instance Methods

Inherited instance methods

Examples

(
s.waitForBoot({
    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;