I believe this occurs because the resampler sees the buffer edges as discontinuities in the audio data. E.g. the first sample in the buffer is seen as having an infinite rise time from the "previous" sample, which causes and overshoot and high frequency ringing in the upsampled audio.
So, I fixed the problem by making the buffer 100 samples larger than needed, and filling the first 50 buffer locations with a copy of the first sample, and the last 50 locations with a copy of the last sample.
Then I loaded the audio data into the buffer with a 50 sample offset.
When consuming the up sampled result, I used a 50 * oversampleratio offset, and the length of the original audio in samples * oversampleratio.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm getting a little "glitch" or "pop" at the start of each buffer when upsampling and streaming, using code similar to example 2.
https://drive.google.com/file/d/1DhNIO6c50qhG-cEYvRGFjrpojy9iJsx3/view?usp=sharing
https://drive.google.com/file/d/12GyS9hpyTjeTK5wmc9x7drNds4avFSTH/view?usp=sharing
How can I avoid this?
I have tried all the different qualities/recipes.
Well for those that come after...
I believe this occurs because the resampler sees the buffer edges as discontinuities in the audio data. E.g. the first sample in the buffer is seen as having an infinite rise time from the "previous" sample, which causes and overshoot and high frequency ringing in the upsampled audio.
So, I fixed the problem by making the buffer 100 samples larger than needed, and filling the first 50 buffer locations with a copy of the first sample, and the last 50 locations with a copy of the last sample.
Then I loaded the audio data into the buffer with a 50 sample offset.
When consuming the up sampled result, I used a 50 * oversampleratio offset, and the length of the original audio in samples * oversampleratio.