Creates new instance of resampler with the specified input and output sample rates and the number of channels.
input sample rate in Hz
output sample rate in Hz
number of channels
Get input sample rate in Hz.
Get the number of channels.
Get/set output sample rate in Hz.
After changing the sample rate you should consider updating buffer size to ChunkedInterleavedResampler.maxNumOutputFrames.
new sample rate in Hz
Get maximum output chunk length given the input chunk length.
Returns the same value as numOutputFrames plus one. This additional sample is used to compensate for unevenly divisible sample rates.
You should consider updating buffer size every time you change output sample rate via ChunkedInterleavedResampler.outputSampleRate.
Resamples input signal chunk from the source to the target sample rate and appends the resulting signal to the output.
Returns the number of processed input samples and the number of produced output samples. The output is clamped to [-1; 1].
For each ChunkedInterleavedResampler.inputSampleRate input samples this method produces exactly ChunkedInterleavedResampler.outputSampleRate output samples even if it is called multiple times with a smaller amount of input samples; the only exception is when the output sample rate was changed in the process.
Returns 0 when either the number of input or output frames is less than max(2, A-1), adjusted in accordance with sample rate ratio.
The output depends on the chunk size, hence resampling the same audio track all at once and in chunks will produce slightly different results. This a consequence of the fact that Lanczos kernel isn't an interpolation function, but a filter. To minimize such discrepancies chunk size should be much larger than 2⋅A + 1.
Resets internal state.
Erases any information about the previous chunk.
Use this method when you want to reuse resampler for another audio stream.
A resampler that processes audio input in chunks; the channels are interleaved with each other.
Use it to process audio streams.
Parameters
This resampler uses default parameters: N = 16, A = 3.
Limitations
ChunkedInterleavedResamplerproduces slightly different output compared to processing the whole input at once. If this is undesired, consider using WholeResampler.