PageRenderTime 18ms CodeModel.GetById 14ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/flash/echo-nest-flash-api/examples/javascript/one.js

http://echo-nest-remix.googlecode.com/
JavaScript | 20 lines | 17 code | 3 blank | 0 comment | 3 complexity | 0fa3f496833f330f18922e9e7234b780 MD5 | raw file
 1function remix (analysis) {
 2  var bars = analysis.bars;
 3  var beats = analysis.beats;
 4  var beatIndex = 0;
 5  var samples = [];
 6
 7  for (var i = 0; i < bars.length; i++) {
 8    while (beatIndex < beats.length - 1 &&
 9           beats[beatIndex].value != bars[i].value) {
10      beatIndex++;
11    }
12
13    samples.push(
14      beats[beatIndex].value,
15      beats[beatIndex + 1].value
16    );
17  }
18
19  return samples;
20}