Skip to main content

BandNormalizer

Struct BandNormalizer 

Source
pub struct BandNormalizer { /* private fields */ }
Expand description

The 64-band array’s normalizer: one running peak, tracking the loudest band, applied as a uniform gain across the whole array.

One shared peak rather than 64 independent ones, and the reason is that the array is a spectrum — its values only mean anything relative to each other. Normalizing each band against its own peak makes every band that is not literally silent climb to full scale: a pure tone’s Hann leakage four bands out, some 60 dB down, would report 1.0 because that leakage is its own recent maximum. Two things break at once. The array stops describing spectral shape, and how many bands light up becomes a function of the silence floor — an absolute magnitude, which is the exact dependence ADR-0049 exists to remove.

It would also have silently destroyed the timbre idiom two shipped presets are built on: attractor_clifford and fragment_aurora both read bin(0.84) - bin(0.14) as a contrast between two probes. Per-band normalization leaves both terms near their own peaks, so the difference degenerates to noise — information destroyed in the analyzer, where no preset-level retune could recover it.

A uniform gain keeps every ratio in the array exact while still making thresholds portable: bin(x) > 0.5 means “half as loud as this track’s recent loudest band”, on any track at any gain.

This is a deliberate deviation from Plan 0048 Phase 2’s “per-band and per-scalar” wording and ADR-0049’s diagram. The four scalars do keep independent peaks — they are separate signals, not one distribution.

Implementations§

Source§

impl BandNormalizer

Source

pub fn new(sample_rate: u32) -> Self

A normalizer for the whole band array at sample_rate.

Source

pub fn normalize(&mut self, bands: &mut [f32; 64])

Advance one hop, normalizing bands in place against their shared peak.

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,