Struct envelope_detector::rms::Rms
[−]
[src]
pub struct Rms { // some fields omitted }
Iteratively extracts the RMS (root mean square) envelope from a window over a signal of samples.
Methods
impl Rms
[src]
fn new(n_window_frames: usize) -> Self
Construct a new Rms.
fn reset(&mut self)
Zeroes the sum and the buffer of the window
.
fn set_window_frames(&mut self, n_window_frames: usize)
Set the size of the window
as a number of frames.
If the current window length is longer than the given length, the difference will be popped
from the front of the window
while adjusting the sum
accordingly.
If the current window length is shorter than the given length, the difference will be
pushed to the front of the window
using an averaged frame in order to retain the current
RMS.
If the length already is already correct, no re-sizing occurs.
fn window_frames(&self) -> usize
The length of the window as a number of frames.
fn next(&mut self, new_sample: f32) -> f32
The next RMS given the new sample in the sequence.
The Rms pops its front sample and adds the new sample to the back.
The yielded RMS is the RMS of all sample squares in the window
after the new sample is
added.
Returns 0.0
if the window
is empty.
Trait Implementations
impl Mode for Rms
[src]
fn next_sample(&mut self, sample: f32) -> f32
Update state that is unique to the Mode.
impl Debug for Rms
[src]
impl Clone for Rms
[src]
fn clone(&self) -> Rms
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more