example/pong.js
function createAudioBuffer (length, createAudioDataCallback) {
  var channels = 2
  var frameCount = context.sampleRate * length
  var audioBuffer = context.createBuffer(channels, frameCount, context.sampleRate)

  for (var channel = 0; channel < channels; channel++) {
    var channelData = audioBuffer.getChannelData(channel)
    createAudioDataCallback(channelData, frameCount)
  }
  return audioBuffer
}
function createAudioBuffer (length, createAudioDataCallback) {
  var channels = 2
  var frameCount = context.sampleRate * length
  var audioBuffer = context.createBuffer(channels, frameCount, context.sampleRate)

  for (var channel = 0; channel < channels; channel++) {
    var channelData = audioBuffer.getChannelData(channel)
    createAudioDataCallback(channelData, frameCount)
  }
  return audioBuffer
}
function createAudioBuffer ( length , createAudioDataCallback ) { var channels = 2 var frameCount = context . sampleRate * length var audioBuffer = context . createBuffer ( channels , frameCount , context . sampleRate ) for ( var channel = 0 ; channel < channels ; channel ++ ) { var channelData = audioBuffer . getChannelData ( channel ) createAudioDataCallback ( channelData , frameCount ) } return audioBuffer }
create audio buffer that lasts `length` seconds, and `createAudioDataCallback` will will fill each of the two channels of the buffer with audio data.
create audio buffer that lasts length seconds and createAudioDataCallback will will fill each of the two channels of the buffer with audio data .