pub struct Analyzer { /* private fields */ }Expand description
Stateful per-stream analyzer: accumulates interleaved samples into mono hops, runs FFT + onset detection each completed hop, and hands the latest frame to the render side. Deterministic for a given sample sequence.
After construction, processing allocates nothing — safe to drive from the render loop every frame.
Implementations§
Source§impl Analyzer
impl Analyzer
Sourcepub fn new(format: AudioFormat) -> Result<Self, FormatError>
pub fn new(format: AudioFormat) -> Result<Self, FormatError>
Build an analyzer for a validated stream format.
Sourcepub fn format(&self) -> AudioFormat
pub fn format(&self) -> AudioFormat
The validated format this analyzer was created with.
Sourcepub fn band_for_freq(&self, hz: f32) -> usize
pub fn band_for_freq(&self, hz: f32) -> usize
The log-frequency band a given frequency falls into — lets scenes and tests reason about where energy should show up.
Sourcepub fn push_interleaved(&mut self, samples: &[f32])
pub fn push_interleaved(&mut self, samples: &[f32])
Feed interleaved samples (whole frames, as produced by the intake). Runs one analysis pass per completed hop.
Sourcepub fn downbeat_terms(&self) -> DownbeatTerms
pub fn downbeat_terms(&self) -> DownbeatTerms
The downbeat estimator’s current decomposition — Plan 0068’s instrument, reachable from a native shell (Plan 0086 Phase 1).
Reading it changes nothing. downbeat::DownbeatTracker::terms takes
&self, recomputes from state push_interleaved
already keeps, allocates nothing and reads no clock — so the estimator
behaves identically whether or not anyone is looking, and the value is the
published AnalysisFrame::downbeat_confidence bit for bit between hops.
Diagnostics only, and native-only (ADR-0052): not a grammar variable, and never on the C ABI.
Sourcepub fn take_frame(&mut self) -> AnalysisFrame
pub fn take_frame(&mut self) -> AnalysisFrame
Latest analysis with any beat since the previous take. Call once per render frame.