[][src]Trait rubato::Resampler

pub trait Resampler<T> {
    pub fn process(
        &mut self,
        wave_in: &[Vec<T>]
    ) -> Result<Vec<Vec<T>>, Box<dyn Error>>;
pub fn set_resample_ratio(
        &mut self,
        new_ratio: f64
    ) -> Result<(), Box<dyn Error>>;
pub fn set_resample_ratio_relative(
        &mut self,
        rel_ratio: f64
    ) -> Result<(), Box<dyn Error>>;
pub fn nbr_frames_needed(&self) -> usize; }

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

pub fn process(
    &mut self,
    wave_in: &[Vec<T>]
) -> Result<Vec<Vec<T>>, Box<dyn Error>>
[src]

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.

pub fn set_resample_ratio(
    &mut self,
    new_ratio: f64
) -> Result<(), Box<dyn Error>>
[src]

Update the resample ratio.

pub fn set_resample_ratio_relative(
    &mut self,
    rel_ratio: f64
) -> Result<(), Box<dyn Error>>
[src]

Update the resample ratio relative to the original one.

pub fn nbr_frames_needed(&self) -> usize[src]

Query for the number of frames needed for the next call to "process".

Loading content...

Implementors

impl Resampler<f32> for FftFixedIn<f32>[src]

pub fn nbr_frames_needed(&self) -> usize[src]

Query for the number of frames needed for the next call to "process".

pub fn set_resample_ratio(
    &mut self,
    _new_ratio: f64
) -> Result<(), Box<dyn Error>>
[src]

Update the resample ratio. This is not supported by this resampler and always returns an error.

pub fn set_resample_ratio_relative(
    &mut self,
    _rel_ratio: f64
) -> Result<(), Box<dyn Error>>
[src]

Update the resample ratio relative to the original one. This is not supported by this resampler and always returns an error.

pub fn process(
    &mut self,
    wave_in: &[Vec<f32>]
) -> Result<Vec<Vec<f32>>, Box<dyn Error>>
[src]

Resample a chunk of audio. The required input length is provided by the "nbr_frames_needed" function, and the output length is fixed. If the waveform for a channel is empty, this channel will be ignored and produce a corresponding empty output waveform.

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_needed".

impl Resampler<f32> for FftFixedInOut<f32>[src]

pub fn nbr_frames_needed(&self) -> usize[src]

Query for the number of frames needed for the next call to "process".

pub fn set_resample_ratio(
    &mut self,
    _new_ratio: f64
) -> Result<(), Box<dyn Error>>
[src]

Update the resample ratio. This is not supported by this resampler and always returns an error.

pub fn set_resample_ratio_relative(
    &mut self,
    _rel_ratio: f64
) -> Result<(), Box<dyn Error>>
[src]

Update the resample ratio relative to the original one. This is not supported by this resampler and always returns an error.

pub fn process(
    &mut self,
    wave_in: &[Vec<f32>]
) -> Result<Vec<Vec<f32>>, Box<dyn Error>>
[src]

Resample a chunk of audio. The input and output lengths are fixed. If the waveform for a channel is empty, this channel will be ignored and produce a corresponding empty output waveform.

Errors

The function returns an error if the size of the input data is not equal to the number of channels and input size defined when creating the instance.

impl Resampler<f32> for FftFixedOut<f32>[src]

pub fn nbr_frames_needed(&self) -> usize[src]

Query for the number of frames needed for the next call to "process".

pub fn set_resample_ratio(
    &mut self,
    _new_ratio: f64
) -> Result<(), Box<dyn Error>>
[src]

Update the resample ratio. This is not supported by this resampler and always returns an error.

pub fn set_resample_ratio_relative(
    &mut self,
    _rel_ratio: f64
) -> Result<(), Box<dyn Error>>
[src]

Update the resample ratio relative to the original one. This is not supported by this resampler and always returns an error.

pub fn process(
    &mut self,
    wave_in: &[Vec<f32>]
) -> Result<Vec<Vec<f32>>, Box<dyn Error>>
[src]

Resample a chunk of audio. The required input length is provided by the "nbr_frames_needed" function, and the output length is fixed. If the waveform for a channel is empty, this channel will be ignored and produce a corresponding empty output waveform.

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_needed".

impl Resampler<f32> for SincFixedIn<f32>[src]

pub fn process(
    &mut self,
    wave_in: &[Vec<f32>]
) -> Result<Vec<Vec<f32>>, Box<dyn Error>>
[src]

Resample a chunk of audio. The input length is fixed, and the output varies in length. If the waveform for a channel is empty, this channel will be ignored and produce a corresponding empty output waveform.

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.

pub 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

pub fn set_resample_ratio_relative(
    &mut self,
    rel_ratio: f64
) -> Result<(), Box<dyn Error>>
[src]

Update the resample ratio relative to the original one

pub 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 Resampler<f32> for SincFixedOut<f32>[src]

pub fn nbr_frames_needed(&self) -> usize[src]

