PV_ChainUGen:

Filter: Base class for UGens that operate on FFT chains

Source: FFTUnpacking.sc

`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.

Returns the FFT chain buffer's size.

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.

numframes |
Number of FFT frames to process |

func |
The function that takes two arrays as inputs ( |

frombin |
Range start (optional) |

tobin |
Range end (optional) |

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

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

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 |

frombin |
Range start (optional) |

tobin |
Range end (optional) |

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

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

numframes |
Number of FFT frames to process |

func |
The function that processes each bin. It should be a function that takes The |

frombin |
Range start (optional) |

tobin |
Range end (optional) |

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

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:

- Use the frombin and tobin arguments to limit the number of FFT bins that will be included in the calculation. Often the lower FFT bins contain the loudest and/or most relevant information, so perhaps your effect sounds very similar if you ignore the higher-up bins (either leave them unprocessed, or discard them by setting the zeroothers argument to 1, which has the effect of a band-pass frequency-domain filter).
- Use a smaller FFT buffer size.
- Avoid creating ugens inside your calculation function if at all possible. For example, a deterministic ugen such as LFPar.kr(0.5, 0, 1) will be replicated once for each bin if specified inside the function, despite the fact that the output is always the same. Define it outside the calculation function and then reference it by variable name.
- Avoid unused calculations! For example, uncommenting all the different lines in the above will waste effort because many values will be calculated but not used. This cannot be optimised away during compilation. It is particularly important because all calculations are duplicated (once for each bin) so can have a significant impact on efficiency.
- If you find yourself calling pvcollect on an FFT chain more than once in series, you should definitely try to combine your processing into a single pvcollect function, to avoid unnecessary unpacking-then-packing-then-unpacking-then-packing.

helpfile source: /SuperCollider/Contents/Resources/HelpSource/Classes/PV_ChainUGen.schelp

link::Classes/PV_ChainUGen::

link::Classes/PV_ChainUGen::