index.js
function (line) {
    members = line.split(',');

    var timingPoint = {
      offset:            parseInt(members[0]),
      beatLength:        parseFloat(members[1]),
      velocity:          1,
      timingSignature:   parseInt(members[2]),
      sampleSetId:       parseInt(members[3]),
      customSampleIndex: parseInt(members[4]),
      sampleVolume:      parseInt(members[5]),
      timingChange:      (members[6] == 1),
      kiaiTimeActive:    (members[7] == 1)
    };

    if (!isNaN(timingPoint.beatLength) && timingPoint.beatLength !== 0) {
      if (timingPoint.beatLength > 0) {
        // If positive, beatLength is the length of a beat in milliseconds
        var bpm        = Math.round(60000 / timingPoint.beatLength);
        beatmap.bpmMin = beatmap.bpmMin ? Math.min(beatmap.bpmMin, bpm) : bpm;
        beatmap.bpmMax = beatmap.bpmMax ? Math.max(beatmap.bpmMax, bpm) : bpm;
        timingPoint.bpm    = bpm;
      } else {
        // If negative, beatLength is a velocity factor
        timingPoint.velocity = Math.abs(100 / timingPoint.beatLength);
      }
    }

    beatmap.timingPoints.push(timingPoint);
  }
function (line) {
    members = line.split(',');

    var timingPoint = {
      offset:            parseInt(members[0]),
      beatLength:        parseFloat(members[1]),
      velocity:          1,
      timingSignature:   parseInt(members[2]),
      sampleSetId:       parseInt(members[3]),
      customSampleIndex: parseInt(members[4]),
      sampleVolume:      parseInt(members[5]),
      timingChange:      (members[6] == 1),
      kiaiTimeActive:    (members[7] == 1)
    };

    if (!isNaN(timingPoint.beatLength) && timingPoint.beatLength !== 0) {
      if (timingPoint.beatLength > 0) {
        // If positive, beatLength is the length of a beat in milliseconds
        var bpm        = Math.round(60000 / timingPoint.beatLength);
        beatmap.bpmMin = beatmap.bpmMin ? Math.min(beatmap.bpmMin, bpm) : bpm;
        beatmap.bpmMax = beatmap.bpmMax ? Math.max(beatmap.bpmMax, bpm) : bpm;
        timingPoint.bpm    = bpm;
      } else {
        // If negative, beatLength is a velocity factor
        timingPoint.velocity = Math.abs(100 / timingPoint.beatLength);
      }
    }

    beatmap.timingPoints.push(timingPoint);
  }
function ( line ) { members = line . split ( ',' ) ; var timingPoint = { offset : parseInt ( members [ 0 ] ) , beatLength : parseFloat ( members [ 1 ] ) , velocity : 1 , timingSignature : parseInt ( members [ 2 ] ) , sampleSetId : parseInt ( members [ 3 ] ) , customSampleIndex : parseInt ( members [ 4 ] ) , sampleVolume : parseInt ( members [ 5 ] ) , timingChange : ( members [ 6 ] == 1 ) , kiaiTimeActive : ( members [ 7 ] == 1 ) } ; if ( ! isNaN ( timingPoint . beatLength ) && timingPoint . beatLength !== 0 ) { if ( timingPoint . beatLength > 0 ) { // If positive, beatLength is the length of a beat in milliseconds var bpm = Math . round ( 60000 / timingPoint . beatLength ) ; beatmap . bpmMin = beatmap . bpmMin ? Math . min ( beatmap . bpmMin , bpm ) : bpm ; beatmap . bpmMax = beatmap . bpmMax ? Math . max ( beatmap . bpmMax , bpm ) : bpm ; timingPoint . bpm = bpm ; } else { // If negative, beatLength is a velocity factor timingPoint . velocity = Math . abs ( 100 / timingPoint . beatLength ) ; } } beatmap . timingPoints . push ( timingPoint ) ; }
Parse a timing line
@param  {String} line
Parse a timing line