ChucK

UAna objects

UAna


  • Unit Analyzer base class

Base class from which all unit analyzers (UAnae) inherit; UAnae (note plural form) can be interconnected via => (standard chuck operator) or via =^ (upchuck operator), specify the the types of and when data is passed between UAnae and UGens. When .upchuck() is invoked on a given UAna, the UAna-chain (UAnae connected via =^) is traversed backwards from the upchucked UAna, and analysis is performed at each UAna along the chain; the updated analysis results are stored in UAnaBlobs.

extends UGen

  • UAnaBlob .upchuck() initiate analysis at the UAna returns result.

[object]:UAnaBlob


  • Unit Analyzer blob for contain of data 

This object contains results associated with UAna analysis. There is a UAnaBlob associated with every UAna. As a UAna is upchucked, the result is stored in the UAnaBlob’s floating point vector and/or complex vector. The intended interpretation of the results depends on the specific UAna.

  • float .fval(int index) get blob's float value at index
  • complex .cval(int index) get blob's complex value at index
  • float[] .fvals() get blob's float array
  • complex[] .cvals() get blob's complex array
  • time .when() get the time when blob was last upchucked

[object]: Windowing


  • Helper class for generating transform windows

This class contains static methods for generating common transform windows for use with FFT/IFFT. The windows are returned in a static array associated with the Windowing class (note: do not use the returned array for anything other than reading/setting windows in FFT/IFFT).

  • float[] .rectangle(int length) generate a rectangular window
  • float[] .triangle(int length) generate a triangular (or Barlett) window
  • float[] .hann(int length) generate a Hann window
  • float[] .hamming(int length) generate a Hamming window
  • float[] .blackmanHarris(int length) generate a blackmanHarris window

examples: win.ck

domain transformations

[uana]: FFT Fast Fourier Transform


This object contains results associated with UAna analysis. There is a UAnaBlob associated with every UAna. As a UAna is upchucked, the result is stored in the UAnaBlob’s floating point vector and/or complex vector. The intended interpretation of the results depends on the specific UAna. This UAna computes the Fast Fourier Transform on incoming audio samples, and outputs the result via its UAnaBlob as both the complex spectrum and the magnitude spectrum. A buffering mechanism maintains the previous FFTsize # of samples, allowing FFT’s to be taken at any point in time, on demand (via .upchuck() or by upchucking a downstream UAna; The window size (along with an arbitry window shape) is controlled via the .window method. The hop size is complete dynamic, and is throttled by how time is advanced.

extends UAna

  • .size ( float, READ/WRITE ) get/set the FFT size
  • .window() ( float[], READ/WRITE ) get/set the transform window/size (also see AAA Windowing)
  • .windowSize ( int, READ only ) get the current window size
  • .transform ( float[], WRITE only ) manually take FFT (as opposed to using .upchuck() / upchuck operator)
  • .spectrum ( complex[], READ only ) manually retrieve the results of a transform

(UAna input/output)

  • input: audio samples from an incoming UGen output spectrum in complex array, magnitude spectrum in float array

examples: fft.ck, fft2.ck, fft3.ck win.ck

[uana]: IFFT Inverse Fast Fourier Transform


  • Inverse Fast Fourier Transform

This UAna computes the inverse Fast Fourier Transform on incoming spectral frames (on demand), and overlap-adds the results into its internal buffer, ready to be sent to other UGen’s connected via =>. The window size (along with an arbitry window shape) is controlled via the .window method.

  • .size - ( float, READ/WRITE ) get/set the IFFT size
  • .window() - ( float[], READ/WRITE ) get/set the transform window/size (also see AAA Windowing)
  • .windowSize - ( int, READ only ) get the current window size
  • .transform - ( complex[], WRITE only ) manually take IFFT (as opposed to using .upchuck() / upchuck operator)
  • .samples - ( float[], READ only ) manually retrieve the result of the previous IFFT (UAna input/output) input: complex spectral frames (either via UAnae connected via , or manullay via .transform()) output audio samples (overlap-added and streamed out to UGens connected via )

examples: ifft.ck, fft2.ck, ifft3.ck

[uana]: DCT Discrete Cosine Transform


