FluidBufStats:
Filter:
Classes (extension) | Libraries > FluidCorpusManipulation

FluidBufStats : FluidBufProcessor : FluidServerObject : Object
ExtensionExtension

Statistically summarise a time series in a Buffer

Description

Statistical analysis on buffer channels.

FluidBufStats statistically summarises a time-series (or any values) that is in a buffer, returning seven statistics for each channel: the buffer channel's mean, standard deviation, skewness, kurtosis, low, middle, and high values. See the low, middle and high parameters below for more description on these values.

For a detailed explanation of FluidBufStats features visit http://learn.flucoma.org/reference/bufstats.

The stats output buffer of FluidBufStats will have the same number of channels as the input buffer, each one containing the statistics of its corresponding channel in the input buffer. Because the dimension of time is summarised statistically, the frames in the stats buffer do not represent time as they normally would. The first seven frames in every channel of the stats buffer will have the seven statistics computed on the input buffer channel. After these first seven frames, there will be seven more frames for each derivative requested, each containing the seven statistical summaries for the corresponding derivative.

For example if the input to FluidBufStats is a three-channel buffer and numDerivs = 1 the output stats buffer would contain:

ch 0 meanch 0 std devch 0 skewnessch 0 kurtosisch 0 lowch 0 middlech 0 highch 0 deriv 1 meanch 0 deriv 1 std devch 0 deriv 1 skewnessch 0 deriv 1 kurtosisch 0 deriv 1 lowch 0 deriv 1 middlech 0 deriv 1 high
ch 1 meanch 1 std devch 1 skewnessch 1 kurtosisch 1 lowch 1 middlech 1 highch 1 deriv 1 meanch 1 deriv 1 std devch 1 deriv 1 skewnessch 1 deriv 1 kurtosisch 1 deriv 1 lowch 1 deriv 1 middlech 1 deriv 1 high
ch 2 meanch 2 std devch 2 skewnessch 2 kurtosisch 2 lowch 2 middlech 2 highch 2 deriv 1 meanch 2 deriv 1 std devch 2 deriv 1 skewnessch 2 deriv 1 kurtosisch 2 deriv 1 lowch 2 deriv 1 middlech 2 deriv 1 high

Read more about FluidBufStats on the learn platform.

Class Methods

FluidBufStats.process(server, source, startFrame: 0, numFrames: -1, startChan: 0, numChans: -1, stats, select, numDerivs: 0, low: 0, middle: 50, high: 100, outliersCutoff: -1, weights, freeWhenDone: true, action)

FluidBufStats.processBlocking(server, source, startFrame: 0, numFrames: -1, startChan: 0, numChans: -1, stats, select, numDerivs: 0, low: 0, middle: 50, high: 100, outliersCutoff: -1, weights, freeWhenDone: true, action)

Processs the source Buffer on the Server. processBlocking will execute directly in the server command FIFO, whereas process will delegate to a separate worker thread. The latter is generally only worthwhile for longer-running jobs where you don't wish to tie up the server.

Arguments:

server

The Server on which the buffers to be processed are allocated.

source

The buffer to statistically summarise. Each channel of multichannel buffers will be computed independently.

startFrame

The position (in frames) to begin the statistical analysis. FluidBufStats is unaware of what kind of time-series is in source and what the sample rate might be (whether it is audio samples or audio descriptors). It will begin analysis at the indicated frame index in source. The default is 0.

Constraints

  • Minimum: 0
numFrames

The number of frames to use in the statistical analysis. The default of -1 indicates to use all the frames from startFrame through the end of the source buffer.

startChan

The channel from which to begin computing statistics for. The default is 0.

Constraints

  • Minimum: 0
numChans

The number of channels to compute statistics for. The default of -1 indicates to compute statistics through the last channel in the source buffer.

stats

The buffer to write the statistical summary into.

select

An array of symbols indicating which statistics to return. The options are mean, std, skewness, kurtosis, low, mid, and high. If nothing is specified, the object will return all the statistics. The statistics will always appear in their normal order, this argument just allows for a selection of them to be returned. Reordering the options in this argument will not reorder how the statistics are returned.

numDerivs

The number of derivatives of the original time-series to compute statistics on. The default of 0 will compute statistics on no derivatives, only the original time-series itself. Setting this parameter > 0 (maximum of 2) will return the same seven statistics computed on consecutive derivatives of the channel's time-series. (numDerivs = 1 will return the channel's statistics and the statistics of the first derivative, numDerivs = 2 will return the channel's statistics and the statistics of the first and second derivatives.) The derivative statistics are useful to describe the rate of change of the time series.

Constraints

  • Minimum: 0
  • Maximum: 2
low

The value at this percentile (indicated as 0.0-100.0) will be written into frame 4 (zero-counting). By default, it is percentile 0.0, which is the minimum value of the channel.

Constraints

  • Minimum: 0
  • Maximum: MIN(middle, 100)
middle

The value at this percentile (indicated as 0.0-100.0) will be written into frame 5 (zero-counting). By default, it is percentile 50.0, which is the median value of the channel.

Constraints

  • Minimum: MAX(low, 0)
  • Maximum: MIN(high, 100)
high

The value at this percentile (indicated as 0.0-100.0) will be written into frame 6 (zero-counting). By default, it is percentile 100.0, which is the maximum value of the channel.

Constraints

  • Minimum: MAX(middle, 0)
  • Maximum: 100
outliersCutoff

