title: Web Audio API - loading a file and playing it
body: <p>There are some questions similar on SO but it appears the syntax is all deprecated.</p>
  
  <p>I'm trying to load a sound off of my DropBox (public link) and play it at startup of my app.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>var context = new webkitAudioContext();
  function start() {
  // Note: this will load asynchronously
  var request = new XMLHttpRequest();
  request.open("GET", "https://dl.dropboxusercontent.com/u/86304379/Pt.%205%20Flood%20the%20Soul.wav", true);
  request.responseType = "arraybuffer"; // Read as binary data
  // Asynchronous callback
  request.onload = function() {
      var data = request.response;
  
      audioRouting(data);
  };
  request.send();
  }
  function audioRouting(data) {
      source = context.createBufferSource(); // Create sound source
      buffer = context.createBuffer(data, true/* make mono */); // Create source buffer from raw binary
      source.buffer = buffer; // Add buffered data to object
      source.connect(context.destination); // Connect sound source to output
      playSound(source); // Pass the object to the play function
  }
      // Tell the Source when to play
  function playSound() {
      source.noteOn(context.currentTime); // play the source immediately
  }
  </code></pre>
  
  <p>Alas - I call playSound() in one of my functions and I get </p>
  
  <p>"Cannot call method 'noteOn' of undefined "</p>
  
  <p>Is this because noteOn is deprecated? Or is something else amiss. I just want to load some audio into an audio node and play it - I have not found any ample code online that displays how to do this.</p>