Playback an AudioBuffer the same at various samplerates


#1

i am making a kick drum, and i have a small table of 100 samples for the initial click. This was chosen via experimentation, and is in my opinion the best sounding ‘noise’ for the click. I don’t want to use random noise.

I have an AudioBuffer set to play that table, and it sounds good at 44100hz samplerate,

But as it’s a VST, and will need to play at all possible samplerates, what’s the best way of wrapping it so it will still play at the correct speed, same as it does at 44100?

i had a look, and there is a ResamplingAudioSource, is that what i should use? or is there a simpler way?


#2

ResamplingAudioSource will do that. But why are you rolling your own playback rather than just using a Sampler and SamplerSound/Voice to play it, which will take care of all this stuff (and more)?


#3

it’s a port of old C code i did, before finding Juce


#4

will look into the relevant Juce classes though, cheers