FullWaveRectification

Struct FullWaveRectification 

Source
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>

Source§

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<'_>, )

SIMD-optimized batch processing of multiple samples.

Source§

const ID: u64

Unique ID for hashing.
Source§

type Inputs = UInt<UTerm, B1>

Input arity.
Source§

type Outputs = UInt<UTerm, B1>

Output arity.
Source§

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 more
Source§

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<'_>, )

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)

Set a parameter. What formats are recognized depends on the component.
Source§

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

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 more
Source§

fn allocate(&mut self)

Preallocate all needed memory.
Source§

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 inputs(&self) -> usize

Number of inputs. Read more
Source§

fn outputs(&self) -> usize

Number of outputs. Read more
Source§

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)

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

Filter the next mono sample x. The node must have exactly 1 input and 1 output. Read more
Source§

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 more
Source§

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 more
Source§

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 more
Source§

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>

Source§

fn clone(&self) -> FullWaveRectification<F>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,