title: Streaming raw PCM over socket.io results in noise
body: <p>I'm working off the fantastic sample <a href="https://github.com/vin-ni/Google-Cloud-Speech-Node-Socket-Playground/tree/master/srcLogOnly" rel="nofollow noreferrer">here</a>.</p>
  <p>In essence, I am capturing audio from the mic using getUserMedia and then downsampling each frame to an Int16Array of 16000 samples per second.</p>
  <p>On the server side, I am able to receive the audio and using the <a href="https://www.npmjs.com/package/wav" rel="nofollow noreferrer">wav</a> package, I am able to save WAV files as well.</p>
  <p>The problem is when I <em>don't</em> want to downsample (yes, I know the bandwidth implication but that's my requirement).</p>
  <p>I'm able to stream raw audio (in <code>Float32Array</code>) and able to save it as a WAV. However, there's a lot of white noise added in.</p>
  <p>When I downsample on the server side, the WAV package is unable to handle it because it is no longer a viable WAV frame.</p>
  <p>I tried to wrap the mic samples using</p>
  <pre><code>var samples = new Float32Array(e.inputBuffer.getChannelData(0))
  socket.emit('binaryData',samples.buffer);
  </code></pre>
  <p>and received it on the server side with</p>
  <pre><code>socket.on('binaryData',function (data){
   var recovered = new Float32Array(data);
   wavFileWriter.write(recovered.buffer);
  });
  </code></pre>
  <p>But that doesn't work either.</p>
  <p>I'm now wondering if Socket.io does something to the data that trips the <a href="https://github.com/vin-ni/Google-Cloud-Speech-Node-Socket-Playground/blob/51ddef23b3cf95c3f903c352cf2b62745ed8cf00/srcLogOnly/public/js/client.js#L285" rel="nofollow noreferrer">downsample</a> function.</p>
  <p>Or am I missing something obvious here?</p>
  <p>Edit 1: in my quest to rule out Socket.io issues, I created the server with these settings without any improvement:</p>
  <pre><code>{
      perMessageDeflate: false,
      httpCompression: false,
      maxHttpBufferSize:1e8
    }
  </code></pre>