SampleType » History » Version 12

Chris Cannam, 2014-02-10 01:24 PM

1 1 Chris Cannam
h1. Output Sample Type and Sample Rate
2 1 Chris Cannam
3 12 Chris Cannam
A Vamp plugin receives audio and produces a series of descriptive feature structures.
4 1 Chris Cannam
5 12 Chris Cannam
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.
6 11 Chris Cannam
7 11 Chris Cannam
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.)
8 10 Chris Cannam
9 7 Chris Cannam
!/attachments/download/980/feature-structures-20pc.png!
10 9 Chris Cannam
11 9 Chris Cannam
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.
12 7 Chris Cannam
13 8 Chris Cannam
h2. SampleType
14 1 Chris Cannam
15 8 Chris Cannam
A plugin output's @SampleType@ property may be either @OneSamplePerStep@, @FixedSampleRate@, or @VariableSampleRate@. Here's what they mean.
16 8 Chris Cannam
17 1 Chris Cannam
h3. OneSamplePerStep
18 1 Chris Cannam
19 12 Chris Cannam
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.
20 12 Chris Cannam
21 12 Chris Cannam
This means:
22 12 Chris Cannam
23 12 Chris Cannam
 * The plugin should not set timestamps on any features it returns from a @OneSamplePerStep@ output
24 12 Chris Cannam
 * If the plugin does set timestamps on such features, the host must ignore them
25 12 Chris Cannam
 * The host must treat all features returned from a given @process@ call as if they had the same timestamp as it passed to that @process@ call
26 12 Chris Cannam
 * The host must treat all features returned from @getRemainingFeatures@ as immediately following the final @process@ block (i.e. with the same time as the next equally-spaced @process@ block would have had, if the input had not ended then).