rtvamp.FeatureComputation#
- class rtvamp.FeatureComputation(samplerate: float)#
Compute features with (multiple) plugins block-wise or from a stream (advanced usage).
- __init__(samplerate: float)#
Initialize FeatureComputation class.
- Parameters:
samplerate – Input sample rate
Methods
__init__
(samplerate)Initialize FeatureComputation class.
add_plugin
(key[, parameter, paths])Add plugin for processing.
Get output descriptors.
initialise
(blocksize[, stepsize])Initialise all added plugins.
process_block
(timedata_block, timestamp)Process a single block/frame of data.
process_signal
(timedata[, timestamp_start])Process data of arbitrary length.
reset
()Reset all added plugins.
Attributes
- add_plugin(key: str, parameter: Dict[str, float] | None = None, paths: List[PathLike] | None = None)#
Add plugin for processing.
- Parameters:
key – Plugin key/identifer as returned by e.g.
list_plugins()
parameter – Dict with parameter identifiers and values. Use
get_plugin_metadata()
orPlugin.get_parameter_descriptors()
to list available parameters and their constraints.paths – Custom paths, either search paths or plugin library paths
- initialise(blocksize: int, stepsize: int | None = None)#
Initialise all added plugins.
- Parameters:
blocksize – Block size in samples
stepsize – Step size in samples (< blocksize, default = blocksize)
- reset()#
Reset all added plugins.
- get_output_descriptors()#
Get output descriptors.
- process_block(timedata_block: ndarray, timestamp: float) List[List[float]] #
Process a single block/frame of data.
- Parameters:
timedata_block – Single block/frame of time series data (length equal to initialised blocksize)
timestamp – Timestamp of block in seconds
- Returns:
List of computed features (same length as
outputs
).The feature itself is list of floats (check bin_count with
get_output_descriptors()
).
- process_signal(timedata: ndarray, timestamp_start: float = 0) Tuple[ndarray, List[ndarray]] #
Process data of arbitrary length.
- Parameters:
timedata – Time series data of arbitrary length. Signal will be cropped to blocks/frames accoring to initialised stepsize and blocksize.
timestamp_start – Timestamp of signal start in seconds
- Returns:
Array of timestamps in seconds
List of arrays of computed features (same length as timestamps). Check
outputs
to map the arrays to the plugin outputs.