title: Converting Float32Array to Uint8Array while Preserving IEEE 754 Representation
body: <p>I have a float32Array from decodeAudioData method, which I want to convert it to Uint8Array while <strong>preserving the float32 IEEE 754 audio data</strong>.</p>
  
  <p>So far I tried,</p>
  
  <pre><code>var length = float32Array.length;
  
  var emptyBuffer = new ArrayBuffer(length * 4);
  var view = new DataView(emptyBuffer);
  
  for (var i = 0; i &lt; length; i++) {
    view.setFloat32(i * 4, float32Array[i], true);
  }
  
  var outputArray = new Uint8Array(length);
  
  for (var j = 0; j &lt; length; j++) {
    outputArray[j] = view.getUint8(j * 4);
  }
  
  return outputArray;
  </code></pre>
  
  <p><strong>Edit:</strong></p>
  
  <p>I just need to hold on to the binary representation just as in this <a href="https://stackoverflow.com/a/29342909/4130569">answer.</a></p>