function createConstantBuffer(context, values, length) {
  var constantBuffer = context.createBuffer(
      values.length, length, context.sampleRate);

  for (var channel = 0; channel < constantBuffer.numberOfChannels; channel++) {
    var channelData = constantBuffer.getChannelData(channel);
    for (var index = 0; index < channelData.length; index++)
      channelData[index] = values[channel];
  }

  return constantBuffer;
}
Create a buffer for testing. Each channel contains a stream of single,
user-defined value.
@param {AudioContext} context    AudioContext.
@param {Array} values            User-defined constant value for each
                                 channel.
@param {Number} length           Buffer length in samples.
@return {AudioBuffer}