Create new resampler with the specified input and output sample rates.
input sample rate in Hz
output sample rate in Hz
Get input sample rate in Hz.
Get/set output sample rate in Hz.
After changing the sample rate you should consider updating buffer size to ChunkedResampler.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 ChunkedResampler.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 ChunkedResampler.inputSampleRate input samples this method produces exactly ChunkedResampler.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 input length or output length 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.
Use it to process audio streams.
Parameters
This resampler uses default parameters: N = 16, A = 3.
Limitations
ChunkedResamplerproduces slightly different output compared to processing the whole input at once. If this is undesired, consider using WholeResampler.