pub struct Power(pub f32);Expand description
The mean of the squares of the K-weighted samples in a window of time.
K-weighted power is equivalent to K-weighted loudness, the only difference
is one of scale: power is quadratic in sample amplitudes, whereas loudness
units are logarithmic. loudness_lkfs and from_lkfs convert between power,
and K-weighted Loudness Units relative to nominal Full Scale (LKFS).
The term “LKFS” (Loudness Units, K-Weighted, relative to nominal Full Scale) is used in BS.1770-4 to emphasize K-weighting, but the term is otherwise interchangeable with the more widespread term “LUFS” (Loudness Units, relative to Full Scale). Loudness units are related to decibels in the following sense: boosting a signal that has a loudness of -LK LUFS by LK dB (by multiplying the amplitude by 10LK/20) will bring the loudness to 0 LUFS.
K-weighting refers to a high-shelf and high-pass filter that model the
effect that humans perceive a certain amount of power in low frequencies to
be less loud than the same amount of power in higher frequencies. In this
library the Power type is used exclusively to refer to power after applying K-weighting.
The nominal “full scale” is the range [-1.0, 1.0]. Because the power is the mean square of the samples, if no input samples exceeded the full scale, the power will be in the range [0.0, 1.0]. However, the power delivered by multiple channels, which is a weighted sum over individual channel powers, can exceed this range, because the weighted sum is not normalized.
Tuple Fields§
§0: f32Implementations§
Source§impl Power
impl Power
Sourcepub fn from_lkfs(lkfs: f32) -> Power
pub fn from_lkfs(lkfs: f32) -> Power
Convert Loudness Units relative to Full Scale into a squared sample amplitude.
This is the inverse of loudness_lkfs.
Sourcepub fn loudness_lkfs(&self) -> f32
pub fn loudness_lkfs(&self) -> f32
Return the loudness of this window in Loudness Units, K-weighted, relative to Full Scale.
This is the inverse of from_lkfs.
Trait Implementations§
impl Copy for Power
Source§impl PartialOrd for Power
impl PartialOrd for Power
impl StructuralPartialEq for Power
Auto Trait Implementations§
impl Freeze for Power
impl RefUnwindSafe for Power
impl Send for Power
impl Sync for Power
impl Unpin for Power
impl UnsafeUnpin for Power
impl UnwindSafe for Power
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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