sample_conv

Function sample_conv 

Source
pub fn sample_conv<S, D>(frame: &[S]) -> Cow<'_, [D]>
where S: SampleType, D: SampleType,
Expand description
  • Convert samples to another format by scaling. e.g. u8 to i16 conversion is to scale [0, 255] into [-32768, +32767]
  • Upscaling is lossless. Beware, the precision of f32 is roughly the same as i24. Convert i32 to f32 is lossy.
  • i32 to f64 is lossless but f64 for audio processing consumes lots of memory.