In a C++ Program, I am trying to downsample blocks of 8192 audio samples (-32768...32767). The original Sampling Rate is 48kHz, and I'd like to have 16kHz.
The ratio 16/48 should yield roughly 2731 samples if the original number of samples is 8192.
I tried to use libav for this, using this code for every block of 8192 input samples:
struct AVResampleContext* ctx = av_resample_init(16000,48000,16,10,1,1.0)
av_resample(ctx,dataIn,dataOut,&samplesConsumed,8192,2731,0)
This seems to work to a certain degree, however - the last 30 samples or so are zeros in each output block of 2731 samples, so one can always here an "audible click"
What am I doing wrong here?
Thank you very much for any help!