lib/midi.js
function (format, numTracks) {
  var chunklen = padNumber(6, 4); // MIDI header is always 6 bytes long
  var ntracks = padNumber(numTracks, 2);
  var tickdiv = padNumber(ticksPerBeat, 2);
  format = padNumber(format, 2); // Usually format 1 MIDI file (multuple overlayed tracks)

  return Buffer.concat([midiHeader, chunklen, format, ntracks, tickdiv]);
}
function (format, numTracks) {
  var chunklen = padNumber(6, 4); // MIDI header is always 6 bytes long
  var ntracks = padNumber(numTracks, 2);
  var tickdiv = padNumber(ticksPerBeat, 2);
  format = padNumber(format, 2); // Usually format 1 MIDI file (multuple overlayed tracks)

  return Buffer.concat([midiHeader, chunklen, format, ntracks, tickdiv]);
}
function ( format , numTracks ) { var chunklen = padNumber ( 6 , 4 ) ; // MIDI header is always 6 bytes long var ntracks = padNumber ( numTracks , 2 ) ; var tickdiv = padNumber ( ticksPerBeat , 2 ) ; format = padNumber ( format , 2 ) ; // Usually format 1 MIDI file (multuple overlayed tracks) return Buffer . concat ( [ midiHeader , chunklen , format , ntracks , tickdiv ] ) ; }
Given a number of tracks, return a MIDI header
Given a number of tracks return a MIDI header