pub struct Denoiser { /* private fields */ }Expand description
ストリーミングのノイズ抑制器。ステレオはチャンネル独立に 2 インスタンスの RNNoise 状態で処理する (チャンネル間のクロストークなし)。
遅延と持ち越しの詳細は crate レベルのドキュメント を参照。
Implementations§
Source§impl Denoiser
impl Denoiser
Sourcepub fn new(channels: u16) -> Result<Denoiser, DenoiseError>
pub fn new(channels: u16) -> Result<Denoiser, DenoiseError>
チャンネル数 (1 = mono, 2 = stereo interleaved) を指定して構築する。
Sourcepub fn process(&mut self, interleaved: &mut [f32]) -> Result<(), DenoiseError>
pub fn process(&mut self, interleaved: &mut [f32]) -> Result<(), DenoiseError>
任意長の interleaved (±1.0 正規化・48kHz) サンプルをインプレースで ノイズ抑制する。長さはチャンネル数の倍数であること (空スライスは no-op)。
内部で FRAME_SIZE サンプル/ch のフレームに切って処理し、端数は次回へ
持ち越す。出力は入力を FRAME_SIZE サンプル/ch 遅らせた列で、ストリーム
先頭の遅延分は無音 (0.0)。呼び出しの切り方を変えても出力列は変わらない。
出力サンプルは ±1.0 にクランプされる。
Sourcepub fn flush(&mut self) -> Vec<f32>
pub fn flush(&mut self) -> Vec<f32>
持ち越し中の端数をゼロ詰めで 1 フレームに整えて処理し、遅延分の末尾
FRAME_SIZE サンプル/ch を interleaved で返してストリームを閉じる。
これで総出力 = 総入力 + FRAME_SIZE サンプル/ch (先頭の無音詰め物) になる。
呼び出し後は Denoiser::reset と同じ初期状態に戻るので、続けて新しい
ストリームを処理できる。
Auto Trait Implementations§
impl Freeze for Denoiser
impl RefUnwindSafe for Denoiser
impl Send for Denoiser
impl Sync for Denoiser
impl Unpin for Denoiser
impl UnsafeUnpin for Denoiser
impl UnwindSafe for Denoiser
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