@sebastbake/music-tempo
Version:
Finding out tempo of the music
1,289 lines • 1.52 MB
JSON
{
"type": "File",
"start": 0,
"end": 9388,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 220,
"column": 1
}
},
"program": {
"type": "Program",
"start": 0,
"end": 9388,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 220,
"column": 1
}
},
"sourceType": "module",
"body": [
{
"type": "ExportDefaultDeclaration",
"start": 111,
"end": 9388,
"loc": {
"start": {
"line": 5,
"column": 0
},
"end": {
"line": 220,
"column": 1
}
},
"declaration": {
"type": "ClassDeclaration",
"start": 126,
"end": 9388,
"loc": {
"start": {
"line": 5,
"column": 15
},
"end": {
"line": 220,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 132,
"end": 146,
"loc": {
"start": {
"line": 5,
"column": 21
},
"end": {
"line": 5,
"column": 35
},
"identifierName": "TempoInduction"
},
"name": "TempoInduction",
"leadingComments": null
},
"superClass": null,
"body": {
"type": "ClassBody",
"start": 147,
"end": 9388,
"loc": {
"start": {
"line": 5,
"column": 36
},
"end": {
"line": 220,
"column": 1
}
},
"body": [
{
"type": "ClassMethod",
"start": 697,
"end": 2500,
"loc": {
"start": {
"line": 15,
"column": 4
},
"end": {
"line": 62,
"column": 5
}
},
"computed": false,
"key": {
"type": "Identifier",
"start": 704,
"end": 725,
"loc": {
"start": {
"line": 15,
"column": 11
},
"end": {
"line": 15,
"column": 32
},
"identifierName": "processRhythmicEvents"
},
"name": "processRhythmicEvents"
},
"static": true,
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 726,
"end": 732,
"loc": {
"start": {
"line": 15,
"column": 33
},
"end": {
"line": 15,
"column": 39
},
"identifierName": "events"
},
"name": "events"
},
{
"type": "AssignmentPattern",
"start": 734,
"end": 745,
"loc": {
"start": {
"line": 15,
"column": 41
},
"end": {
"line": 15,
"column": 52
}
},
"left": {
"type": "Identifier",
"start": 734,
"end": 740,
"loc": {
"start": {
"line": 15,
"column": 41
},
"end": {
"line": 15,
"column": 47
},
"identifierName": "params"
},
"name": "params"
},
"right": {
"type": "ObjectExpression",
"start": 743,
"end": 745,
"loc": {
"start": {
"line": 15,
"column": 50
},
"end": {
"line": 15,
"column": 52
}
},
"properties": []
}
}
],
"body": {
"type": "BlockStatement",
"start": 747,
"end": 2500,
"loc": {
"start": {
"line": 15,
"column": 54
},
"end": {
"line": 62,
"column": 5
}
},
"body": [
{
"type": "VariableDeclaration",
"start": 758,
"end": 942,
"loc": {
"start": {
"line": 16,
"column": 8
},
"end": {
"line": 19,
"column": 37
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 764,
"end": 809,
"loc": {
"start": {
"line": 16,
"column": 14
},
"end": {
"line": 16,
"column": 59
}
},
"id": {
"type": "Identifier",
"start": 764,
"end": 777,
"loc": {
"start": {
"line": 16,
"column": 14
},
"end": {
"line": 16,
"column": 27
},
"identifierName": "widthTreshold"
},
"name": "widthTreshold"
},
"init": {
"type": "LogicalExpression",
"start": 780,
"end": 809,
"loc": {
"start": {
"line": 16,
"column": 30
},
"end": {
"line": 16,
"column": 59
}
},
"left": {
"type": "MemberExpression",
"start": 780,
"end": 800,
"loc": {
"start": {
"line": 16,
"column": 30
},
"end": {
"line": 16,
"column": 50
}
},
"object": {
"type": "Identifier",
"start": 780,
"end": 786,
"loc": {
"start": {
"line": 16,
"column": 30
},
"end": {
"line": 16,
"column": 36
},
"identifierName": "params"
},
"name": "params"
},
"property": {
"type": "Identifier",
"start": 787,
"end": 800,
"loc": {
"start": {
"line": 16,
"column": 37
},
"end": {
"line": 16,
"column": 50
},
"identifierName": "widthTreshold"
},
"name": "widthTreshold"
},
"computed": false
},
"operator": "||",
"right": {
"type": "NumericLiteral",
"start": 804,
"end": 809,
"loc": {
"start": {
"line": 16,
"column": 54
},
"end": {
"line": 16,
"column": 59
}
},
"extra": {
"rawValue": 0.025,
"raw": "0.025"
},
"value": 0.025
}
}
},
{
"type": "VariableDeclarator",
"start": 826,
"end": 855,
"loc": {
"start": {
"line": 17,
"column": 14
},
"end": {
"line": 17,
"column": 43
}
},
"id": {
"type": "Identifier",
"start": 826,
"end": 832,
"loc": {
"start": {
"line": 17,
"column": 14
},
"end": {
"line": 17,
"column": 20
},
"identifierName": "maxIOI"
},
"name": "maxIOI"
},
"init": {
"type": "LogicalExpression",
"start": 835,
"end": 855,
"loc": {
"start": {
"line": 17,
"column": 23
},
"end": {
"line": 17,
"column": 43
}
},
"left": {
"type": "MemberExpression",
"start": 835,
"end": 848,
"loc": {
"start": {
"line": 17,
"column": 23
},
"end": {
"line": 17,
"column": 36
}
},
"object": {
"type": "Identifier",
"start": 835,
"end": 841,
"loc": {
"start": {
"line": 17,
"column": 23
},
"end": {
"line": 17,
"column": 29
},
"identifierName": "params"
},
"name": "params"
},
"property": {
"type": "Identifier",
"start": 842,
"end": 848,
"loc": {
"start": {
"line": 17,
"column": 30
},
"end": {
"line": 17,
"column": 36
},
"identifierName": "maxIOI"
},
"name": "maxIOI"
},
"computed": false
},
"operator": "||",
"right": {
"type": "NumericLiteral",
"start": 852,
"end": 855,
"loc": {
"start": {
"line": 17,
"column": 40
},
"end": {
"line": 17,
"column": 43
}
},
"extra": {
"rawValue": 2.5,
"raw": "2.5"
},
"value": 2.5
}
}
},
{
"type": "VariableDeclarator",
"start": 872,
"end": 902,
"loc": {
"start": {
"line": 18,
"column": 14
},
"end": {
"line": 18,
"column": 44
}
},
"id": {
"type": "Identifier",
"start": 872,
"end": 878,
"loc": {
"start": {
"line": 18,
"column": 14
},
"end": {
"line": 18,
"column": 20
},
"identifierName": "minIOI"
},
"name": "minIOI"
},
"init": {
"type": "LogicalExpression",
"start": 881,
"end": 902,
"loc": {
"start": {
"line": 18,
"column": 23
},
"end": {
"line": 18,
"column": 44
}
},
"left": {
"type": "MemberExpression",
"start": 881,
"end": 894,
"loc": {
"start": {
"line": 18,
"column": 23
},
"end": {
"line": 18,
"column": 36
}
},
"object": {
"type": "Identifier",
"start": 881,
"end": 887,
"loc": {
"start": {
"line": 18,
"column": 23
},
"end": {
"line": 18,
"column": 29
},
"identifierName": "params"
},
"name": "params"
},
"property": {
"type": "Identifier",
"start": 888,
"end": 894,
"loc": {
"start": {
"line": 18,
"column": 30
},
"end": {
"line": 18,
"column": 36
},
"identifierName": "minIOI"
},
"name": "minIOI"
},
"computed": false
},
"operator": "||",
"right": {
"type": "NumericLiteral",
"start": 898,
"end": 902,
"loc": {
"start": {
"line": 18,
"column": 40
},
"end": {
"line": 18,
"column": 44
}
},
"extra": {
"rawValue": 0.07,
"raw": "0.07"
},
"value": 0.07
}
}
},
{
"type": "VariableDeclarator",
"start": 919,
"end": 941,
"loc": {
"start": {
"line": 19,
"column": 14
},
"end": {
"line": 19,
"column": 36
}
},
"id": {
"type": "Identifier",
"start": 919,
"end": 925,
"loc": {
"start": {
"line": 19,
"column": 14
},
"end": {
"line": 19,
"column": 20
},
"identifierName": "length"
},
"name": "length"
},
"init": {
"type": "MemberExpression",
"start": 928,
"end": 941,
"loc": {
"start": {
"line": 19,
"column": 23
},
"end": {
"line": 19,
"column": 36
}
},
"object": {
"type": "Identifier",
"start": 928,
"end": 934,
"loc": {
"start": {
"line": 19,
"column": 23
},
"end": {
"line": 19,
"column": 29
},
"identifierName": "events"
},
"name": "events"
},
"property": {
"type": "Identifier",
"start": 935,
"end": 941,
"loc": {
"start": {
"line": 19,
"column": 30
},
"end": {
"line": 19,
"column": 36
},
"identifierName": "length"
},
"name": "length"
},
"computed": false
}
}
],
"kind": "const"
},
{
"type": "VariableDeclaration",
"start": 954,
"end": 1028,
"loc": {
"start": {
"line": 21,
"column": 8
},
"end": {
"line": 23,
"column": 24
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 958,
"end": 974,
"loc": {
"start": {
"line": 21,
"column": 12
},
"end": {
"line": 21,
"column": 28
}
},
"id": {
"type": "Identifier",
"start": 958,
"end": 969,
"loc": {
"start": {
"line": 21,
"column": 12
},
"end": {
"line": 21,
"column": 23
},
"identifierName": "clIntervals"
},
"name": "clIntervals"
},
"init": {
"type": "ArrayExpression",
"start": 972,
"end": 974,
"loc": {
"start": {
"line": 21,
"column": 26
},
"end": {
"line": 21,
"column": 28
}
},
"elements": []
}
},
{
"type": "VariableDeclarator",
"start": 989,
"end": 1001,
"loc": {
"start": {
"line": 22,
"column": 12
},
"end": {
"line": 22,
"column": 24
}
},
"id": {
"type": "Identifier",
"start": 989,
"end": 996,
"loc": {
"start": {
"line": 22,
"column": 12
},
"end": {
"line": 22,
"column": 19
},
"identifierName": "clSizes"
},
"name": "clSizes"
},
"init": {
"type": "ArrayExpression",
"start": 999,
"end": 1001,
"loc": {
"start": {
"line": 22,
"column": 22
},
"end": {
"line": 22,
"column": 24
}
},
"elements": []
}
},
{
"type": "VariableDeclarator",
"start": 1016,
"end": 1027,
"loc": {
"start": {
"line": 23,
"column": 12
},
"end": {
"line": 23,
"column": 23
}
},
"id": {
"type": "Identifier",
"start": 1016,
"end": 1023,
"loc": {
"start": {
"line": 23,
"column": 12
},
"end": {
"line": 23,
"column": 19
},
"identifierName": "clCount"
},
"name": "clCount"
},
"init": {
"type": "NumericLiteral",
"start": 1026,
"end": 1027,
"loc": {
"start": {
"line": 23,
"column": 22
},
"end": {
"line": 23,
"column": 23
}
},
"extra": {
"rawValue": 0,
"raw": "0"
},
"value": 0
}
}
],
"kind": "let"
},
{
"type": "ForStatement",
"start": 1040,
"end": 2301,
"loc": {
"start": {
"line": 25,
"column": 8
},
"end": {
"line": 55,
"column": 9
}
},
"init": {
"type": "VariableDeclaration",
"start": 1045,
"end": 1054,
"loc": {
"start": {
"line": 25,
"column": 13
},
"end": {
"line": 25,
"column": 22
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 1049,
"end": 1054,
"loc": {
"start": {
"line": 25,
"column": 17
},
"end": {
"line": 25,
"column": 22
}
},
"id": {
"type": "Identifier",
"start": 1049,
"end": 1050,
"loc": {
"start": {
"line": 25,
"column": 17
},
"end": {
"line": 25,
"column": 18
},
"identifierName": "i"
},
"name": "i"
},
"init": {
"type": "NumericLiteral",
"start": 1053,
"end": 1054,
"loc": {
"start": {
"line": 25,
"column": 21
},
"end": {
"line": 25,
"column": 22
}
},
"extra": {
"rawValue": 0,
"raw": "0"
},
"value": 0
}
}
],
"kind": "let"
},
"test": {
"type": "BinaryExpression",
"start": 1056,
"end": 1070,
"loc": {
"start": {
"line": 25,
"column": 24
},
"end": {
"line": 25,
"column": 38
}
},
"left": {
"type": "Identifier",
"start": 1056,
"end": 1057,
"loc": {
"start": {
"line": 25,
"column": 24
},
"end": {
"line": 25,
"column": 25
},
"identifierName": "i"
},
"name": "i"
},
"operator": "<",
"right": {
"type": "BinaryExpression",
"start": 1060,
"end": 1070,
"loc": {
"start": {
"line": 25,
"column": 28
},
"end": {
"line": 25,
"column": 38
}
},
"left": {
"type": "Identifier",
"start": 1060,
"end": 1066,
"loc": {
"start": {
"line": 25,
"column": 28
},
"end": {
"line": 25,
"column": 34
},
"identifierName": "length"
},
"name": "length"
},
"operator": "-",
"right": {
"type": "NumericLiteral",
"start": 1069,
"end": 1070,
"loc": {
"start": {
"line": 25,
"column": 37
},
"end": {
"line": 25,
"column": 38
}
},
"extra": {
"rawValue": 1,
"raw": "1"
},
"value": 1
}
}
},
"update": {
"type": "UpdateExpression",
"start": 1072,
"end": 1075,
"loc": {
"start": {
"line": 25,
"column": 40
},
"end": {
"line": 25,
"column": 43
}
},
"operator": "++",
"prefix": false,
"argument": {
"type": "Identifier",
"start": 1072,
"end": 1073,
"loc": {
"start": {
"line": 25,
"column": 40
},
"end": {
"line": 25,
"column": 41
},
"identifierName": "i"
},
"name": "i"
}
},
"body": {
"type": "BlockStatement",
"start": 1077,
"end": 2301,
"loc": {
"start": {
"line": 25,
"column": 45
},
"end": {
"line": 55,
"column": 9
}
},
"body": [
{
"type": "ForStatement",
"start": 1092,
"end": 2290,
"loc": {
"start": {
"line": 26,
"column": 12
},
"end": {
"line": 54,
"column": 13
}
},
"init": {
"type": "VariableDeclaration",
"start": 1096,
"end": 1109,
"loc": {
"start": {
"line": 26,
"column": 16
},
"end": {
"line": 26,
"column": 29
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 1100,
"end": 1109,
"loc": {
"start": {
"line": 26,
"column": 20
},
"end": {
"line": 26,
"column": 29
}
},
"id": {
"type": "Identifier",
"start": 1100,
"end": 1101,
"loc": {
"start": {
"line": 26,
"column": 20
},
"end": {
"line": 26,
"column": 21
},
"identifierName": "j"
},
"name": "j"
},
"init": {
"type": "BinaryExpression",
"start": 1104,
"end": 1109,
"loc": {
"start": {
"line": 26,
"column": 24
},
"end": {
"line": 26,
"column": 29
}
},
"left": {
"type": "Identifier",
"start": 1104,
"end": 1105,
"loc": {
"start": {
"line": 26,
"column": 24
},
"end": {
"line": 26,
"column": 25
},
"identifierName": "i"
},
"name": "i"
},
"operator": "+",
"right": {
"type": "NumericLiteral",
"start": 1108,
"end": 1109,
"loc": {
"start": {
"line": 26,
"column": 28
},
"end": {
"line": 26,
"column": 29
}
},
"extra": {
"rawValue": 1,
"raw": "1"
},
"value": 1
}
}
}
],
"kind": "let"
},
"test": {
"type": "BinaryExpression",
"start": 1111,
"end": 1121,
"loc": {
"start": {
"line": 26,
"column": 31
},
"end": {
"line": 26,
"column": 41
}
},
"left": {
"type": "Identifier",
"start": 1111,
"end": 1112,
"loc": {
"start": {
"line": 26,
"column": 31
},
"end": {
"line": 26,
"column": 32
},
"identifierName": "j"
},
"name": "j"
},
"operator": "<",
"right": {
"type": "Identifier",
"start": 1115,
"end": 1121,
"loc": {
"start": {
"line": 26,
"column": 35
},
"end": {
"line": 26,
"column": 41
},
"identifierName": "length"
},
"name": "length"
}
},
"update": {
"type": "UpdateExpression",
"start": 1123,
"end": 1126,
"loc": {
"start": {
"line": 26,
"column": 43
},
"end": {
"line": 26,
"column": 46
}
},
"operator": "++",
"prefix": false,
"argument": {
"type": "Identifier",
"start": 1123,
"end": 1124,
"loc": {
"start": {
"line": 26,
"column": 43
},
"end": {
"line": 26,
"column": 44
},
"identifierName": "j"
},
"name": "j"
}
},
"body": {
"type": "BlockStatement",
"start": 1128,
"end": 2290,
"loc": {
"start": {
"line": 26,
"column": 48
},
"end": {
"line": 54,
"column": 13
}
},
"body": [
{
"type": "VariableDeclaration",
"start": 1147,
"end": 1179,
"loc": {
"start": {
"line": 27,
"column": 16
},
"end": {
"line": 27,
"column": 48
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 1151,
"end": 1178,
"loc": {
"start": {
"line": 27