title: javascript : interpolate an array of numbers
body: <p>few months back, I was looking for a way to downsample the audio data captured from mic using HTML5. I needed output rate as 12000Hz, if input was a direct multiplication of that (i.e 48000Hz) I had no problem, but it seemed complicated for other rates( e.g 44100Hz).</p>
  
  <p>In these scenarios, direct down sampling( retaining only 1 out every 4) won't work, so I thought of interpolation, but stackoverflow had no solution at that time. So answering it myself.</p>