demos/beatSequence.js
function(track) {
  var request = new XMLHttpRequest()
  request.open('GET', 'sounds/' + track + '.wav', true)
  request.responseType = 'arraybuffer'
  request.onload = function() {
    context.decodeAudioData(request.response, function(buffer) {
      var createNode = function() {
        var node = context.createBufferSource()
        node.buffer = buffer
        node.connect(context.destination)
        return node
      }
      soundBank[track] = { createNode: createNode }
    })
  }
  request.send()
}
function(track) {
  var request = new XMLHttpRequest()
  request.open('GET', 'sounds/' + track + '.wav', true)
  request.responseType = 'arraybuffer'
  request.onload = function() {
    context.decodeAudioData(request.response, function(buffer) {
      var createNode = function() {
        var node = context.createBufferSource()
        node.buffer = buffer
        node.connect(context.destination)
        return node
      }
      soundBank[track] = { createNode: createNode }
    })
  }
  request.send()
}
function ( track ) { var request = new XMLHttpRequest ( ) request . open ( 'GET' , 'sounds/' + track + '.wav' , true ) request . responseType = 'arraybuffer' request . onload = function ( ) { context . decodeAudioData ( request . response , function ( buffer ) { var createNode = function ( ) { var node = context . createBufferSource ( ) node . buffer = buffer node . connect ( context . destination ) return node } soundBank [ track ] = { createNode : createNode } } ) } request . send ( ) }
This helper loads sound buffers
This helper loads sound buffers