On Mon, Jul 23, 2018 at 3:08 AM, Henrik G. Sundt <hsu...@notam02.no> wrote:
> This solution, without using any low pass filters before and after the > desimation, will generate a lot of aliasing frequencies, Kjetil! > > Here is another solution: > https://github.com/intervigilium/libresample/tree/master/jni/resample > > For linear interpolation, here is a version that's easier to read: currReadPos = 2.0; prevVal = 0.0; nextVal = 0.0; float getOutputSample(){ while(currReadPos > 1.0){ currReadPos-=1.0; prevVal=nextVal; nextVal=getInputSample(); } float ret = prevVal + currReadPos * (nextVal-prevVal); currReadPos += (input_samplerate / output_samplerate); return ret; }
_______________________________________________ dupswapdrop: music-dsp mailing list music-dsp@music.columbia.edu https://lists.columbia.edu/mailman/listinfo/music-dsp