F0VariabilityExtractor#
Defined in: voxatlas.features.acoustic.pitch.variability
- class voxatlas.features.acoustic.pitch.variability.F0VariabilityExtractor[source]#
Bases:
BaseExtractorExtract the
acoustic.pitch.f0.variabilityfeature within the VoxAtlas pipeline.This public extractor defines the reusable API for computing
acoustic.pitch.f0.variabilityfrom 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 converts the voiced \(f_0\) contour into a global dispersion estimate and broadcasts that estimate to voiced frames.
Voiced masking Only finite, positive \(f_0\) samples are retained.
Dispersion estimate The variability value is the population standard deviation
\[\sigma_{f_0} = \sqrt{\frac{1}{N}\sum_{i=1}^{N}(f_i-\bar f)^2}.\]Alignment The same scalar dispersion is written back to all voiced frames so that later aggregation stages can preserve temporal alignment while still exposing a summary statistic.
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.variability import F0VariabilityExtractor >>> 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 = F0VariabilityExtractor().compute(feature_input, {}) >>> float(np.nanmax(out.values)) 5.0
- name: str = 'acoustic.pitch.f0.variability'#
- 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.variability import F0VariabilityExtractor >>> 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 = F0VariabilityExtractor().compute(feature_input, {}) >>> result.unit 'frame'