lib/midi.js
function (num, totalBytes) {
  var numBytes = Math.floor(Math.log(num) / Math.log(0xff)) + 1;
  var buffer = new Buffer(totalBytes);

  buffer.fill(0);
  buffer.writeUIntBE(num, totalBytes - numBytes, numBytes);

  return buffer;
}
function (num, totalBytes) {
  var numBytes = Math.floor(Math.log(num) / Math.log(0xff)) + 1;
  var buffer = new Buffer(totalBytes);

  buffer.fill(0);
  buffer.writeUIntBE(num, totalBytes - numBytes, numBytes);

  return buffer;
}
function ( num , totalBytes ) { var numBytes = Math . floor ( Math . log ( num ) / Math . log ( 0xff ) ) + 1 ; var buffer = new Buffer ( totalBytes ) ; buffer . fill ( 0 ) ; buffer . writeUIntBE ( num , totalBytes - numBytes , numBytes ) ; return buffer ; }
Return a number in a buffer padded to have a certain number of bytes
Return a number in a buffer padded to have a certain number of bytes