Resampling samplersound/audio file?

So I’m working on a sampler for my synth, but I’ve been having some trouble loading files with a different sample rate. Basically, if I load in and play a wav file that has a sampling rate of i.e 48000, the sample kind of fades in and doesn’t sound right. I figured that I probably have to use resampling for the files to match my plugin/hosts sample rate, although that’s where I’m stuck, as I don’t really know how I should go about it.

I’m currently using an AudioFormatReader as the source when passing it to the SamplerSound,
so is there maybe a way that I would be able to resample the source before passing it to the sampler?
I’ve looked at the ResamplingAudioSource, LagrangeInterpolator & CatmullRomInterpolator classes, but I’m not quite sure which approach to take.

Any help will be appreciated!

1 Like