[−][src]Trait rubato::Resampler
A resampler that us used to resample a chunk of audio to a new sample rate. The rate can be adjusted as required.
Required methods
fn process(&mut self, wave_in: &[Vec<T>]) -> Result<Vec<Vec<T>>, Box<dyn Error>>
Resample a chunk of audio. Input and output data is stored in a vector, where each element contains a vector with all samples for a single channel.
fn set_resample_ratio(&mut self, new_ratio: f64) -> Result<(), Box<dyn Error>>
Update the resample ratio. New value must be within +-10% of the original one.
fn set_resample_ratio_relative(
&mut self,
rel_ratio: f64
) -> Result<(), Box<dyn Error>>
&mut self,
rel_ratio: f64
) -> Result<(), Box<dyn Error>>
Update the resample ratio relative to the original one. Must be in the range 0.9 - 1.1.
fn nbr_frames_needed(&self) -> usize
Query for the number of frames needed for the next call to "process".
Implementors
impl<T: Float> Resampler<T> for SincFixedIn<T>
[src]
fn process(&mut self, wave_in: &[Vec<T>]) -> Result<Vec<Vec<T>>, Box<dyn Error>>
[src]
Resample a chunk of audio. The input length is fixed, and the output varies in length.
Errors
The function returns an error if the length of the input data is not equal to the number of channels and chunk size defined when creating the instance.
fn set_resample_ratio(&mut self, new_ratio: f64) -> Result<(), Box<dyn Error>>
[src]
Update the resample ratio. New value must be within +-10% of the original one
fn set_resample_ratio_relative(
&mut self,
rel_ratio: f64
) -> Result<(), Box<dyn Error>>
[src]
&mut self,
rel_ratio: f64
) -> Result<(), Box<dyn Error>>
Update the resample ratio relative to the original one
fn nbr_frames_needed(&self) -> usize
[src]
Query for the number of frames needed for the next call to "process". Will always return the chunk_size defined when creating the instance.
impl<T: Float> Resampler<T> for SincFixedOut<T>
[src]
fn nbr_frames_needed(&self) -> usize
[src]
Query for the number of frames needed for the next call to "process".
fn set_resample_ratio(&mut self, new_ratio: f64) -> Result<(), Box<dyn Error>>
[src]
Update the resample ratio. New value must be within +-10% of the original one
fn set_resample_ratio_relative(
&mut self,
rel_ratio: f64
) -> Result<(), Box<dyn Error>>
[src]
&mut self,
rel_ratio: f64
) -> Result<(), Box<dyn Error>>
Update the resample ratio relative to the original one
fn process(&mut self, wave_in: &[Vec<T>]) -> Result<Vec<Vec<T>>, Box<dyn Error>>
[src]
Resample a chunk of audio. The required input length is provided by the "nbr_frames_required" function, and the output length is fixed.
Errors
The function returns an error if the length of the input data is not equal to the number of channels defined when creating the instance, and the number of audio frames given by "nbr_frames"required".