code: function downsample(e, sampleRate, outputSampleRate) {
      if (sampleRate <= outputSampleRate) return e;
  
      var t = e.length;
      sampleRate += 0.0;
      outputSampleRate += 0.0;
  
      var s = 0,
          o = sampleRate / outputSampleRate,
          u = Math.ceil(t * outputSampleRate / sampleRate),
          a = new Float32Array(u);
  
      for (var i = 0; i < u; i++) {
          a[i] = e[Math.floor(s)];
          s += o;
      }
  
      return a;
  }
docs: thanks to http://stackoverflow.com/questions/31818112/downsample-pcm-audio-from-44100-to-8000