Query for the number of frames needed for the next call to "process".

pub 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

pub fn set_resample_ratio_relative(
    &mut self,
    rel_ratio: f64
) -> Result<(), Box<dyn Error>>
[src]

Update the resample ratio relative to the original one

pub fn process(
    &mut self,
    wave_in: &[Vec<f32>]
) -> Result<Vec<Vec<f32>>, Box<dyn Error>>
[src]

Resample a chunk of audio. The required input length is provided by the "nbr_frames_needed" function, and the output length is fixed. If the waveform for a channel is empty, this channel will be ignored and produce a corresponding empty output waveform.

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_needed".

impl Resampler<f64> for FftFixedIn<f64>[src]

pub fn nbr_frames_needed(&self) -> usize[src]

Query for the number of frames needed for the next call to "process".

pub fn set_resample_ratio(
    &mut self,
    _new_ratio: f64
) -> Result<(), Box<dyn Error>>
[src]

Update the resample ratio. This is not supported by this resampler and always returns an error.

pub fn set_resample_ratio_relative(
    &mut self,
    _rel_ratio: f64
) -> Result<(), Box<dyn Error>>
[src]

Update the resample ratio relative to the original one. This is not supported by this resampler and always returns an error.

pub fn process(
    &mut self,
    wave_in: &[Vec<f64>]
) -> Result<Vec<Vec<f64>>, Box<dyn Error>>
[src]

Resample a chunk of audio. The required input length is provided by the "nbr_frames_needed" function, and the output length is fixed. If the waveform for a channel is empty, this channel will be ignored and produce a corresponding empty output waveform.

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_needed".

impl Resampler<f64> for FftFixedInOut<f64>[src]

pub fn nbr_frames_needed(&self) -> usize[src]

Query for the number of frames needed for the next call to "process".

pub fn set_resample_ratio(
    &mut self,
    _new_ratio: f64
) -> Result<(), Box<dyn Error>>
[src]

Update the resample ratio. This is not supported by this resampler and always returns an error.

pub fn set_resample_ratio_relative(
    &mut self,
    _rel_ratio: f64
) -> Result<(), Box<dyn Error>>
[src]

Update the resample ratio relative to the original one. This is not supported by this resampler and always returns an error.

pub fn process(
    &mut self,
    wave_in: &[Vec<f64>]
) -> Result<Vec<Vec<f64>>, Box<dyn Error>>
[src]

Resample a chunk of audio. The input and output lengths are fixed. If the waveform for a channel is empty, this channel will be ignored and produce a corresponding empty output waveform.

Errors

The function returns an error if the size of the input data is not equal to the number of channels and input size defined when creating the instance.

impl Resampler<f64> for FftFixedOut<f64>[src]

pub fn nbr_frames_needed(&self) -> usize[src]

Query for the number of frames needed for the next call to "process".

pub fn set_resample_ratio(
    &mut self,
    _new_ratio: f64
) -> Result<(), Box<dyn Error>>
[src]

Update the resample ratio. This is not supported by this resampler and always returns an error.

pub fn set_resample_ratio_relative(
    &mut self,
    _rel_ratio: f64
) -> Result<(), Box<dyn Error>>
[src]

Update the resample ratio relative to the original one. This is not supported by this resampler and always returns an error.

pub fn process(
    &mut self,
    wave_in: &[Vec<f64>]
) -> Result<Vec<Vec<f64>>, Box<dyn Error>>
[src]

Resample a chunk of audio. The required input length is provided by the "nbr_frames_needed" function, and the output length is fixed. If the waveform for a channel is empty, this channel will be ignored and produce a corresponding empty output waveform.

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_needed".

impl Resampler<f64> for SincFixedIn<f64>[src]

pub fn process(
    &mut self,
    wave_in: &[Vec<f64>]
) -> Result<Vec<Vec<f64>>, Box<dyn Error>>
[src]

Resample a chunk of audio. The input length is fixed, and the output varies in length. If the waveform for a channel is empty, this channel will be ignored and produce a corresponding empty output waveform.

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.

pub 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

pub fn set_resample_ratio_relative(
    &mut self,
    rel_ratio: f64
) -> Result<(), Box<dyn Error>>
[src]

Update the resample ratio relative to the original one

pub 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 Resampler<f64> for SincFixedOut<f64>[src]

pub fn nbr_frames_needed(&self) -> usize[src]

Query for the number of frames needed for the next call to "process".

pub 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

pub fn set_resample_ratio_relative(
    &mut self,
    rel_ratio: f64
) -> Result<(), Box<dyn Error>>
[src]

Update the resample ratio relative to the original one

pub fn process(
    &mut self,
    wave_in: &[Vec<f64>]
) -> Result<Vec<Vec<f64>>, Box<dyn Error>>
[src]

Resample a chunk of audio. The required input length is provided by the "nbr_frames_needed" function, and the output length is fixed. If the waveform for a channel is empty, this channel will be ignored and produce a corresponding empty output waveform.

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_needed".

Loading content...