Skip to main content

Analyzer

Struct Analyzer 

Source
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

Source

pub fn new(format: AudioFormat) -> Result<Self, FormatError>

Build an analyzer for a validated stream format.

Source

pub fn format(&self) -> AudioFormat

The validated format this analyzer was created with.

Source

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.

Source

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.

Source

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.

Source

pub fn take_frame(&mut self) -> AnalysisFrame

Latest analysis with any beat since the previous take. Call once per render frame.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T
where T: WasmNotSend + WasmNotSync,

§

impl<T> WasmNotSync for T
where T: Sync,