This UAna computes the Discrete Cosine Transform on incoming audio samples, and outputs the result via its UAnaBlob as real values in the D.C. spectrum. A buffering mechanism maintains the previous DCT size # of samples, allowing DCT to be taken at any point in time, on demand (via .upchuck() or by upchucking a downstream UAna; The window size (along with an arbitry window shape) is controlled via the .window method. The hop size is complete dynamic, and is throttled by how time is advanced.

extends UAna

  • .size - ( float, READ/WRITE ) get/set the DCT size
  • .window() - ( float[], READ/WRITE ) get/set the transform window/size (also see AAA Windowing)
  • .windowSize - ( int, READ only ) get the current window size
  • .transform - ( float[], WRITE ) manually take DCT (as opposed to using .upchuck() / upchuck operator)
  • .spectrum - ( float[], READ only ) manually retrieve the results of a transform

(UAna input/output)

  • [function] input: audio samples (either via UAnae connected via =^, or manullay via .transform())
  • [function] output discrete cosine spectrum

examples: dct.ck

[uana]: IDCT Inverse Discrete Cosine Transform


This UAna computes the inverse Discrete Cosine Transform on incoming spectral frames (on demand), and overlap-adds the results into its internal buffer, ready to be sent to other UGen’s connected via =>. The window size (along with an arbitry window shape) is controlled via the .window method.

extends UAna

  • .size - ( float, READ/WRITE ) get/set the IDCT size
  • .window() - ( float[], READ/WRITE ) get/set the transform window/size (also see AAA Windowing)
  • .windowSize - ( int, READ only ) get the current window size
  • .transform - ( float[], WRITE ) manually take IDCT (as opposed to using .upchuck() / upchuck operator)
  • .samples - ( float[], WRITE ) manually get result of previous IDCT

(UAna input/output)

  • input: real-valued spectral frames (either via UAnae connected via , or manullay via .transform())
  • output audio samples (overlap-added and streamed out to UGens connected via )

examples: idct.ck feature extractors

[uana]: Centroid Spectral Centroid


This UAna computes the spectral centroid from a magnitude spectrum (either from incoming UAna or manually given), and outputs one value in its blob.

extends UAna

  • float .compute(float[]) manually computes the centroid from a float array

(UAna input/output)

  • input: complex spectral frames (e.g., via UAnae connected via )
  • output the computed Centroid value is stored in the blob's floating point vector, accessible via .fval(0). This is a normalized value in the range (0,1), mapped to the frequency range 0Hz to Nyquist

examples: centroid.ck

[uana]: Flux Spectral Flux


This UAna computes the spectral flux between successive magnitude spectra (via incoming UAna, or given manually), and outputs one value in its blob.

extends UAna

  • void .reset( ) reset the extractor
  • float .compute(float[] f1, float[] f2) manually computes the flux between two frames
  • float .compute(float[] f1, float[] f2, float[] diff) manually computes the flux between two frames, and stores the difference in a third array

(UAna input/output)

  • input: complex spectral frames (e.g., via UAnae connected via )
  • output the computed Flux value is stored in the blob's floating point vector, accessible via .fval(0)

examples: flux.ck, flux0.ck

[uana]: RMS


  • Spectral RMS

This UAna computes the RMS power mean from a magnitude spectrum (either from an incoming UAna, or given manually), and outputs one value in its blob.

extends UAna

  • float .compute(float[]) manually computes the RMS from a float array

(UAna input/output)

  • input: complex spectral frames (e.g., via UAnae connected via )
  • output the computed RMS value is stored in the blob's floating point vector, accessible via .fval(0)

examples: rms.ck

[uana]: RollOff


  • Spectral RollOff

This UAna computes the spectral rolloff from a magnitude spectrum (either from incoming UAna, or given manually), and outputs one value in its blob.

extends UAna

  • float .percent((float val)) set the percentage for computing rolloff
  • float .percent(( )) get the percentage specified for the rolloff
  • float .compute(float[]) manually computes the rolloff from a float array
  • (UAna input/output)

    • input: complex spectral frames (e.g., via UAnae connected via )
    • output the computed rolloff value is stored in the blob's floating point vector, accessible via .fval(0). This is a normalized value in the range [0,1), mapped to the frequency range 0 to nyquist frequency. 
    examples: rolloff.ck