function floatTo16BitPCM(output, offset, input){
for (var i = 0; i < input.length; i++, offset+=2){
var s = Math.max(-1, Math.min(1, input[i]));
output.
I do not believe you can control sample rate using Web Audio API ... it picks up the system default sample rate which is defined outside the browser ... of course subsequent to recording, you can programmatically alter your audio to resample to any sample rate ... Most audio players can only play media of standard sample rates ... being able to render an off sample rate of 16 kHz might be more challenging than resampling from 44.1 to 16 kHz