A ratio of the inter quantile range (IQR) that defines a range from the median, outside of which data will be considered an outlier and not used to compute the statistical summary. For each frame, if a single value in any channel of that frame is considered an outlier (when compared to the rest of the values in its channel), the whole frame (on all channels) will not be used for statistical calculations. The default of -1 bypasses this function, keeping all frames in the statistical measurements.

Constraints

  • Minimum: -1
weights

A buffer to provide relative weighting of each frame in the source buffer when computing the statistics. Not providing a weights buffer will cause all the frames to be considered equally. This may be useful for weighting certain descriptors by the value of other descriptors (such as the loudness or pitch confidence of the sound). The provided buffer has to satisfy all of the following conditions:

  • a single-channel
  • exactly the same amount of frames as source
  • all values must be positive (anything lower than 0 will be rejected)
freeWhenDone

Free the server instance when processing complete. Default true

action

A function to be evaluated once the offline process has finished and all Buffer's instance variables have been updated on the client side. The function will be passed [features] as an argument.

Returns:

An instance of the processor

FluidBufStats.kr(source, startFrame: 0, numFrames: -1, startChan: 0, numChans: -1, stats, select, numDerivs: 0, low: 0, middle: 50, high: 100, outliersCutoff: -1, weights, trig: 1, blocking: 0)

Trigger the equivalent behaviour to processBlocking / process from a Synth. Can be useful for expressing a sequence of buffer and data processing jobs to execute. Note that the work still executes on the server command FIFO (not the audio thread), and it is the caller's responsibility to manage the sequencing, using the done status of the various UGens.

Arguments:

source

The buffer to statistically summarise. Each channel of multichannel buffers will be computed independently.

startFrame

The position (in frames) to begin the statistical analysis. FluidBufStats is unaware of what kind of time-series is in source and what the sample rate might be (whether it is audio samples or audio descriptors). It will begin analysis at the indicated frame index in source. The default is 0.

Constraints

  • Minimum: 0
numFrames

The number of frames to use in the statistical analysis. The default of -1 indicates to use all the frames from startFrame through the end of the source buffer.

startChan

The channel from which to begin computing statistics for. The default is 0.

Constraints

  • Minimum: 0
numChans

The number of channels to compute statistics for. The default of -1 indicates to compute statistics through the last channel in the source buffer.

stats

The buffer to write the statistical summary into.

select

An array of symbols indicating which statistics to return. The options are mean, std, skewness, kurtosis, low, mid, and high. If nothing is specified, the object will return all the statistics. The statistics will always appear in their normal order, this argument just allows for a selection of them to be returned. Reordering the options in this argument will not reorder how the statistics are returned.

numDerivs

The number of derivatives of the original time-series to compute statistics on. The default of 0 will compute statistics on no derivatives, only the original time-series itself. Setting this parameter > 0 (maximum of 2) will return the same seven statistics computed on consecutive derivatives of the channel's time-series. (numDerivs = 1 will return the channel's statistics and the statistics of the first derivative, numDerivs = 2 will return the channel's statistics and the statistics of the first and second derivatives.) The derivative statistics are useful to describe the rate of change of the time series.

Constraints

  • Minimum: 0
  • Maximum: 2
low

The value at this percentile (indicated as 0.0-100.0) will be written into frame 4 (zero-counting). By default, it is percentile 0.0, which is the minimum value of the channel.

Constraints

  • Minimum: 0
  • Maximum: MIN(middle, 100)
middle

The value at this percentile (indicated as 0.0-100.0) will be written into frame 5 (zero-counting). By default, it is percentile 50.0, which is the median value of the channel.

Constraints

  • Minimum: MAX(low, 0)
  • Maximum: MIN(high, 100)
high

The value at this percentile (indicated as 0.0-100.0) will be written into frame 6 (zero-counting). By default, it is percentile 100.0, which is the maximum value of the channel.

Constraints

  • Minimum: MAX(middle, 0)
  • Maximum: 100
outliersCutoff

A ratio of the inter quantile range (IQR) that defines a range from the median, outside of which data will be considered an outlier and not used to compute the statistical summary. For each frame, if a single value in any channel of that frame is considered an outlier (when compared to the rest of the values in its channel), the whole frame (on all channels) will not be used for statistical calculations. The default of -1 bypasses this function, keeping all frames in the statistical measurements.

Constraints

  • Minimum: -1
weights

A buffer to provide relative weighting of each frame in the source buffer when computing the statistics. Not providing a weights buffer will cause all the frames to be considered equally. This may be useful for weighting certain descriptors by the value of other descriptors (such as the loudness or pitch confidence of the sound). The provided buffer has to satisfy all of the following conditions:

  • a single-channel
  • exactly the same amount of frames as source
  • all values must be positive (anything lower than 0 will be rejected)
trig

A kr signal that will trigger execution

blocking

Whether to execute this process directly on the server command FIFO or delegate to a worker thread. See processBlocking/process for caveats.

Inherited class methods

Undocumented class methods

FluidBufStats.prProcessSelect(a)

FluidBufStats.prWarnUnrecognised(sym)

FluidBufStats.stats

Instance Methods

.cancel

From superclass: FluidBufProcessor

Cancels non-blocking processing

.wait

From superclass: FluidBufProcessor

When called in the context of a Routine (it won't work otherwise), will block execution until the processor has finished. This can be convinient for writing sequences of processes more linearly than using lots of nested actions.

Inherited instance methods

Examples

Derivative

Weights

Outliers

A didactic example