^ programmer's guide | std classes | basic ugen
^^ language guide to uanae
UAna | UAnaBlob | Windowing
FFT | IFFT | DCT | IDCT
Centroid | Flux | RMS |
RollOff | ZeroX | Flip
pilF | FeatureCollector
UAna
is the base class from which all unit analyzers (UAnae) inherit.
UAnae (note plural form) can be interconnected via =>
(standard chuck operator)
or via =^
(upchuck operator), and the connection type specifies 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 UAnaBlob
s.
UAna.functions | Description |
---|---|
complex cval(int index) |
Get blob's complex value at index. |
complex[] cvals() |
Get blob's complex array. |
float fval(int index) |
Get blob's float value at index. |
float[] fvals() |
Get blob's float array. |
int isUpConnectedTo(UAna right) |
Is connected to another uana via =^ ? |
UAnaBlob upchuck() |
Initiate analysis at the UAna; returns result. |
member variable: UAnaBlob m_blob |
Stores state associated with analysis |
UAnaBlob
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.
UAnaBlob.functions | Description |
---|---|
complex cval(int index) |
Get blob's complex value at index. |
complex[] cvals() |
Get blob's complex array. |
float fval(int index) |
Get blob's float value at index. |
float[] fvals() |
Get blob's float array. |
time when() |
Get the time when blob was last upchucked. |
Windowing
is a utility class comprised of static functions to embody
classic windowing functions associated with digital signal processing pipelines.
Each windowing function produces a float array of weights over a sample
region, or window, specified by its size parameter. These results are
passed as a window parameter to various UAnae.
Windowing.functions | Description |
---|---|
static float[] blackmanHarris(int size) |
generalized cosine weighted |
static float[] hamming(int size) |
cosine weighted |
static float[] hann(int size) |
cosine weighted |
static float[] triangle(int size) |
aka linear intepolation |
static float[] rectangle(int size) |
aka point sampling |
note: this table is sorted in the order of decreasing complexity + quality.
see Window Function (wikipedia)
FFT
is a subclass of UAna and 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 arbitrary window shape) is controlled
via the .window
function. The hop size is completely dynamic, and is
throttled by how time is advanced.
FFT.functions | Description |
---|---|
int size(int size) |
Set the FFT-size. |
int size() |
Get the FFT-size. |
void spectrum(complex[] buffer) |
Manually retrieve the results of a transform. |
void transform(float[] from) |
Manually take FFT (as opposed to using .upchuck() / upchuck operator) |
float[] window(), window(float[] win) |
Get/set the transform window/size |
int windowSize() |
Get the current window size. |
IFFT
is a subclass of UAna that 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 UGens
connected via =>
. The window size (along with an arbitrary window shape) is
controlled via the .window method.
IFFT.functions | Description |
---|---|
void samples(float[] buffer) |
Manually take IFFT (as opposed to using .upchuck() / upchuck operator) |
int size(), size(int size) |
Get/set the IFFT-size. |
void transform(complex[] from) |
Manually take IFFT (as opposed to using .upchuck() / upchuck operator) |
float[] window(), window(float[] win) |
Get/set the transform window/size |
int windowSize() |
Get the current window size. |
DCT
is a subclass of UAna that 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; see UAna documentation).
The window size (along with an arbitry window shape) is controlled via the
.window method. The hop size is completely dynamic, and is throttled by how
time is advanced.
DCT.functions | Description |
---|---|
int size(), size(int size) |
Get/set the DCT size. |
void spectrum(float[] buffer) |
Manually retrieve the results of a transform. |
void transform(float[] from) |
Manually take DCT (as opposed to using .upchuck() / upchuck operator). |
float[] window(), window(float[] win) |
Get/set the transform window/size. |
int windowSize() |
Get the current window size. |
IDCT
is a subclass of UAna that 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 UGens connected via =>
. The window size (along with an arbitry
window shape) is controlled via the .window method.
IDCT.functions | Description |
---|---|
void samples(float[] buffer) |
Manually get result of previous IDCT. |
int size(), size(int size) |
Get/set the IDCT size. |
void transform(complex[] from) |
Manually take IDCT (as opposed to using .upchuck() / upchuck operator). |
float[] window(), window(float[] win) |
Get/set the transform window/size. |
int windowSize() |
Get the current window size. |
Centroid
is a subclass of UAna that computes the spectral
centroid from a magnitude spectrum (either from incoming UAna or manually
given), and outputs one value in its blob.
Centroid.functions | Description |
---|---|
static float compute(float[] input) |
Manually computes the centroid from a float array. |
Flux
is a subclass of UAna that computes the spectral flux
between successive magnitude spectra (via incoming UAna, or given manually),
and outputs one value in its blob.
Flux.functions | Description |
---|---|
static float compute(float[] lhs, float[] rhs) |
Manually computes the flux between two frames |
static float compute(float[] lhs, float[] rhs, float[] diff) |
Manually computes the flux between two frames, and stores the difference in a third array. |
void reset() |
Reset the extractor. |
RMS
is a subclass of UAna that computes the root-mean-squared
power mean from a magnitude spectrum (either from an incoming UAna, or given
manually), and outputs one value in its blob.
RMS.functions | Description |
---|---|
static float compute(float[] input) |
Manually computes the RMS from a float array. |
Rolloff
is a subclass of UAna that computes the spectral rolloff
from a magnitude spectrum (either from incoming UAna, or given manually), and
outputs one value in its blob.
Rolloff.functions | Description |
---|---|
static float compute(float[] input, float pct) |
Manually computes the rolloff from a float array. |
float percent(), percent(float percent) |
Get/set the percentage for computing rolloff. |
ZeroX
is a subclass of UAna that computes zero-crossings (array
locations where the sign flips from + to - or the reverse). NB: there is also
a ZeroX UGen.
ZeroX.functions | Description |
---|---|
static float compute(float[] input) |
Manually computes the zero crossings from a float array. |
Flip
is a subclass of UAna that turns audio samples into frames
in the UAna domain.
Flip.functions | Description |
---|---|
void output(float[] buffer) |
Manually take Flip (as opposed to using .upchuck() / upchuck operator) |
int size(), size(int size) |
Get/set the Flip size. |
void transform(float[] from) |
Manually take Flip (as opposed to using .upchuck() / upchuck operator). |
float[] window(), window(float[] win) |
Get/set the transform window/size. |
int windowSize() |
Get the current window size. |
pilF
is a subclass of UAna that turns UAna frames into
audio samples, via overlap add.
pilF.functions | Description |
---|---|
void output(float[] buffer) |
Manually take pilF (as opposed to using .upchuck() / upchuck operator) |
int size(), size(int size) |
Get/set the pilF size. |
void transform(float[] from) |
Manually take Flip (as opposed to using .upchuck() / upchuck operator). |
float[] window(), window(float[] win) |
Get/set the transform window/size. |
int windowSize() |
Get the current window size. |
FeatureCollector
is a subclass of UAna that turns UAna input
into a single feature vector, upon .upchuck().
FeatureCollector.functions | Description |
---|