function audiobuffer_to_i16(audiobuffer)
{
  var len = audiobuffer.length;
  var channels = audiobuffer.numberOfChannels;
  var rv = new Int16Array(len);
  for (var i = 0; i < len; i++) {
    rv[i] = 0;
    for (var c = 0; c < channels; c++) {
      rv[i] += audiobuffer.getChannelData(c)[i] * Math.pow(2, 15);
    }
  }
  return rv;
}
/**
 * Convert from float to i16, and downmix to mono if needed.
 */
Convert from float to i16, and downmix to mono if needed.
Convert from float to i16 and downmix to mono if needed .
function audiobuffer_to_i16(audiobuffer)
{
  var len = audiobuffer.length;
  var channels = audiobuffer.numberOfChannels;
  var rv = new Int16Array(len);
  for (var i = 0; i < len; i++) {
    rv[i] = 0;
    for (var c = 0; c < channels; c++) {
      rv[i] += audiobuffer.getChannelData(c)[i] * Math.pow(2, 15);
    }
  }
  return rv;
}
function audiobuffer_to_i16 ( audiobuffer ) { var len = audiobuffer . length ; var channels = audiobuffer . numberOfChannels ; var rv = new Int16Array ( len ) ; for ( var i = 0 ; i < len ; i ++ ) { rv [ i ] = 0 ; for ( var c = 0 ; c < channels ; c ++ ) { rv [ i ] += audiobuffer . getChannelData ( c ) [ i ] * Math . pow ( 2 , 15 ) ; } } return rv ; }
Convert from float to i16, and downmix to mono if needed.
Convert from float to i16 and downmix to mono if needed .