F0RangeExtractor#
Defined in: voxatlas.features.acoustic.pitch.range
- class voxatlas.features.acoustic.pitch.range.F0RangeExtractor[source]#
Bases:
BaseExtractorExtract the
acoustic.pitch.f0.rangefeature within the VoxAtlas pipeline.This public extractor defines the reusable API for computing
acoustic.pitch.f0.rangefrom VoxAtlas structured inputs. It consumesNoneunits and produces values aligned toframeunits, making the extractor a stable pipeline node that can be cited independently of the surrounding execution machinery.Algorithm#
The extractor measures the span of the voiced \(f_0\) contour and broadcasts that span to the voiced frames.
Voiced masking The implementation removes undefined and non-positive pitch estimates.
Range computation The range is defined as
\[\mathrm{range}(f_0) = \max_i f_i - \min_i f_i.\]Output alignment The scalar result is copied to voiced frames so that the feature remains frame-aligned inside the VoxAtlas execution graph.
Notes
This extractor declares the upstream dependencies [‘acoustic.pitch.f0’] and is executed only after those features are available in the pipeline feature store.
Examples
>>> import numpy as np >>> from voxatlas.features.acoustic.pitch.range import F0RangeExtractor >>> from voxatlas.features.feature_input import FeatureInput >>> from voxatlas.features.feature_output import VectorFeatureOutput >>> from voxatlas.pipeline.feature_store import FeatureStore >>> store = FeatureStore() >>> base = VectorFeatureOutput( ... feature="acoustic.pitch.f0", ... unit="frame", ... time=np.array([0.0, 0.01, 0.02], dtype=np.float32), ... values=np.array([100.0, 110.0, np.nan], dtype=np.float32), ... ) >>> store.add("acoustic.pitch.f0", base) >>> feature_input = FeatureInput(audio=None, units=None, context={"feature_store": store}) >>> out = F0RangeExtractor().compute(feature_input, {}) >>> out.values.tolist() [10.0, 10.0, nan]
- name: str = 'acoustic.pitch.f0.range'#
- input_units: str | None = None#
- output_units: str | None = 'frame'#
- dependencies: list[str] = ['acoustic.pitch.f0']#
- default_config: dict = {}#
- compute(feature_input, params)[source]#
Compute the extractor output for a single pipeline invocation.
This method is the reusable execution entry point for the extractor. It receives the standard
FeatureInputbundle, applies the configured algorithm, and returns feature values aligned to the extractor output units for storage in the pipeline feature store.- Parameters:
feature_input (object) – Structured extractor input bundling audio, hierarchical units, and execution context for this feature computation.
params (object) – Resolved feature configuration for this invocation. Keys are feature-specific and merged from defaults and pipeline settings.
- Returns:
Structured output aligned to the
frameunit level when applicable.- Return type:
FeatureOutput
Examples
>>> import numpy as np >>> from voxatlas.features.acoustic.pitch.range import F0RangeExtractor >>> from voxatlas.features.feature_input import FeatureInput >>> from voxatlas.features.feature_output import VectorFeatureOutput >>> from voxatlas.pipeline.feature_store import FeatureStore >>> store = FeatureStore() >>> base = VectorFeatureOutput( ... feature="acoustic.pitch.f0", ... unit="frame", ... time=np.array([0.0, 0.01, 0.02], dtype=np.float32), ... values=np.array([100.0, 110.0, np.nan], dtype=np.float32), ... ) >>> store.add("acoustic.pitch.f0", base) >>> feature_input = FeatureInput(audio=None, units=None, context={"feature_store": store}) >>> result = F0RangeExtractor().compute(feature_input, {}) >>> result.unit 'frame'