Skip to content

Instantly share code, notes, and snippets.

@indirajhenny
Created June 20, 2017 18:40
Show Gist options
  • Save indirajhenny/59cc14d3da23165934772e43f367ea0b to your computer and use it in GitHub Desktop.
Save indirajhenny/59cc14d3da23165934772e43f367ea0b to your computer and use it in GitHub Desktop.
miniPianoRoll
license: mit
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>Chronological Diagram of Asia</title>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.v2.js"></script>
<script type="text/javascript" src="notesOnlyJSON.js"></script>
<style type="text/css">
.chart {
shape-rendering: crispEdges;
}
.mini text {
font: 9px sans-serif;
}
.main text {
font: 12px sans-serif;
}
.miniItem0 {
fill: darksalmon;
stroke: black;
stroke-width: 2;
}
.miniItem1 {
fill: darkolivegreen;
fill-opacity: .7;
stroke: black;
stroke-width: 2
}
.miniItem2 {
fill: slategray;
fill-opacity: .7;
stroke: black;
stroke-width: 2;
}
.brush .extent {
stroke: gray;
fill: dodgerblue;
fill-opacity: .365;
}
</style>
</head>
<body>
<script type="text/javascript">
//data
var lanes = ["E4", "C4", "A3"],
laneLength = lanes.length,
timeBegin = 0,
timeEnd = 65.33326800000005;
</script>
<script type="text/javascript">
var m = [20, 15, 15, 120], //top right bottom left
w = 960 - m[1] - m[3],
h = 500 - m[0] - m[2],
miniHeight = laneLength * 12 + 50,
mainHeight = h - miniHeight - 50;
//scales
var x = d3.scale.linear() //where is this positioned? at the top or bottom? this might be for main
.domain([timeBegin, timeEnd])
.range([0, w]);
var x1 = d3.scale.linear()
//.domain([timeBegin, timeEnd])
.range([0, w]);
var y1 = d3.scale.linear()
.domain([0, laneLength])
.range([0, mainHeight]);
var y2 = d3.scale.linear()
.domain([0, laneLength])
.range([0, miniHeight]);
var //xAxis = d3.svg.axis().scale(x1).orient("bottom"),
xAxis2 = d3.svg.axis().scale(x).orient("bottom"),
drag = d3.behavior.drag() //when moving rect from left side, other components of rectangle need to be resized //so we must include this...i think
.on("drag", dragmove);
chart = d3.select("body")
.append("svg")
.attr("width", w + m[1] + m[3])
.attr("height", h + m[0] + m[2])
.attr("class", "chart");
var mini = chart.append("g")
.attr("transform", "translate(" + m[3] + "," + (mainHeight + m[0]) + ")")
.attr("width", w)
.attr("height", miniHeight)
.attr("class", "mini");
//mini lanes and texts
mini.append("g").selectAll(".laneLines")
.data(minimalNotesFinal)
//.data(notes)
.enter().append("line")
.attr("x1", m[1])
.attr("y1", function(d) {return y2(d.lane);})
.attr("x2", w)
.attr("y2", function(d) {return y2(d.lane);})
.attr("stroke", "lightgray");
mini.append("g").selectAll(".laneText")
.data(lanes)
.enter().append("text")
.text(function(d) {return d;})
.attr("x", -m[1])
.attr("y", function(d, i) {return y2(i + .5);})
.attr("dy", ".5ex")
.attr("text-anchor", "end")
.attr("class", "laneText");
mini.append("g")
.attr("class", "x axis")
.attr("transform", "translate(0," + miniHeight + ")")
.call(xAxis2);
/*var itemRects = mini.append("g")
.attr("clip-path", "url(#clip)");*/
//mini item rects soon to be brushes
mini.append("g").selectAll("miniItems")
.data(minimalNotesFinal)
.enter().append("rect") //"brush"
.attr("class", function(d) {return "miniItem" + d.lane;}) //midi
.attr("x", function(d) {return x(d.time);}) //time
.attr("y", function(d) {return y2(d.lane + .5) - 5;}) //midi
.attr("width", function(d) {
return x(d.duration);})
.attr("height", 10)
.call(drag);
//brush on mini chart
/*var brush = d3.svg.brush()
.x(x)
.on("brush", display);*/
mini.append("g")
.attr("class", "x brush")
//.call(brush)
.selectAll("rect")
.attr("y", 1)
.attr("height", miniHeight - 1);
//.call(drag);
//display();
function display() {
var rects, labels, axis
minExtent = brush.extent()[0],
maxExtent = brush.extent()[1],
visItems = minimalNotesFinal.filter(function(d) {
end = d.time + d.duration;
return d.time < maxExtent && (end) > minExtent;});//MAKE SURE THIS IS OKAY
//visItems = notes.filter(function(d) {return d.time < maxExtent && (d.duration + d.time) > minExtent;});
mini.select(".brush")
.call(brush.extent([minExtent, maxExtent]));
x1.domain([minExtent, maxExtent]);
//update main item rects //update main items brushes
rects = itemRects.selectAll("rect")
.data(visItems, function(d) { return d.name; }) //name
.attr("x", function(d) {return x1(d.time);}) //time
.attr("width", function(d) {return x1(d.time + d.duration) - x1(d.time);});
var dragRect = rects.enter().append("rect")
.attr("class", function(d) {return "miniItem" + d.lane;}) //midi
.attr("x", function(d) {return x1(d.time);})
.attr("y", function(d) {return y1(d.lane) + 10;})
.attr("width", function(d) {return x1(d.time + d.duration) - x1(d.time);})
.attr("height", function(d) {return .8 * y1(1);})
.attr("cursor", "move")
.call(drag);
rects.exit().remove();
x1.domain(brush.empty() ? x.domain() : brush.extent());
main.select(".main").attr("d", main); //area
main.select(".x.axis").call(xAxis);
}
function dragmove(d) {
d3.select(this)
//.attr("transform", "translate(" + d3.event.x + ")");
.attr("x", d.x = Math.max(0, d3.event.x));
}
</script>
</body>
</html>
var notes = [
{
"name": "G4",
"midi": 67,
"time": 1.333332,
"velocity": 0.7165354330708661,
"duration": 0.49999949999999993
},
{
"name": "E4",
"midi": 64,
"time": 1.8333315,
"velocity": 0.6771653543307087,
"duration": 0.16666650000000005
},
{
"name": "C4",
"midi": 60,
"time": 1.999998,
"velocity": 0.6771653543307087,
"duration": 0.666666
},
{
"name": "C3",
"midi": 48,
"time": 1.999998,
"velocity": 0.6771653543307087,
"duration": 0.666666
},
{
"name": "E4",
"midi": 64,
"time": 2.666664,
"velocity": 0.8110236220472441,
"duration": 0.6666660000000002
},
{
"name": "C4",
"midi": 60,
"time": 2.666664,
"velocity": 0.937007874015748,
"duration": 0.6666660000000002
},
{
"name": "G4",
"midi": 67,
"time": 3.33333,
"velocity": 0.8582677165354331,
"duration": 0.6666660000000002
},
{
"name": "B3",
"midi": 59,
"time": 3.33333,
"velocity": 0.7795275590551181,
"duration": 0.6666660000000002
},
{
"name": "E4",
"midi": 64,
"time": 3.9999960000000003,
"velocity": 0.8976377952755905,
"duration": 1.3333320000000004
},
{
"name": "A4",
"midi": 69,
"time": 3.9999960000000003,
"velocity": 0.8976377952755905,
"duration": 1.3333320000000004
},
{
"name": "C5",
"midi": 72,
"time": 3.9999960000000003,
"velocity": 0.8976377952755905,
"duration": 1.3333320000000004
},
{
"name": "A3",
"midi": 57,
"time": 3.9999960000000003,
"velocity": 0.7401574803149606,
"duration": 0.6666660000000002
},
{
"name": "C4",
"midi": 60,
"time": 4.6666620000000005,
"velocity": 0.8582677165354331,
"duration": 0.6666660000000002
},
{
"name": "E4",
"midi": 64,
"time": 5.333328000000001,
"velocity": 0.8582677165354331,
"duration": 0.4999995000000004
},
{
"name": "G#4",
"midi": 68,
"time": 5.333328000000001,
"velocity": 0.8582677165354331,
"duration": 0.4999995000000004
},
{
"name": "E5",
"midi": 76,
"time": 5.333328000000001,
"velocity": 0.8582677165354331,
"duration": 0.4999995000000004
},
{
"name": "E3",
"midi": 52,
"time": 5.333328000000001,
"velocity": 0.6929133858267716,
"duration": 0.6666660000000002
},
{
"name": "D5",
"midi": 74,
"time": 5.833327500000001,
"velocity": 0.7244094488188977,
"duration": 0.16666649999999983
},
{
"name": "E4",
"midi": 64,
"time": 5.999994000000001,
"velocity": 0.7165354330708661,
"duration": 0.6666660000000002
},
{
"name": "A4",
"midi": 69,
"time": 5.999994000000001,
"velocity": 0.7165354330708661,
"duration": 0.6666660000000002
},
{
"name": "C5",
"midi": 72,
"time": 5.999994000000001,
"velocity": 0.7165354330708661,
"duration": 0.6666660000000002
},
{
"name": "A3",
"midi": 57,
"time": 5.999994000000001,
"velocity": 0.8346456692913385,
"duration": 0.6666660000000002
},
{
"name": "E4",
"midi": 64,
"time": 6.666660000000001,
"velocity": 0.5826771653543307,
"duration": 0.6666660000000002
},
{
"name": "A3",
"midi": 57,
"time": 6.666660000000001,
"velocity": 0.8346456692913385,
"duration": 0.6666660000000002
},
{
"name": "C4",
"midi": 60,
"time": 6.666660000000001,
"velocity": 0.8346456692913385,
"duration": 0.6666660000000002
},
{
"name": "C4",
"midi": 60,
"time": 7.333326000000001,
"velocity": 0.7874015748031497,
"duration": 0.6666660000000002
},
{
"name": "D4",
"midi": 62,
"time": 7.333326000000001,
"velocity": 0.7874015748031497,
"duration": 0.6666660000000002
},
{
"name": "F#4",
"midi": 66,
"time": 7.333326000000001,
"velocity": 0.7874015748031497,
"duration": 0.6666660000000002
},
{
"name": "A3",
"midi": 57,
"time": 7.333326000000001,
"velocity": 0.7637795275590551,
"duration": 0.6666660000000002
},
{
"name": "B3",
"midi": 59,
"time": 7.9999920000000015,
"velocity": 0.8031496062992126,
"duration": 1.3333319999999995
},
{
"name": "D4",
"midi": 62,
"time": 7.9999920000000015,
"velocity": 0.8031496062992126,
"duration": 1.3333319999999995
},
{
"name": "G4",
"midi": 67,
"time": 7.9999920000000015,
"velocity": 0.8031496062992126,
"duration": 1.3333319999999995
},
{
"name": "G3",
"midi": 55,
"time": 7.9999920000000015,
"velocity": 0.7637795275590551,
"duration": 0.6666660000000002
},
{
"name": "B3",
"midi": 59,
"time": 8.666658000000002,
"velocity": 0.9133858267716536,
"duration": 0.6666659999999993
},
{
"name": "D4",
"midi": 62,
"time": 8.666658000000002,
"velocity": 0.9133858267716536,
"duration": 0.6666659999999993
},
{
"name": "G4",
"midi": 67,
"time": 9.333324000000001,
"velocity": 0.7952755905511811,
"duration": 0.33333299999999966
},
{
"name": "B3",
"midi": 59,
"time": 9.333324000000001,
"velocity": 0.8503937007874016,
"duration": 0.6666659999999993
},
{
"name": "D4",
"midi": 62,
"time": 9.333324000000001,
"velocity": 0.8503937007874016,
"duration": 0.6666659999999993
},
{
"name": "G4",
"midi": 67,
"time": 9.666657,
"velocity": 0.7559055118110236,
"duration": 0.33333299999999966
},
{
"name": "E5",
"midi": 76,
"time": 9.99999,
"velocity": 0.952755905511811,
"duration": 0.999998999999999
},
{
"name": "C3",
"midi": 48,
"time": 9.99999,
"velocity": 0.6614173228346457,
"duration": 0.6666659999999993
},
{
"name": "G3",
"midi": 55,
"time": 10.666656,
"velocity": 0.984251968503937,
"duration": 0.6666659999999993
},
{
"name": "C4",
"midi": 60,
"time": 10.666656,
"velocity": 0.984251968503937,
"duration": 0.6666659999999993
},
{
"name": "D5",
"midi": 74,
"time": 10.999989,
"velocity": 0.7322834645669292,
"duration": 0.33333299999999966
},
{
"name": "C5",
"midi": 72,
"time": 11.333321999999999,
"velocity": 0.7165354330708661,
"duration": 0.6666659999999993
},
{
"name": "A3",
"midi": 57,
"time": 11.333321999999999,
"velocity": 0.8031496062992126,
"duration": 0.6666659999999993
},
{
"name": "C4",
"midi": 60,
"time": 11.333321999999999,
"velocity": 0.8031496062992126,
"duration": 0.6666659999999993
},
{
"name": "G4",
"midi": 67,
"time": 11.999987999999998,
"velocity": 0.7244094488188977,
"duration": 1.3333319999999986
},
{
"name": "B4",
"midi": 71,
"time": 11.999987999999998,
"velocity": 0.7244094488188977,
"duration": 1.3333319999999986
},
{
"name": "G3",
"midi": 55,
"time": 11.999987999999998,
"velocity": 0.7244094488188977,
"duration": 0.6666659999999993
},
{
"name": "B3",
"midi": 59,
"time": 12.666653999999998,
"velocity": 0.889763779527559,
"duration": 0.6666659999999993
},
{
"name": "D4",
"midi": 62,
"time": 12.666653999999998,
"velocity": 0.889763779527559,
"duration": 0.6666659999999993
},
{
"name": "F4",
"midi": 65,
"time": 13.333319999999997,
"velocity": 0.7165354330708661,
"duration": 0.33333299999999966
},
{
"name": "A4",
"midi": 69,
"time": 13.333319999999997,
"velocity": 0.7165354330708661,
"duration": 0.33333299999999966
},
{
"name": "B3",
"midi": 59,
"time": 13.333319999999997,
"velocity": 0.8031496062992126,
"duration": 0.6666659999999993
},
{
"name": "D4",
"midi": 62,
"time": 13.333319999999997,
"velocity": 0.8031496062992126,
"duration": 0.6666659999999993
},
{
"name": "B4",
"midi": 71,
"time": 13.666652999999997,
"velocity": 0.8110236220472441,
"duration": 0.33333299999999966
},
{
"name": "E4",
"midi": 64,
"time": 13.999985999999996,
"velocity": 0.7874015748031497,
"duration": 0.6666659999999993
},
{
"name": "C5",
"midi": 72,
"time": 13.999985999999996,
"velocity": 0.7874015748031497,
"duration": 0.6666659999999993
},
{
"name": "C3",
"midi": 48,
"time": 13.999985999999996,
"velocity": 0.6692913385826772,
"duration": 0.6666659999999993
},
{
"name": "E4",
"midi": 64,
"time": 14.666651999999996,
"velocity": 0.7322834645669292,
"duration": 0.6666659999999993
},
{
"name": "C5",
"midi": 72,
"time": 14.666651999999996,
"velocity": 0.7322834645669292,
"duration": 0.6666659999999993
},
{
"name": "G3",
"midi": 55,
"time": 14.666651999999996,
"velocity": 0.9291338582677166,
"duration": 0.6666659999999993
},
{
"name": "C4",
"midi": 60,
"time": 14.666651999999996,
"velocity": 0.9291338582677166,
"duration": 0.6666659999999993
},
{
"name": "E4",
"midi": 64,
"time": 15.333317999999995,
"velocity": 0.6692913385826772,
"duration": 0.6666659999999993
},
{
"name": "G4",
"midi": 67,
"time": 15.333317999999995,
"velocity": 0.6692913385826772,
"duration": 0.6666659999999993
},
{
"name": "G3",
"midi": 55,
"time": 15.333317999999995,
"velocity": 0.7480314960629921,
"duration": 0.6666659999999993
},
{
"name": "E4",
"midi": 64,
"time": 15.999983999999994,
"velocity": 0.6929133858267716,
"duration": 0.6666659999999993
},
{
"name": "E3",
"midi": 52,
"time": 15.999983999999994,
"velocity": 0.7165354330708661,
"duration": 0.6666659999999993
},
{
"name": "C4",
"midi": 60,
"time": 16.666649999999994,
"velocity": 0.6929133858267716,
"duration": 0.6666659999999993
},
{
"name": "C3",
"midi": 48,
"time": 16.666649999999994,
"velocity": 0.7480314960629921,
"duration": 0.6666659999999993
},
{
"name": "G4",
"midi": 67,
"time": 17.333315999999993,
"velocity": 0.889763779527559,
"duration": 0.49999950000000126
},
{
"name": "G3",
"midi": 55,
"time": 17.333315999999993,
"velocity": 0.84251968503937,
"duration": 0.6666660000000029
},
{
"name": "E4",
"midi": 64,
"time": 17.833315499999994,
"velocity": 0.7401574803149606,
"duration": 0.1666665000000016
},
{
"name": "C4",
"midi": 60,
"time": 17.999981999999996,
"velocity": 0.6929133858267716,
"duration": 0.6666659999999993
},
{
"name": "C3",
"midi": 48,
"time": 17.999981999999996,
"velocity": 0.7322834645669292,
"duration": 0.6666659999999993
},
{
"name": "E4",
"midi": 64,
"time": 18.666647999999995,
"velocity": 0.8267716535433071,
"duration": 0.6666659999999993
},
{
"name": "C4",
"midi": 60,
"time": 18.666647999999995,
"velocity": 1,
"duration": 0.6666659999999993
},
{
"name": "E4",
"midi": 64,
"time": 19.333313999999994,
"velocity": 0.8503937007874016,
"duration": 0.6666659999999993
},
{
"name": "G4",
"midi": 67,
"time": 19.333313999999994,
"velocity": 0.8503937007874016,
"duration": 0.6666659999999993
},
{
"name": "B3",
"midi": 59,
"time": 19.333313999999994,
"velocity": 0.7952755905511811,
"duration": 0.6666659999999993
},
{
"name": "E4",
"midi": 64,
"time": 19.999979999999994,
"velocity": 0.889763779527559,
"duration": 1.3333319999999986
},
{
"name": "A4",
"midi": 69,
"time": 19.999979999999994,
"velocity": 0.889763779527559,
"duration": 1.3333319999999986
},
{
"name": "C5",
"midi": 72,
"time": 19.999979999999994,
"velocity": 0.889763779527559,
"duration": 1.3333319999999986
},
{
"name": "A3",
"midi": 57,
"time": 19.999979999999994,
"velocity": 0.7165354330708661,
"duration": 0.6666659999999993
},
{
"name": "C4",
"midi": 60,
"time": 20.666645999999993,
"velocity": 0.9291338582677166,
"duration": 0.6666659999999993
},
{
"name": "E4",
"midi": 64,
"time": 20.666645999999993,
"velocity": 0.9291338582677166,
"duration": 0.6666659999999993
},
{
"name": "E4",
"midi": 64,
"time": 21.333311999999992,
"velocity": 0.8818897637795275,
"duration": 0.49999950000000126
},
{
"name": "G#4",
"midi": 68,
"time": 21.333311999999992,
"velocity": 0.8818897637795275,
"duration": 0.49999950000000126
},
{
"name": "E5",
"midi": 76,
"time": 21.333311999999992,
"velocity": 0.8818897637795275,
"duration": 0.49999950000000126
},
{
"name": "E3",
"midi": 52,
"time": 21.333311999999992,
"velocity": 0.7086614173228346,
"duration": 0.6666660000000029
},
{
"name": "D5",
"midi": 74,
"time": 21.833311499999994,
"velocity": 0.7322834645669292,
"duration": 0.1666665000000016
},
{
"name": "E4",
"midi": 64,
"time": 21.999977999999995,
"velocity": 0.6850393700787402,
"duration": 0.6666659999999993
},
{
"name": "A4",
"midi": 69,
"time": 21.999977999999995,
"velocity": 0.6850393700787402,
"duration": 0.6666659999999993
},
{
"name": "C5",
"midi": 72,
"time": 21.999977999999995,
"velocity": 0.6850393700787402,
"duration": 0.6666659999999993
},
{
"name": "A3",
"midi": 57,
"time": 21.999977999999995,
"velocity": 0.7874015748031497,
"duration": 0.6666659999999993
},
{
"name": "E4",
"midi": 64,
"time": 22.666643999999994,
"velocity": 0.6377952755905512,
"duration": 0.6666659999999993
},
{
"name": "A3",
"midi": 57,
"time": 22.666643999999994,
"velocity": 0.8503937007874016,
"duration": 0.6666659999999993
},
{
"name": "C4",
"midi": 60,
"time": 22.666643999999994,
"velocity": 0.8503937007874016,
"duration": 0.6666659999999993
},
{
"name": "C4",
"midi": 60,
"time": 23.333309999999994,
"velocity": 0.7559055118110236,
"duration": 0.6666659999999993
},
{
"name": "D4",
"midi": 62,
"time": 23.333309999999994,
"velocity": 0.7559055118110236,
"duration": 0.6666659999999993
},
{
"name": "F#4",
"midi": 66,
"time": 23.333309999999994,
"velocity": 0.7559055118110236,
"duration": 0.6666659999999993
},
{
"name": "A3",
"midi": 57,
"time": 23.333309999999994,
"velocity": 0.7244094488188977,
"duration": 0.6666659999999993
},
{
"name": "B3",
"midi": 59,
"time": 23.999975999999993,
"velocity": 0.7795275590551181,
"duration": 1.3333319999999986
},
{
"name": "D4",
"midi": 62,
"time": 23.999975999999993,
"velocity": 0.7795275590551181,
"duration": 1.3333319999999986
},
{
"name": "G4",
"midi": 67,
"time": 23.999975999999993,
"velocity": 0.7795275590551181,
"duration": 1.3333319999999986
},
{
"name": "G3",
"midi": 55,
"time": 23.999975999999993,
"velocity": 0.7401574803149606,
"duration": 0.6666659999999993
},
{
"name": "B3",
"midi": 59,
"time": 24.666641999999992,
"velocity": 0.889763779527559,
"duration": 0.6666659999999993
},
{
"name": "D4",
"midi": 62,
"time": 24.666641999999992,
"velocity": 0.889763779527559,
"duration": 0.6666659999999993
},
{
"name": "G4",
"midi": 67,
"time": 25.33330799999999,
"velocity": 0.7480314960629921,
"duration": 0.33333299999999966
},
{
"name": "B3",
"midi": 59,
"time": 25.33330799999999,
"velocity": 0.7795275590551181,
"duration": 0.6666659999999993
},
{
"name": "D4",
"midi": 62,
"time": 25.33330799999999,
"velocity": 0.7795275590551181,
"duration": 0.6666659999999993
},
{
"name": "G4",
"midi": 67,
"time": 25.66664099999999,
"velocity": 0.7716535433070866,
"duration": 0.33333299999999966
},
{
"name": "E5",
"midi": 76,
"time": 25.99997399999999,
"velocity": 0.905511811023622,
"duration": 0.999998999999999
},
{
"name": "C3",
"midi": 48,
"time": 25.99997399999999,
"velocity": 0.6929133858267716,
"duration": 0.6666659999999993
},
{
"name": "G3",
"midi": 55,
"time": 26.66663999999999,
"velocity": 0.9448818897637795,
"duration": 0.6666659999999993
},
{
"name": "C4",
"midi": 60,
"time": 26.66663999999999,
"velocity": 0.9448818897637795,
"duration": 0.6666659999999993
},
{
"name": "D5",
"midi": 74,
"time": 26.99997299999999,
"velocity": 0.7401574803149606,
"duration": 0.33333299999999966
},
{
"name": "C5",
"midi": 72,
"time": 27.33330599999999,
"velocity": 0.7244094488188977,
"duration": 0.6666659999999993
},
{
"name": "A3",
"midi": 57,
"time": 27.33330599999999,
"velocity": 0.7637795275590551,
"duration": 0.6666659999999993
},
{
"name": "G4",
"midi": 67,
"time": 27.99997199999999,
"velocity": 0.7559055118110236,
"duration": 1.3333319999999986
},
{
"name": "B4",
"midi": 71,
"time": 27.99997199999999,
"velocity": 0.7559055118110236,
"duration": 1.3333319999999986
},
{
"name": "G3",
"midi": 55,
"time": 27.99997199999999,
"velocity": 0.7716535433070866,
"duration": 0.6666659999999993
},
{
"name": "B3",
"midi": 59,
"time": 28.66663799999999,
"velocity": 0.9291338582677166,
"duration": 0.6666659999999993
},
{
"name": "D4",
"midi": 62,
"time": 28.66663799999999,
"velocity": 0.9291338582677166,
"duration": 0.6666659999999993
},
{
"name": "F4",
"midi": 65,
"time": 29.333303999999988,
"velocity": 0.7165354330708661,
"duration": 0.33333299999999966
},
{
"name": "A4",
"midi": 69,
"time": 29.333303999999988,
"velocity": 0.7165354330708661,
"duration": 0.33333299999999966
},
{
"name": "B3",
"midi": 59,
"time": 29.333303999999988,
"velocity": 0.7559055118110236,
"duration": 0.6666659999999993
},
{
"name": "D4",
"midi": 62,
"time": 29.333303999999988,
"velocity": 0.7559055118110236,
"duration": 0.6666659999999993
},
{
"name": "B4",
"midi": 71,
"time": 29.666636999999987,
"velocity": 0.8503937007874016,
"duration": 0.33333299999999966
},
{
"name": "E4",
"midi": 64,
"time": 29.999969999999987,
"velocity": 0.7874015748031497,
"duration": 0.6666659999999993
},
{
"name": "C5",
"midi": 72,
"time": 29.999969999999987,
"velocity": 0.7874015748031497,
"duration": 0.6666659999999993
},
{
"name": "C3",
"midi": 48,
"time": 29.999969999999987,
"velocity": 0.6535433070866141,
"duration": 0.6666659999999993
},
{
"name": "E4",
"midi": 64,
"time": 30.666635999999986,
"velocity": 0.7716535433070866,
"duration": 0.6666659999999993
},
{
"name": "C5",
"midi": 72,
"time": 30.666635999999986,
"velocity": 0.7716535433070866,
"duration": 0.6666659999999993
},
{
"name": "G3",
"midi": 55,
"time": 30.666635999999986,
"velocity": 0.9921259842519685,
"duration": 0.6666659999999993
},
{
"name": "C4",
"midi": 60,
"time": 30.666635999999986,
"velocity": 0.9921259842519685,
"duration": 0.6666659999999993
},
{
"name": "E4",
"midi": 64,
"time": 31.333301999999986,
"velocity": 0.6850393700787402,
"duration": 0.6666659999999993
},
{
"name": "G4",
"midi": 67,
"time": 31.333301999999986,
"velocity": 0.6850393700787402,
"duration": 0.6666659999999993
},
{
"name": "G3",
"midi": 55,
"time": 31.333301999999986,
"velocity": 0.7559055118110236,
"duration": 0.6666659999999993
},
{
"name": "E4",
"midi": 64,
"time": 31.999967999999985,
"velocity": 0.6771653543307087,
"duration": 0.6666660000000029
},
{
"name": "E3",
"midi": 52,
"time": 31.999967999999985,
"velocity": 0.7244094488188977,
"duration": 0.6666660000000029
},
{
"name": "C4",
"midi": 60,
"time": 32.66663399999999,
"velocity": 0.6614173228346457,
"duration": 0.6666659999999993
},
{
"name": "C3",
"midi": 48,
"time": 32.66663399999999,
"velocity": 0.7086614173228346,
"duration": 0.6666659999999993
},
{
"name": "E5",
"midi": 76,
"time": 33.33329999999999,
"velocity": 0.5748031496062992,
"duration": 0.3333330000000032
},
{
"name": "E5",
"midi": 76,
"time": 33.66663299999999,
"velocity": 0.5354330708661418,
"duration": 0.3333330000000032
},
{
"name": "E5",
"midi": 76,
"time": 33.99996599999999,
"velocity": 0.48031496062992124,
"duration": 0.6666659999999993
},
{
"name": "C4",
"midi": 60,
"time": 33.99996599999999,
"velocity": 0.4566929133858268,
"duration": 0.6666659999999993
},
{
"name": "F5",
"midi": 77,
"time": 34.66663199999999,
"velocity": 0.4881889763779528,
"duration": 0.6666659999999993
},
{
"name": "E4",
"midi": 64,
"time": 34.66663199999999,
"velocity": 0.5511811023622047,
"duration": 0.6666659999999993
},
{
"name": "G4",
"midi": 67,
"time": 34.66663199999999,
"velocity": 0.5511811023622047,
"duration": 0.6666659999999993
},
{
"name": "G5",
"midi": 79,
"time": 35.33329799999999,
"velocity": 0.5354330708661418,
"duration": 0.6666659999999993
},
{
"name": "E4",
"midi": 64,
"time": 35.33329799999999,
"velocity": 0.4566929133858268,
"duration": 0.6666659999999993
},
{
"name": "G4",
"midi": 67,
"time": 35.33329799999999,
"velocity": 0.4566929133858268,
"duration": 0.6666659999999993
},
{
"name": "G5",
"midi": 79,
"time": 35.99996399999999,
"velocity": 0.49606299212598426,
"duration": 1.3333319999999986
},
{
"name": "C4",
"midi": 60,
"time": 35.99996399999999,
"velocity": 0.3937007874015748,
"duration": 0.6666659999999993
},
{
"name": "E4",
"midi": 64,
"time": 36.66662999999999,
"velocity": 0.5511811023622047,
"duration": 0.6666659999999993
},
{
"name": "G4",
"midi": 67,
"time": 36.66662999999999,
"velocity": 0.5511811023622047,
"duration": 0.6666659999999993
},
{
"name": "F5",
"midi": 77,
"time": 37.33329599999999,
"velocity": 0.4566929133858268,
"duration": 0.3333330000000032
},
{
"name": "E4",
"midi": 64,
"time": 37.33329599999999,
"velocity": 0.5196850393700787,
"duration": 0.6666660000000064
},
{
"name": "G4",
"midi": 67,
"time": 37.33329599999999,
"velocity": 0.5196850393700787,
"duration": 0.6666660000000064
},
{
"name": "E5",
"midi": 76,
"time": 37.66662899999999,
"velocity": 0.44881889763779526,
"duration": 0.3333330000000032
},
{
"name": "D5",
"midi": 74,
"time": 37.999962,
"velocity": 0.4566929133858268,
"duration": 0.6666659999999993
},
{
"name": "B3",
"midi": 59,
"time": 37.999962,
"velocity": 0.3937007874015748,
"duration": 0.6666659999999993
},
{
"name": "E5",
"midi": 76,
"time": 38.666627999999996,
"velocity": 0.5118110236220472,
"duration": 0.6666659999999993
},
{
"name": "D4",
"midi": 62,
"time": 38.666627999999996,
"velocity": 0.5354330708661418,
"duration": 0.6666659999999993
},
{
"name": "G4",
"midi": 67,
"time": 38.666627999999996,
"velocity": 0.5354330708661418,
"duration": 0.6666659999999993
},
{
"name": "F5",
"midi": 77,
"time": 39.333293999999995,
"velocity": 0.5275590551181102,
"duration": 0.6666659999999993
},
{
"name": "D4",
"midi": 62,
"time": 39.333293999999995,
"velocity": 0.5039370078740157,
"duration": 0.6666659999999993
},
{
"name": "G4",
"midi": 67,
"time": 39.333293999999995,
"velocity": 0.5039370078740157,
"duration": 0.6666659999999993
},
{
"name": "F5",
"midi": 77,
"time": 39.999959999999994,
"velocity": 0.48031496062992124,
"duration": 1.3333319999999986
},
{
"name": "B3",
"midi": 59,
"time": 39.999959999999994,
"velocity": 0.41732283464566927,
"duration": 0.6666659999999993
},
{
"name": "D4",
"midi": 62,
"time": 40.666625999999994,
"velocity": 0.5511811023622047,
"duration": 0.6666659999999993
},
{
"name": "G4",
"midi": 67,
"time": 40.666625999999994,
"velocity": 0.5511811023622047,
"duration": 0.6666659999999993
},
{
"name": "F5",
"midi": 77,
"time": 41.33329199999999,
"velocity": 0.47244094488188976,
"duration": 0.6666659999999993
},
{
"name": "D4",
"midi": 62,
"time": 41.33329199999999,
"velocity": 0.5118110236220472,
"duration": 0.6666659999999993
},
{
"name": "G4",
"midi": 67,
"time": 41.33329199999999,
"velocity": 0.5118110236220472,
"duration": 0.6666659999999993
},
{
"name": "E5",
"midi": 76,
"time": 41.99995799999999,
"velocity": 0.4251968503937008,
"duration": 0.9999990000000025
},
{
"name": "C3",
"midi": 48,
"time": 41.99995799999999,
"velocity": 0.44881889763779526,
"duration": 0.6666659999999993
},
{
"name": "C4",
"midi": 60,
"time": 42.66662399999999,
"velocity": 0.5984251968503937,
"duration": 0.6666660000000064
},
{
"name": "D5",
"midi": 74,
"time": 42.999956999999995,
"velocity": 0.4409448818897638,
"duration": 0.3333330000000032
},
{
"name": "C5",
"midi": 72,
"time": 43.33329,
"velocity": 0.4566929133858268,
"duration": 0.6666659999999993
},
{
"name": "A3",
"midi": 57,
"time": 43.33329,
"velocity": 0.49606299212598426,
"duration": 0.6666659999999993
},
{
"name": "G4",
"midi": 67,
"time": 43.999956,
"velocity": 0.4330708661417323,
"duration": 1.3333319999999986
},
{
"name": "B4",
"midi": 71,
"time": 43.999956,
"velocity": 0.4330708661417323,
"duration": 1.3333319999999986
},
{
"name": "G3",
"midi": 55,
"time": 43.999956,
"velocity": 0.4881889763779528,
"duration": 0.6666659999999993
},
{
"name": "F3",
"midi": 53,
"time": 44.666622,
"velocity": 0.4881889763779528,
"duration": 0.6666659999999993
},
{
"name": "F4",
"midi": 65,
"time": 45.333287999999996,
"velocity": 0.48031496062992124,
"duration": 0.49999950000000126
},
{
"name": "A4",
"midi": 69,
"time": 45.333287999999996,
"velocity": 0.48031496062992124,
"duration": 0.49999950000000126
},
{
"name": "D3",
"midi": 50,
"time": 45.333287999999996,
"velocity": 0.5196850393700787,
"duration": 0.6666659999999993
},
{
"name": "B4",
"midi": 71,
"time": 45.8332875,
"velocity": 0.6141732283464567,
"duration": 0.16666649999999805
},
{
"name": "E4",
"midi": 64,
"time": 45.999953999999995,
"velocity": 0.6220472440944882,
"duration": 0.6666659999999993
},
{
"name": "C5",
"midi": 72,
"time": 45.999953999999995,
"velocity": 0.6220472440944882,
"duration": 0.6666659999999993
},
{
"name": "C3",
"midi": 48,
"time": 45.999953999999995,
"velocity": 0.5826771653543307,
"duration": 0.6666659999999993
},
{
"name": "E4",
"midi": 64,
"time": 46.666619999999995,
"velocity": 0.5039370078740157,
"duration": 0.6666659999999993
},
{
"name": "G3",
"midi": 55,
"time": 46.666619999999995,
"velocity": 0.6771653543307087,
"duration": 0.6666659999999993
},
{
"name": "F#4",
"midi": 66,
"time": 47.333285999999994,
"velocity": 0.6220472440944882,
"duration": 0.6666659999999993
},
{
"name": "A3",
"midi": 57,
"time": 47.333285999999994,
"velocity": 0.6929133858267716,
"duration": 0.6666659999999993
},
{
"name": "B3",
"midi": 59,
"time": 47.99995199999999,
"velocity": 0.6929133858267716,
"duration": 1.3333319999999986
},
{
"name": "D4",
"midi": 62,
"time": 47.99995199999999,
"velocity": 0.6929133858267716,
"duration": 1.3333319999999986
},
{
"name": "G4",
"midi": 67,
"time": 47.99995199999999,
"velocity": 0.6929133858267716,
"duration": 1.3333319999999986
},
{
"name": "G3",
"midi": 55,
"time": 47.99995199999999,
"velocity": 0.6614173228346457,
"duration": 0.6666659999999993
},
{
"name": "D3",
"midi": 50,
"time": 48.66661799999999,
"velocity": 0.6771653543307087,
"duration": 0.6666659999999993
},
{
"name": "G4",
"midi": 67,
"time": 49.33328399999999,
"velocity": 0.7637795275590551,
"duration": 0.6666659999999993
},
{
"name": "G3",
"midi": 55,
"time": 49.33328399999999,
"velocity": 0.84251968503937,
"duration": 0.6666659999999993
},
{
"name": "B3",
"midi": 59,
"time": 49.33328399999999,
"velocity": 0.84251968503937,
"duration": 0.6666659999999993
},
{
"name": "E4",
"midi": 64,
"time": 49.99994999999999,
"velocity": 0.8740157480314961,
"duration": 0.6666659999999993
},
{
"name": "C5",
"midi": 72,
"time": 49.99994999999999,
"velocity": 0.8740157480314961,
"duration": 0.6666659999999993
},
{
"name": "C4",
"midi": 60,
"time": 49.99994999999999,
"velocity": 0.8031496062992126,
"duration": 0.6666659999999993
},
{
"name": "E4",
"midi": 64,
"time": 50.66661599999999,
"velocity": 0.7716535433070866,
"duration": 0.6666659999999993
},
{
"name": "C5",
"midi": 72,
"time": 50.66661599999999,
"velocity": 0.7716535433070866,
"duration": 0.6666659999999993
},
{
"name": "E3",
"midi": 52,
"time": 50.66661599999999,
"velocity": 0.6929133858267716,
"duration": 0.6666659999999993
},
{
"name": "C5",
"midi": 72,
"time": 51.33328199999999,
"velocity": 0.7795275590551181,
"duration": 0.3333330000000032
},
{
"name": "G3",
"midi": 55,
"time": 51.33328199999999,
"velocity": 0.7874015748031497,
"duration": 0.6666660000000064
},
{
"name": "B4",
"midi": 71,
"time": 51.66661499999999,
"velocity": 0.7322834645669292,
"duration": 0.3333330000000032
},
{
"name": "F4",
"midi": 65,
"time": 51.999947999999996,
"velocity": 0.7559055118110236,
"duration": 0.6666659999999993
},
{
"name": "A4",
"midi": 69,
"time": 51.999947999999996,
"velocity": 0.7559055118110236,
"duration": 0.6666659999999993
},
{
"name": "A3",
"midi": 57,
"time": 51.999947999999996,
"velocity": 0.7637795275590551,
"duration": 0.6666659999999993
},
{
"name": "F4",
"midi": 65,
"time": 52.666613999999996,
"velocity": 0.7874015748031497,
"duration": 0.6666659999999993
},
{
"name": "A4",
"midi": 69,
"time": 52.666613999999996,
"velocity": 0.7874015748031497,
"duration": 0.6666659999999993
},
{
"name": "D3",
"midi": 50,
"time": 52.666613999999996,
"velocity": 0.7322834645669292,
"duration": 0.6666659999999993
},
{
"name": "F4",
"midi": 65,
"time": 53.333279999999995,
"velocity": 0.7952755905511811,
"duration": 0.6666659999999993
},
{
"name": "A4",
"midi": 69,
"time": 53.333279999999995,
"velocity": 0.7952755905511811,
"duration": 0.6666659999999993
},
{
"name": "F3",
"midi": 53,
"time": 53.333279999999995,
"velocity": 0.8110236220472441,
"duration": 0.6666659999999993
},
{
"name": "F4",
"midi": 65,
"time": 53.999945999999994,
"velocity": 0.8346456692913385,
"duration": 0.6666659999999993
},
{
"name": "A4",
"midi": 69,
"time": 53.999945999999994,
"velocity": 0.8346456692913385,
"duration": 0.6666659999999993
},
{
"name": "D5",
"midi": 74,
"time": 53.999945999999994,
"velocity": 0.8346456692913385,
"duration": 0.6666659999999993
},
{
"name": "A3",
"midi": 57,
"time": 53.999945999999994,
"velocity": 0.7637795275590551,
"duration": 0.6666659999999993
},
{
"name": "A4",
"midi": 69,
"time": 54.66661199999999,
"velocity": 0.8503937007874016,
"duration": 0.3333330000000032
},
{
"name": "D5",
"midi": 74,
"time": 54.66661199999999,
"velocity": 0.8503937007874016,
"duration": 0.3333330000000032
},
{
"name": "F5",
"midi": 77,
"time": 54.66661199999999,
"velocity": 0.8503937007874016,
"duration": 0.3333330000000032
},
{
"name": "D3",
"midi": 50,
"time": 54.66661199999999,
"velocity": 0.7401574803149606,
"duration": 0.6666660000000064
},
{
"name": "E5",
"midi": 76,
"time": 54.999945,
"velocity": 0.7637795275590551,
"duration": 0.3333330000000032
},
{
"name": "A4",
"midi": 69,
"time": 55.333278,
"velocity": 0.7322834645669292,
"duration": 0.3333330000000032
},
{
"name": "D5",
"midi": 74,
"time": 55.333278,
"velocity": 0.7322834645669292,
"duration": 0.3333330000000032
},
{
"name": "F3",
"midi": 53,
"time": 55.333278,
"velocity": 0.7952755905511811,
"duration": 0.6666660000000064
},
{
"name": "C5",
"midi": 72,
"time": 55.666611,
"velocity": 0.7480314960629921,
"duration": 0.3333330000000032
},
{
"name": "C5",
"midi": 72,
"time": 55.999944000000006,
"velocity": 0.7874015748031497,
"duration": 0.6666659999999993
},
{
"name": "G3",
"midi": 55,
"time": 55.999944000000006,
"velocity": 0.8346456692913385,
"duration": 0.6666659999999993
},
{
"name": "B4",
"midi": 71,
"time": 56.666610000000006,
"velocity": 0.7007874015748031,
"duration": 0.6666659999999993
},
{
"name": "B3",
"midi": 59,
"time": 56.666610000000006,
"velocity": 0.8976377952755905,
"duration": 0.6666659999999993
},
{
"name": "D4",
"midi": 62,
"time": 56.666610000000006,
"velocity": 0.8976377952755905,
"duration": 0.6666659999999993
},
{
"name": "G4",
"midi": 67,
"time": 57.333276000000005,
"velocity": 0.6377952755905512,
"duration": 0.3333330000000032
},
{
"name": "B3",
"midi": 59,
"time": 57.333276000000005,
"velocity": 0.8031496062992126,
"duration": 0.6666660000000064
},
{
"name": "D4",
"midi": 62,
"time": 57.333276000000005,
"velocity": 0.8031496062992126,
"duration": 0.6666660000000064
},
{
"name": "G4",
"midi": 67,
"time": 57.66660900000001,
"velocity": 0.7559055118110236,
"duration": 0.3333330000000032
},
{
"name": "E4",
"midi": 64,
"time": 57.99994200000001,
"velocity": 0.8818897637795275,
"duration": 0.9999990000000025
},
{
"name": "G4",
"midi": 67,
"time": 57.99994200000001,
"velocity": 0.8818897637795275,
"duration": 0.9999990000000025
},
{
"name": "C5",
"midi": 72,
"time": 57.99994200000001,
"velocity": 0.8818897637795275,
"duration": 0.9999990000000025
},
{
"name": "C4",
"midi": 60,
"time": 57.99994200000001,
"velocity": 0.7637795275590551,
"duration": 0.6666659999999993
},
{
"name": "B3",
"midi": 59,
"time": 58.66660800000001,
"velocity": 0.7244094488188977,
"duration": 0.6666660000000064
},
{
"name": "D5",
"midi": 74,
"time": 58.999941000000014,
"velocity": 0.8110236220472441,
"duration": 0.3333330000000032
},
{
"name": "G4",
"midi": 67,
"time": 59.33327400000002,
"velocity": 0.7874015748031497,
"duration": 0.3333330000000032
},
{
"name": "C5",
"midi": 72,
"time": 59.33327400000002,
"velocity": 0.7874015748031497,
"duration": 0.3333330000000032
},
{
"name": "E5",
"midi": 76,
"time": 59.33327400000002,
"velocity": 0.7874015748031497,
"duration": 0.3333330000000032
},
{
"name": "A3",
"midi": 57,
"time": 59.33327400000002,
"velocity": 0.7480314960629921,
"duration": 0.6666660000000064
},
{
"name": "F5",
"midi": 77,
"time": 59.66660700000002,
"velocity": 0.7952755905511811,
"duration": 0.3333330000000032
},
{
"name": "C5",
"midi": 72,
"time": 59.999940000000024,
"velocity": 0.8188976377952756,
"duration": 1.3333319999999986
},
{
"name": "E5",
"midi": 76,
"time": 59.999940000000024,
"velocity": 0.8188976377952756,
"duration": 1.3333319999999986
},
{
"name": "G5",
"midi": 79,
"time": 59.999940000000024,
"velocity": 0.8188976377952756,
"duration": 1.3333319999999986
},
{
"name": "G3",
"midi": 55,
"time": 59.999940000000024,
"velocity": 0.7637795275590551,
"duration": 0.6666659999999993
},
{
"name": "C4",
"midi": 60,
"time": 60.66660600000002,
"velocity": 0.9133858267716536,
"duration": 0.6666659999999993
},
{
"name": "E4",
"midi": 64,
"time": 60.66660600000002,
"velocity": 0.9133858267716536,
"duration": 0.6666659999999993
},
{
"name": "E4",
"midi": 64,
"time": 61.33327200000002,
"velocity": 0.6456692913385826,
"duration": 0.3333330000000032
},
{
"name": "A4",
"midi": 69,
"time": 61.33327200000002,
"velocity": 0.6456692913385826,
"duration": 0.3333330000000032
},
{
"name": "C5",
"midi": 72,
"time": 61.33327200000002,
"velocity": 0.6456692913385826,
"duration": 0.3333330000000032
},
{
"name": "A3",
"midi": 57,
"time": 61.33327200000002,
"velocity": 0.7165354330708661,
"duration": 0.6666660000000064
},
{
"name": "C4",
"midi": 60,
"time": 61.33327200000002,
"velocity": 0.7165354330708661,
"duration": 0.6666660000000064
},
{
"name": "D5",
"midi": 74,
"time": 61.666605000000025,
"velocity": 0.8267716535433071,
"duration": 0.3333330000000032
},
{
"name": "G4",
"midi": 67,
"time": 61.99993800000003,
"velocity": 0.8503937007874016,
"duration": 0.9999990000000025
},
{
"name": "C5",
"midi": 72,
"time": 61.99993800000003,
"velocity": 0.8503937007874016,
"duration": 0.9999990000000025
},
{
"name": "E5",
"midi": 76,
"time": 61.99993800000003,
"velocity": 0.8503937007874016,
"duration": 0.9999990000000025
},
{
"name": "G3",
"midi": 55,
"time": 61.99993800000003,
"velocity": 0.7480314960629921,
"duration": 0.6666659999999993
},
{
"name": "C4",
"midi": 60,
"time": 61.99993800000003,
"velocity": 0.7480314960629921,
"duration": 0.6666659999999993
},
{
"name": "C4",
"midi": 60,
"time": 62.66660400000003,
"velocity": 0.905511811023622,
"duration": 0.6666660000000064
},
{
"name": "E4",
"midi": 64,
"time": 62.66660400000003,
"velocity": 0.905511811023622,
"duration": 0.6666660000000064
},
{
"name": "F5",
"midi": 77,
"time": 62.99993700000003,
"velocity": 0.8188976377952756,
"duration": 0.3333330000000032
},
{
"name": "F4",
"midi": 65,
"time": 63.333270000000034,
"velocity": 0.7086614173228346,
"duration": 0.6666659999999993
},
{
"name": "D5",
"midi": 74,
"time": 63.333270000000034,
"velocity": 0.7086614173228346,
"duration": 0.6666659999999993
},
{
"name": "G3",
"midi": 55,
"time": 63.333270000000034,
"velocity": 0.7244094488188977,
"duration": 0.6666659999999993
},
{
"name": "E4",
"midi": 64,
"time": 63.999936000000034,
"velocity": 0.7007874015748031,
"duration": 1.9999980000000193
},
{
"name": "G4",
"midi": 67,
"time": 63.999936000000034,
"velocity": 0.7007874015748031,
"duration": 1.9999980000000193
},
{
"name": "C5",
"midi": 72,
"time": 63.999936000000034,
"velocity": 0.7007874015748031,
"duration": 1.9999980000000193
},
{
"name": "C4",
"midi": 60,
"time": 63.999936000000034,
"velocity": 0.84251968503937,
"duration": 0.6666660000000064
},
{
"name": "C3",
"midi": 48,
"time": 64.66660200000004,
"velocity": 0.6535433070866141,
"duration": 0.6666660000000064
}
];
var midiOnly = [];
notes.forEach(function(item) {
//get value of name
var val = item.midi;
//push duration value into array
midiOnly.push(val);
});
//console.log(midiOnly);
minimalNotes1 = [];
minimalNotes2 = [];
minimalNotes3 = [];
minimalNotesFinal = [];
minimalNotes1 = notes.filter(function (el){
return el.name == "E4";
});
var minimalNotes1Final = minimalNotes1.map(function(el){
var addKey = Object.assign({}, el);
addKey.lane = 0;
return addKey;
});
//////////////////////////////////////////////////////////
minimalNotes2 = notes.filter(function (el){
return el.name == "C4"
});
var minimalNotes2Final = minimalNotes2.map(function(el){
var addKey = Object.assign({}, el);
addKey.lane = 1;
return addKey;
});
///////////////////////////////////////////
minimalNotes3 = notes.filter(function (el) {
return el.name == "A3"
});
var minimalNotes3Final = minimalNotes3.map(function(el){
var addKey = Object.assign({}, el);
addKey.lane = 2;
return addKey;
});
////////////////////////////////////////////////
minimalNotesFinal = minimalNotes1Final.concat(minimalNotes2Final, minimalNotes3Final);
console.log(minimalNotesFinal);
/*var midiValue = [];
minimalNotesFinal.forEach(function(item){
var midiValueFinal = item.midi;
midiValue.push(midiValueFinal);
});
console.log(midiValue);*/
//console.log(JSON.stringify(minimalNotes, null, ''));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment