pub struct FullWaveRectification<F: Real> { /* private fields */ }Expand description
Full-wave rectifier that outputs the absolute value of the input signal.
This operation is essential for onset detection, as it converts bipolar audio signals into unipolar envelopes that can be used to detect amplitude changes.
The rectified signal is typically followed by a low-pass filter to extract the amplitude envelope.
Trait Implementations§
Source§impl<F: Real> AudioNode for FullWaveRectification<F>
impl<F: Real> AudioNode for FullWaveRectification<F>
Source§fn tick(
&mut self,
input: &Frame<f32, Self::Inputs>,
) -> Frame<f32, Self::Outputs>
fn tick( &mut self, input: &Frame<f32, Self::Inputs>, ) -> Frame<f32, Self::Outputs>
Computes the absolute value of the input sample.
Source§fn process(
&mut self,
size: usize,
input: &BufferRef<'_>,
output: &mut BufferMut<'_>,
)
fn process( &mut self, size: usize, input: &BufferRef<'_>, output: &mut BufferMut<'_>, )
SIMD-optimized batch processing of multiple samples.
Source§fn reset(&mut self)
fn reset(&mut self)
Reset the input state of the component and all its children to an initial state
where it has not processed any samples. In other words, reset time to zero.
If
allocate has been called previously, and the sample rate is unchanged,
then it is expected that no memory allocation or deallocation takes place here. Read moreSource§fn set_sample_rate(&mut self, sample_rate: f64)
fn set_sample_rate(&mut self, sample_rate: f64)
Set the sample rate of the node and all its children.
The default sample rate is 44100 Hz.
The unit is allowed to reset its state here in response to sample rate changes.
If the sample rate stays unchanged, then the goal is to maintain current state. Read more
Source§fn process_remainder(
&mut self,
size: usize,
input: &BufferRef<'_>,
output: &mut BufferMut<'_>,
)
fn process_remainder( &mut self, size: usize, input: &BufferRef<'_>, output: &mut BufferMut<'_>, )
Process samples left over using
tick after processing all full SIMD items.
This is a convenience method for implementers.Source§fn set(&mut self, setting: Setting)
fn set(&mut self, setting: Setting)
Set a parameter. What formats are recognized depends on the component.
Source§fn set_hash(&mut self, hash: u64)
fn set_hash(&mut self, hash: u64)
Set node pseudorandom phase hash.
This is called from
ping (only). It should not be called by users.
The node is allowed to reset itself here.Source§fn ping(&mut self, probe: bool, hash: AttoHash) -> AttoHash
fn ping(&mut self, probe: bool, hash: AttoHash) -> AttoHash
Ping contained
AudioNodes to obtain a deterministic pseudorandom hash.
The local hash includes children, too.
Leaf nodes should not need to override this.
If probe is true, then this is a probe for computing the network hash
and set_hash should not be called yet.
To set a custom hash for a graph, call this method with probe
set to false and hash initialized with the custom hash.
The node is allowed to reset itself here. Read moreSource§fn route(&mut self, input: &SignalFrame, frequency: f64) -> SignalFrame
fn route(&mut self, input: &SignalFrame, frequency: f64) -> SignalFrame
Route constants, latencies and frequency responses at
frequency Hz
from inputs to outputs. Return output signal.
If there are no frequency responses in input, then frequency is ignored.Source§fn get_mono(&mut self) -> f32
fn get_mono(&mut self) -> f32
Retrieve the next mono sample from a generator.
The node must have no inputs and 1 or 2 outputs.
If there are two outputs, average the channels. Read more
Source§fn get_stereo(&mut self) -> (f32, f32)
fn get_stereo(&mut self) -> (f32, f32)
Retrieve the next stereo sample (left, right) from a generator.
The node must have no inputs and 1 or 2 outputs.
If there is just one output, duplicate it. Read more
Source§fn filter_mono(&mut self, x: f32) -> f32
fn filter_mono(&mut self, x: f32) -> f32
Filter the next mono sample
x.
The node must have exactly 1 input and 1 output. Read moreSource§fn filter_stereo(&mut self, x: f32, y: f32) -> (f32, f32)
fn filter_stereo(&mut self, x: f32, y: f32) -> (f32, f32)
Filter the next stereo sample
(x, y).
The node must have exactly 2 inputs and 2 outputs. Read moreSource§fn response(&mut self, output: usize, frequency: f64) -> Option<Complex<f64>>
fn response(&mut self, output: usize, frequency: f64) -> Option<Complex<f64>>
Evaluate frequency response of
output at frequency Hz.
Any linear response can be composed.
Return None if there is no response or it could not be calculated. Read moreSource§fn response_db(&mut self, output: usize, frequency: f64) -> Option<f64>
fn response_db(&mut self, output: usize, frequency: f64) -> Option<f64>
Evaluate frequency response of
output in dB at frequency Hz.
Any linear response can be composed.
Return None if there is no response or it could not be calculated. Read moreSource§fn latency(&mut self) -> Option<f64>
fn latency(&mut self) -> Option<f64>
Causal latency in (fractional) samples, if any.
After a reset, we can discard this many samples from the output to avoid incurring a pre-delay.
The latency may depend on the sample rate.
Voluntary latencies, such as delays, are not counted as latency. Read more
Source§impl<F: Clone + Real> Clone for FullWaveRectification<F>
impl<F: Clone + Real> Clone for FullWaveRectification<F>
Source§fn clone(&self) -> FullWaveRectification<F>
fn clone(&self) -> FullWaveRectification<F>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<F> Freeze for FullWaveRectification<F>
impl<F> RefUnwindSafe for FullWaveRectification<F>where
F: RefUnwindSafe,
impl<F> Send for FullWaveRectification<F>
impl<F> Sync for FullWaveRectification<F>
impl<F> Unpin for FullWaveRectification<F>where
F: Unpin,
impl<F> UnwindSafe for FullWaveRectification<F>where
F: UnwindSafe,
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
Mutably borrows from an owned value. Read more