pub struct Converter { /* private fields */ }Implementations§
Source§impl Converter
impl Converter
pub fn new(dither_config: Option<DithererBuilder>) -> Self
Sourcepub fn scale(&mut self, sample: f64, shift: u8) -> f64
pub fn scale(&mut self, sample: f64, shift: u8) -> f64
Scale audio samples with optimal dithering strategy for Spotify’s 16-bit source material.
Since Spotify audio is always 16-bit depth, this function:
- When dithering: applies noise at 16-bit level, preserves fractional precision, then scales to target format and rounds once at the end
- When not dithering: scales directly from normalized float to target format
The shift parameter specifies how many extra bits to shift beyond
the base 16-bit scaling (0 for 16-bit, 8 for 24-bit, 16 for 32-bit).
Sourcepub fn clamping_scale_s24(&mut self, sample: f64) -> f64
pub fn clamping_scale_s24(&mut self, sample: f64) -> f64
Clamping scale specifically for 24-bit output to prevent MSB overflow. Only used for S24 formats where samples are packed in 32-bit words. Ensures the most significant byte is zero to prevent overflow during dithering.
pub fn f64_to_f32(&mut self, samples: &[f64]) -> Vec<f32>
pub fn f64_to_s32(&mut self, samples: &[f64]) -> Vec<i32>
Sourcepub fn f64_to_s24(&mut self, samples: &[f64]) -> Vec<i32>
pub fn f64_to_s24(&mut self, samples: &[f64]) -> Vec<i32>
S24 is 24-bit PCM packed in an upper 32-bit word
Sourcepub fn f64_to_s24_3(&mut self, samples: &[f64]) -> Vec<i24>
pub fn f64_to_s24_3(&mut self, samples: &[f64]) -> Vec<i24>
S24_3 is 24-bit PCM in a 3-byte array
pub fn f64_to_s16(&mut self, samples: &[f64]) -> Vec<i16>
Auto Trait Implementations§
impl Freeze for Converter
impl !RefUnwindSafe for Converter
impl !Send for Converter
impl !Sync for Converter
impl Unpin for Converter
impl !UnwindSafe for Converter
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