PV_ChainUGen:
Filter:
Classes | UGens > FFT

PV_ChainUGen : WidthFirstUGen : UGen : AbstractFunction : Object

Base class for UGens that operate on FFT chains

Description

PV_ChainUGen is an abstract class, not used directly, but only its subclasses are. It represents phase-vocoder UGens - i.e. UGens which apply some kind of transformation to the frequency-domain signal produced by FFT.

It encompasses all unit generators whose output is an FFT chain. This is why FFT is in this group but IFFT is not - the IFFT ugen outputs ordinary time-domain audio.

For more information on using these unit generators, see FFT Overview.

Class Methods

Inherited class methods

Instance Methods

.fftSize

Returns the FFT chain buffer's size.

.pvcalc(numframes, func, frombin: 0, tobin, zeroothers: 0)

pvcalc applies a function to the frequency-domain data of an FFT chain. See -pvcollect below for discussion of efficiency considerations. See also -pvcalc2 below, and UnpackFFT.

Arguments:

numframes

Number of FFT frames to process

func

The function that takes two arrays as inputs (magnitude, and phase) and returns a resulting pair of arrays [magnitude, phase].

frombin

Range start (optional)

tobin

Range end (optional)

zeroothers

If set to 1 then bins outside of the range being processed are silenced.

.pvcalc2(chain2, numframes, func, frombin: 0, tobin, zeroothers: 0)

The method pvcalc2 is just like -pvcalc but can combine two FFT chains.

Arguments:

chain2

The scond FFT chain.

numframes

Number of FFT frames to process

func

The function that takes four arrays as inputs (magnitudes1, phases1, magnitudes2, phases2) and returns a resulting pair of arrays [magnitude, phase].

frombin

Range start (optional)

tobin

Range end (optional)

zeroothers

If set to 1 then bins outside of the range being processed are silenced.

.pvcollect(numframes, func, frombin: 0, tobin, zeroothers: 0)

Process each bin of an FFT chain, separately, by applying a function to each bin of an FFT chain.

Arguments:

numframes

Number of FFT frames to process

func

The function that processes each bin. It should be a function that takes magnitude, phase, bin, index as inputs and returns a resulting array [magnitude, phase].

The bin is the integer bin number, starting at 0 for DC, while index is the iteration number, always starting with 0. You can optionally ignore the phase and only return a single (magnitude) value, in which case the phase is assumed to be left unchanged.

frombin

Range start (optional)

tobin

Range end (optional)

zeroothers

If set to 1 then bins outside of the range being processed are silenced.

Discussion:

Note that this procedure can be relatively CPU-heavy, depending on how you use it. Using pvcollect (or its components, UnpackFFT & PackFFT) is usually less efficient than using a single "PV_" unit generator to process an FFT chain, because it involves the creation of quite a large graph of demand-rate unit generators.

If you wish to reduce the CPU impact of using this approach, try the following:

Inherited instance methods

Examples

pvcalc

pvcalc2

pvcollect