pub struct DecayCurve {
pub samples: Vec<f64>,
pub sample_rate: f64,
pub noise_cutoff_sample: usize,
}Expand description
Schroeder backward-integrated decay curve of a RIR, expressed in dB relative to the curve’s peak.
samples[n] = 10·log10( ∫_n^{cutoff} h²(τ) dτ / ∫_0^{cutoff} h²(τ) dτ )
Truncation at cutoff (the estimated noise-floor crossover) avoids the
“lift” that a never-decaying integrated noise tail would otherwise add
to the curve — see Chu (1978) and Lundeby et al. (1995).
Fields§
§samples: Vec<f64>Sample-by-sample Schroeder decay in dB (0 dB at the start, decreasing).
sample_rate: f64Sample rate the curve was computed at.
noise_cutoff_sample: usizeIndex (within samples) at which the underlying RIR was truncated
before backward-integration. Below this sample the curve is dominated
by noise and should not be used for slope fitting.
Implementations§
Source§impl DecayCurve
impl DecayCurve
Sourcepub fn from_rir(
rir: &[f32],
sample_rate: f64,
start_sample: usize,
noise_cutoff_sample: Option<usize>,
) -> Self
pub fn from_rir( rir: &[f32], sample_rate: f64, start_sample: usize, noise_cutoff_sample: Option<usize>, ) -> Self
Compute the Schroeder decay curve from a RIR.
start_sample is the index of the direct sound; integration starts
from there. noise_cutoff_sample (absolute index in rir) lets the
caller override the auto-detected noise truncation; if None,
estimate_noise_cutoff is used.
Sourcepub fn first_crossing(&self, threshold_db: f64) -> Option<usize>
pub fn first_crossing(&self, threshold_db: f64) -> Option<usize>
First sample index at which the curve is ≤ threshold_db. Returns
None if the curve never reaches the threshold.
Trait Implementations§
Source§impl Clone for DecayCurve
impl Clone for DecayCurve
Source§fn clone(&self) -> DecayCurve
fn clone(&self) -> DecayCurve
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for DecayCurve
impl RefUnwindSafe for DecayCurve
impl Send for DecayCurve
impl Sync for DecayCurve
impl Unpin for DecayCurve
impl UnsafeUnpin for DecayCurve
impl UnwindSafe for DecayCurve
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more