Hi there. I’ve previously used juce::ResamplingAudioSource
to play a sound file at a different speed, and now I’m trying to resample a juce::AudioBuffer
. However, I’m encountering a problem with the resampling process, as it produces a very glitchy sound.
getNextAudioBlock(const juce::AudioSourceChannelInfo& bufferToFill)
{
juce::AudioBuffer<float> buffer(*bufferToFill.buffer);
//other processing code
ResampledMemorySource memSource(bufferToResample, resamplingRatio);
//prepare resampler
memSource.prepareToPlay(bufferToResample.getNumSamples(), spec.sampleRate);
//resample the buffer
memSource.getNextAudioBlock(juce::AudioSourceChannelInfo(resampledBuffer));
////Copy bufferToResample to buffer
buffer.makeCopyOf(resampledBuffer);
}
ResamplingMemorySource is a simple class to resample a juce::AudioBuffer using juce::MemoryAudioSource and juce::ResamplingAudioSource classes.
What should I do to fix this problem?