lib/file/encoder/track.js
function encodeTrack(track) {
    var events = track.getEvents(), data = [],
        length = events.length, i,
        runningStatus = null, result;

    for (i = 0; i < length; i += 1) {
        result = encodeEvent(events[i], runningStatus);
        runningStatus = result.runningStatus;

        data[i] = result.data;
    }

    return encodeChunk('MTrk', buffer.Buffer.concat(data));
}
function encodeTrack(track) {
    var events = track.getEvents(), data = [],
        length = events.length, i,
        runningStatus = null, result;

    for (i = 0; i < length; i += 1) {
        result = encodeEvent(events[i], runningStatus);
        runningStatus = result.runningStatus;

        data[i] = result.data;
    }

    return encodeChunk('MTrk', buffer.Buffer.concat(data));
}
function encodeTrack ( track ) { var events = track . getEvents ( ) , data = [ ] , length = events . length , i , runningStatus = null , result ; for ( i = 0 ; i < length ; i += 1 ) { result = encodeEvent ( events [ i ] , runningStatus ) ; runningStatus = result . runningStatus ; data [ i ] = result . data ; } return encodeChunk ( 'MTrk' , buffer . Buffer . concat ( data ) ) ; }
Encode a MIDI track chunk

@param {module:midijs/lib/file/track~Track} track Track to encode
@return {Buffer} Encoded track
Encode a MIDI track chunk