abstract class RemiAudio::Resampler::Resampler

Overview

Base class for all resamplers.

Direct Known Subclasses

Defined in:

remiaudio/resampler/resampler.cr

Instance Method Summary

Instance Method Detail

def channels : Int32 #

The number of channels this resampler works on.


[View source]
def process(source : Array(Float32) | Slice(Float32), dest : Array(Float32) | Slice(Float32), ratio : Float64) : Tuple(Int64, Int64, Bool) #

Resamples the audio data in source, writing the results into dest, using the given ratio (targetRate / sourceRate).

Note that this method is not implemented in CallbackResampler classes and will raise a NotImplementedError if you attempt to use it with one.


[View source]
def process(source : Array(Float64) | Slice(Float64), dest : Array(Float64) | Slice(Float64), ratio : Float64) : Tuple(Int64, Int64, Bool) #

Resamples the audio data in source, writing the results into dest, using the given ratio (targetRate / sourceRate).

Note that this method is not implemented in CallbackResampler classes and will raise a NotImplementedError if you attempt to use it with one.


[View source]
def ratio=(value : Float64) : Nil #

Sets the ratio of the resampler. This can be changed between calls to process/read data and the library will try to smoothly transition between the conversion ratio of the last call and the conversion ratio of the current call.

If the user wants to bypass this smooth transition and achieve a step response in the conversion ratio, the #ratio= method can be used to set the starting conversion ratio of the next call to process/read data.

This will raise a BadRatioError if the ratio is out of range.


[View source]
def reset : Nil #

Resets the resampler.


[View source]