Resampling Audio


#1

Hi I’m fairly new to JUCE as well as a not so proficient C++ programmer yet. Basically my aim is to record a wav file to a fixed target sample rate of 16000Hz. The code I’m using is similar to the demo audio recording code (makes use of ThreadedWriter to write to a file inside the AudioDeviceIOCallback function). What I’m asking is how will I convert my inputChannelData first to a new sample rate prior to writing it to the target file?.. I understand there is a ResamplingAudioSource as well as the LagRangeInterpolator…Though I can’t seem to make it work. Apologies if I may ask a very simple question. Thanks so much!


#2

Have you looked at the r8brain libraries (https://github.com/avaneev/r8brain-free-src)? MIT licensed, easy to use and good quality.


#3

Sounds like he’s struggling with coding it, not with the algorithm quality… Yes, ResamplingAudioSource would probably be a good place to start looking at this.


#4

Yep misread the question slightly. I thought you were looking to re-sample a file after you’d gathered all the input data, rather than re-sample the input as you go.