ShimmerExtractor#
Defined in: voxatlas.features.acoustic.voice_quality.shimmer
- class voxatlas.features.acoustic.voice_quality.shimmer.ShimmerExtractor[source]#
Bases:
BaseExtractorExtract the
acoustic.voice_quality.shimmerfeature within the VoxAtlas pipeline.This public extractor defines the reusable API for computing
acoustic.voice_quality.shimmerfrom 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 estimates frame-to-frame amplitude perturbation using the \(f_0\) contour to define valid voiced regions.
Framewise amplitude extraction The waveform is partitioned to match the number of \(f_0\) frames, and each voiced frame is summarized by its peak absolute amplitude \(A_t\).
Relative perturbation Shimmer is computed as
\[S_t = \frac{|A_t - A_{t-1}|}{\max(A_{t-1}, \varepsilon)}.\]Packaging The perturbation contour is kept at frame resolution for later summary statistics.
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.audio.audio import Audio >>> from voxatlas.features.acoustic.voice_quality.shimmer import ShimmerExtractor >>> from voxatlas.features.feature_input import FeatureInput >>> from voxatlas.features.feature_output import VectorFeatureOutput >>> from voxatlas.pipeline.feature_store import FeatureStore >>> audio = Audio(waveform=np.zeros(1600, dtype=np.float32), sample_rate=16000) >>> store = FeatureStore() >>> f0_out = VectorFeatureOutput( ... feature="acoustic.pitch.f0", ... unit="frame", ... time=np.array([0.0, 0.01, 0.02, 0.03], dtype=np.float32), ... values=np.array([100.0, 100.0, 100.0, 100.0], dtype=np.float32), ... ) >>> store.add("acoustic.pitch.f0", f0_out) >>> feature_input = FeatureInput(audio=audio, units=None, context={"feature_store": store}) >>> out = ShimmerExtractor().compute(feature_input, {}) >>> (np.isnan(out.values[0]), out.values[1:].tolist()) (True, [0.0, 0.0, 0.0])
- name: str = 'acoustic.voice_quality.shimmer'#
- 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.audio.audio import Audio >>> from voxatlas.features.acoustic.voice_quality.shimmer import ShimmerExtractor >>> from voxatlas.features.feature_input import FeatureInput >>> from voxatlas.features.feature_output import VectorFeatureOutput >>> from voxatlas.pipeline.feature_store import FeatureStore >>> audio = Audio(waveform=np.zeros(1600, dtype=np.float32), sample_rate=16000) >>> store = FeatureStore() >>> f0_out = VectorFeatureOutput( ... feature="acoustic.pitch.f0", ... unit="frame", ... time=np.array([0.0, 0.01], dtype=np.float32), ... values=np.array([100.0, 100.0], dtype=np.float32), ... ) >>> store.add("acoustic.pitch.f0", f0_out) >>> feature_input = FeatureInput(audio=audio, units=None, context={"feature_store": store}) >>> result = ShimmerExtractor().compute(feature_input, {}) >>> result.unit 'frame'