pub struct StereoField {
pub balance: f32,
pub spread: f32,
}Expand description
One hop’s whole-mix stereo field.
Fields§
§balance: f32Where the mix sits, -1 hard left to +1 hard right, 0 centred.
spread: f32How decorrelated the two channels are: 0 identical, 0.5 fully
decorrelated, 1 polarity-inverted.
Implementations§
Source§impl StereoField
impl StereoField
Sourcepub fn measure(left: &[f32], right: &[f32]) -> Self
pub fn measure(left: &[f32], right: &[f32]) -> Self
Measure one hop from channels 0 and 1.
balance is the ratio of the two channels’ RMS through ratio, and
spread is (1 - corr) / 2 over the normalized correlation
Σ(l·r) / sqrt(Σl² · Σr²). Both read exactly 0 when the larger
channel’s RMS sits below WAVE_FLOOR, and identical channels read
exactly 0 for both: the correlation’s numerator and denominator are
then the same sum, and sqrt(a·a) is exactly a under round-to-nearest.
Only the overlapping prefix of the two slices is read, so a caller that
has one channel shorter measures what it has rather than reaching past
it. The sums stay far from overflow at hop length: every sample of a
validated stream is finite and the squares of a ±1 hop total at most
its own sample count.
Trait Implementations§
Source§impl Clone for StereoField
impl Clone for StereoField
Source§fn clone(&self) -> StereoField
fn clone(&self) -> StereoField
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for StereoField
impl Debug for StereoField
Source§impl Default for StereoField
impl Default for StereoField
Source§fn default() -> StereoField
fn default() -> StereoField
Source§impl PartialEq for StereoField
impl PartialEq for StereoField
Source§fn eq(&self, other: &StereoField) -> bool
fn eq(&self, other: &StereoField) -> bool
self and other values to be equal, and is used by ==.