Unpack1FFT: table of contents
Classes | UGens > FFT | UGens > Demand

Unpack1FFT : UGen : AbstractFunction : Object

Unpack a single value (magnitude or phase) from an FFT chain

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


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

NOTE: This UGen is commonly not used directly. Its main purpose is as a component in PV_ChainUGen: -pvcollect, PV_ChainUGen: -pvcalc, and PV_ChainUGen: -pvcalc2 processes. You're welcome to use it on its own - the example below shows how.

Class Methods

Unpack1FFT.new(chain, bufsize, binindex, whichmeasure: 0)



an FFT chain


the size of the expected input FFT frames


the integer index of the bin you want to query


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


// Let's extract the DC component - i.e. the magnitude at binindex zero.
    var sig, chain, stream, windowStarts, demand;

    sig = SinOsc.ar(LFDNoise3.kr(LFNoise0.kr(1) * 40 + 60) * 700 + 800);

    chain = FFT(LocalBuf(1024), sig);
    stream = Unpack1FFT(chain, bufsize: fftsize, binindex: 0, whichmeasure: 0);

    // each time an FFT window starts, the unpacker returns a new value
    windowStarts = chain > -1;
    demand = Demand.kr(windowStarts, 0, stream);

    sig * 0.05

Inherited class methods

Instance Methods

Inherited instance methods