remix.js: two.html

// Remix two tracks at once.  
// Extract the first and third beats of track 1 with the second and fourth beats of track 2.
remixed = new Array();
var meter = parseInt(track.analysis.track.time_signature);
var numberOfBeats = Math.min(track.analysis.beats.length, track2.analysis.beats.length);
for (var i=0; i < numberOfBeats; i++) {
    if (i % meter == 0 || i % meter == 2) {
        remixed.push(track.analysis.beats[i])
    } else if (i % meter == 1 || i % meter == 3) {
        remixed.push(track2.analysis.beats[i])
    }
}

First Track


Second Track


Remixed Track