SampleType » History » Version 14

Version 13 (Chris Cannam, 2014-02-10 01:26 PM) → Version 14/72 (Chris Cannam, 2014-02-10 01:30 PM)

h1. Output Sample Type and Sample Rate

A Vamp plugin receives audio and produces a series of descriptive feature structures.

The audio input is provided as a series of fixed-length sample blocks, equally spaced in time, provided to successive calls to the plugin's @process@ function. The plugin may return any number of features from each @process@ call, and may also return any number of features from @getRemainingFeatures@ after all the audio has been received.

Features are each associated with a particular output of the plugin. The plugin declares that each output has certain properties, which constrain the sort of feature data the host can expect to see. (See diagram.)

!/attachments/download/980/feature-structures-20pc.png!

A feature may or may not have a timestamp. Whether a timestamp is provided -- and, if it is provided, what it means -- are determined by the @SampleType@ and @SampleRate@ properties of the plugin output on which the feature is returned.

h2. SampleType

A plugin output's @SampleType@ property may be either @OneSamplePerStep@, @FixedSampleRate@, or @VariableSampleRate@. Here's what they mean.

h3. OneSamplePerStep

This is the simplest option. If an output is declared as having a @SampleType@ of @OneSamplePerStep@, then any features returned from a @process@ call are assumed to match up with the audio block provided to that @process@ call.

h4. What this means

For any features returned through an output declared with @OneSamplePerStep@ type,
This means:

* The plugin _should not_ should not set the timestamps on these any features it returns from a @OneSamplePerStep@ output
* If the plugin does set timestamps, timestamps on such features, the host _must_ must ignore them
* The host _must_ must treat all such features returned from a given @process@ call as if they had the same timestamp as it passed to that @process@ call
* The host _must_ must treat all such features returned from @getRemainingFeatures@ as having immediately followed the final @process@ block (i.e. as having the same time as the next equally-spaced @process@ block would have had if the input had not ended).

h4. Examples

@OneSamplePerStep@ type is most often used for simple measurements and visualisations, in which an output is updated on each process call and a new result returned. For example, envelope trackers, power calculations, spectrograms.

@OneSamplePerStep@ is often used for intermediate results calculated during processing of a more sophisticated feature. For example, a beat tracker might have an auxiliary output with @OneSamplePerStep@ type returning its internal onset detection function value.