title: How to Convert Uploaded Audio to Blob using Javascript?
body: <p>I am trying to capture the audio that's uploaded by the user, convert it to Blob then using wavesurfer.js to display the waveform. </p>
  
  <p>I am following this instruction here <a href="https://bl.ocks.org/nolanlawson/62e747cea7af01542479" rel="nofollow noreferrer">https://bl.ocks.org/nolanlawson/62e747cea7af01542479</a> </p>
  
  <p>And here is the code</p>
  
  <pre><code>// Convert audio to Blob
    $('#audioFileInput').on('change', function () {
      var file = $('#audioFileInput')[0].files[0];
      var fileName = file.name;
      var fileType = file.type;
      var fileReader = new FileReader();
      fileReader.onloadend = function (e) {
        var arrayBuffer = e.target.result;
        blobUtil.arrayBufferToBlob(arrayBuffer, fileType).then(function (blob) {
          console.log('here is a blob', blob);
          console.log('its size is', blob.size);
          console.log('its type is', blob.type);
          surfTheBlob(blob);
        }).catch(console.log.bind(console));
      };
      fileReader.readAsArrayBuffer(file);
    });
  </code></pre>
  
  <p>But it says </p>
  
  <pre><code>blobUtil.arrayBufferToBlob(...).then is not a function
  </code></pre>
  
  <p>Another issue is that since the user might upload the audio themselves, the audio type might vary, expected to come from native device audio recorder. Anyone can help please? thanks.</p>