Struct nnnoiseless::DenoiseSignal
source · pub struct DenoiseSignal<'model, S: Signal> { /* private fields */ }
Expand description
Applies denoising to a Signal
(from the dasp
crate).
Instantiate one of these with a Signal
as input, and you’ll get a Signal
that yields
denoised audio. Note that the denoised Signal
will be in floating-point, even if the
original signal wasn’t.
Example
use nnnoiseless::dasp::signal::{self, Signal};
use nnnoiseless::dasp::sample::Sample;
use nnnoiseless::DenoiseSignal;
let noise = signal::noise(0);
let mut denoised = DenoiseSignal::new(noise);
for n in denoised.take(10_000) {
// ... do something with your denoised noise.
}
Implementations§
source§impl<'model, S: Signal> DenoiseSignal<'model, S>
impl<'model, S: Signal> DenoiseSignal<'model, S>
sourcepub fn new(input: S) -> DenoiseSignal<'static, S>
pub fn new(input: S) -> DenoiseSignal<'static, S>
Creates a new DenoiseSignal
using the built-in default noise model.
sourcepub fn with_model(input: S, model: &'model RnnModel) -> DenoiseSignal<'model, S>
pub fn with_model(input: S, model: &'model RnnModel) -> DenoiseSignal<'model, S>
Creates a new DenoiseSignal
using a custom noise model.
The main difference between this method and DenoiseSignal::from_model
is that here
DenoiseSignal
will borrow the model and reuse it for the different channels in the
signal.
sourcepub fn from_model(input: S, model: RnnModel) -> DenoiseSignal<'static, S>
pub fn from_model(input: S, model: RnnModel) -> DenoiseSignal<'static, S>
Creates a new DenoiseSignal
owning a custom noise model.
The main difference between this method and DenoiseSignal::with_model
is that here
DenoiseSignal
will take ownership of the model and make a clone for each channel in the
signal. If the model is cheap to clone (for example, because it was created with
RnnModel::from_static_bytes
then this is fine.
Trait Implementations§
source§impl<'model, S: Clone + Signal> Clone for DenoiseSignal<'model, S>
impl<'model, S: Clone + Signal> Clone for DenoiseSignal<'model, S>
source§fn clone(&self) -> DenoiseSignal<'model, S>
fn clone(&self) -> DenoiseSignal<'model, S>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<'model, S: Signal> Signal for DenoiseSignal<'model, S>
impl<'model, S: Signal> Signal for DenoiseSignal<'model, S>
source§fn is_exhausted(&self) -> bool
fn is_exhausted(&self) -> bool
§fn map<M, F>(self, map: M) -> Map<Self, M, F>where
Self: Sized,
M: FnMut(Self::Frame) -> F,
F: Frame,
fn map<M, F>(self, map: M) -> Map<Self, M, F>where
Self: Sized,
M: FnMut(Self::Frame) -> F,
F: Frame,
§fn zip_map<O, M, F>(self, other: O, map: M) -> ZipMap<Self, O, M, F>where
Self: Sized,
M: FnMut(Self::Frame, <O as Signal>::Frame) -> F,
O: Signal,
F: Frame,
fn zip_map<O, M, F>(self, other: O, map: M) -> ZipMap<Self, O, M, F>where
Self: Sized,
M: FnMut(Self::Frame, <O as Signal>::Frame) -> F,
O: Signal,
F: Frame,
§fn add_amp<S>(self, other: S) -> AddAmp<Self, S>where
Self: Sized,
S: Signal,
<S as Signal>::Frame: Frame<Sample = <<Self::Frame as Frame>::Sample as Sample>::Signed, NumChannels = <Self::Frame as Frame>::NumChannels>,
fn add_amp<S>(self, other: S) -> AddAmp<Self, S>where
Self: Sized,
S: Signal,
<S as Signal>::Frame: Frame<Sample = <<Self::Frame as Frame>::Sample as Sample>::Signed, NumChannels = <Self::Frame as Frame>::NumChannels>,
other
and self
in lock-step. Read more§fn mul_amp<S>(self, other: S) -> MulAmp<Self, S>where
Self: Sized,
S: Signal,
<S as Signal>::Frame: Frame<Sample = <<Self::Frame as Frame>::Sample as Sample>::Float, NumChannels = <Self::Frame as Frame>::NumChannels>,
fn mul_amp<S>(self, other: S) -> MulAmp<Self, S>where
Self: Sized,
S: Signal,
<S as Signal>::Frame: Frame<Sample = <<Self::Frame as Frame>::Sample as Sample>::Float, NumChannels = <Self::Frame as Frame>::NumChannels>,
other
and
self
in lock-step. Read more§fn offset_amp(
self,
offset: <<Self::Frame as Frame>::Sample as Sample>::Signed
) -> OffsetAmp<Self>where
Self: Sized,
fn offset_amp(
self,
offset: <<Self::Frame as Frame>::Sample as Sample>::Signed
) -> OffsetAmp<Self>where
Self: Sized,
§fn scale_amp(
self,
amp: <<Self::Frame as Frame>::Sample as Sample>::Float
) -> ScaleAmp<Self>where
Self: Sized,
fn scale_amp(
self,
amp: <<Self::Frame as Frame>::Sample as Sample>::Float
) -> ScaleAmp<Self>where
Self: Sized,
Iterator
that scales the amplitude of the sample of each channel in every
Frame
yielded by self
by the given amplitude. Read more§fn offset_amp_per_channel<F>(self, amp_frame: F) -> OffsetAmpPerChannel<Self, F>where
Self: Sized,
F: Frame<Sample = <<Self::Frame as Frame>::Sample as Sample>::Signed, NumChannels = <Self::Frame as Frame>::NumChannels>,
fn offset_amp_per_channel<F>(self, amp_frame: F) -> OffsetAmpPerChannel<Self, F>where
Self: Sized,
F: Frame<Sample = <<Self::Frame as Frame>::Sample as Sample>::Signed, NumChannels = <Self::Frame as Frame>::NumChannels>,
Signal
that offsets the amplitude of every Frame
in self
by the
respective amplitudes in each channel of the given amp_frame
. Read more§fn scale_amp_per_channel<F>(self, amp_frame: F) -> ScaleAmpPerChannel<Self, F>where
Self: Sized,
F: Frame<Sample = <<Self::Frame as Frame>::Sample as Sample>::Float, NumChannels = <Self::Frame as Frame>::NumChannels>,
fn scale_amp_per_channel<F>(self, amp_frame: F) -> ScaleAmpPerChannel<Self, F>where
Self: Sized,
F: Frame<Sample = <<Self::Frame as Frame>::Sample as Sample>::Float, NumChannels = <Self::Frame as Frame>::NumChannels>,
Signal
that scales the amplitude of every Frame
in self
by the
respective amplitudes in each channel of the given amp_frame
. Read more§fn mul_hz<M, I>(self, interpolator: I, mul_per_frame: M) -> MulHz<Self, M, I>where
Self: Sized,
M: Signal<Frame = f64>,
I: Interpolator,
fn mul_hz<M, I>(self, interpolator: I, mul_per_frame: M) -> MulHz<Self, M, I>where
Self: Sized,
M: Signal<Frame = f64>,
I: Interpolator,
§fn from_hz_to_hz<I>(
self,
interpolator: I,
source_hz: f64,
target_hz: f64
) -> Converter<Self, I>where
Self: Sized,
I: Interpolator,
fn from_hz_to_hz<I>(
self,
interpolator: I,
source_hz: f64,
target_hz: f64
) -> Converter<Self, I>where
Self: Sized,
I: Interpolator,
Signal
are yielded using interpolation. Read more§fn scale_hz<I>(self, interpolator: I, multi: f64) -> Converter<Self, I>where
Self: Sized,
I: Interpolator,
fn scale_hz<I>(self, interpolator: I, multi: f64) -> Converter<Self, I>where
Self: Sized,
I: Interpolator,
Signal
are yielded by the given value. Read more§fn delay(self, n_frames: usize) -> Delay<Self>where
Self: Sized,
fn delay(self, n_frames: usize) -> Delay<Self>where
Self: Sized,
Signal
by the given number of frames. Read more§fn into_interleaved_samples(self) -> IntoInterleavedSamples<Self>where
Self: Sized,
fn into_interleaved_samples(self) -> IntoInterleavedSamples<Self>where
Self: Sized,
§fn clip_amp(
self,
thresh: <<Self::Frame as Frame>::Sample as Sample>::Signed
) -> ClipAmp<Self>where
Self: Sized,
fn clip_amp(
self,
thresh: <<Self::Frame as Frame>::Sample as Sample>::Signed
) -> ClipAmp<Self>where
Self: Sized,
Frame
yielded by self
to the given
threshold amplitude. Read more§fn inspect<F>(self, inspect: F) -> Inspect<Self, F>where
Self: Sized,
F: FnMut(&Self::Frame),
fn inspect<F>(self, inspect: F) -> Inspect<Self, F>where
Self: Sized,
F: FnMut(&Self::Frame),
Signal
that calls the enclosing function on each iteration. Read more§fn fork<S>(self, ring_buffer: Bounded<S>) -> Fork<Self, S>where
Self: Sized,
S: SliceMut<Element = Self::Frame>,
fn fork<S>(self, ring_buffer: Bounded<S>) -> Fork<Self, S>where
Self: Sized,
S: SliceMut<Element = Self::Frame>,
Self
into two signals that produce the same frames. Read more§fn take(self, n: usize) -> Take<Self>where
Self: Sized,
fn take(self, n: usize) -> Take<Self>where
Self: Sized,
Signal
into an Iterator
that will yield the given number for Frame
s
before returning None
. Read more§fn until_exhausted(self) -> UntilExhausted<Self>where
Self: Sized,
fn until_exhausted(self) -> UntilExhausted<Self>where
Self: Sized,
Signal
into an Iterator
yielding frames until the signal.is_exhausted()
returns true
. Read more