pub struct Resampler { /* private fields */ }Expand description
High-quality resampler using SoX (VHQ Polyphase implementation)
Implementations§
Source§impl Resampler
impl Resampler
pub fn new(channels: usize, from_rate: u32, to_rate: u32) -> Self
Sourcepub fn resample_parallel(
&self,
input: &[f64],
phase: PhaseResponse,
quality: ResampleQuality,
) -> Result<Vec<f64>, ResamplerError>
pub fn resample_parallel( &self, input: &[f64], phase: PhaseResponse, quality: ResampleQuality, ) -> Result<Vec<f64>, ResamplerError>
Resample audio data using SoX VHQ polyphase filter.
Input and output are interleaved f64 samples for Hi-Fi transparency.
Optimised for multi-channel parallelism:
- De-interleaves channels
- Processes each channel on a separate thread (Rayon)
- Re-interleaves result
This avoids phase discontinuities from time-chunking while maintaining high performance.
Returns Err if Soxr initialization fails (e.g., invalid sample rate combination).
Auto Trait Implementations§
impl Freeze for Resampler
impl RefUnwindSafe for Resampler
impl Send for Resampler
impl Sync for Resampler
impl Unpin for Resampler
impl UnsafeUnpin for Resampler
impl UnwindSafe for Resampler
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more