-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrecording.js
56 lines (51 loc) · 1.26 KB
/
recording.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/**
* Data for each recorded note.
*/
export class RecNote {
/**
* The time (in ms) that this note occurs relative to the when the first note of the recording is.
*
* @type {number}
*/
timeOn;
/**
* Number of edosteps from A4
*
* @type {number}
*/
stepsFromA;
/**
* Harmonic coordinate of this note.
*/
harmCoords;
constructor(timeOn, stepsFromA, harmCoords) {
this.timeOn = timeOn;
this.stepsFromA = stepsFromA;
this.harmCoords = harmCoords;
}
}
/**
* Recorded notes for making the lattice sculpture.
* (Run one recording pass in normal mode then set `SCULPTURE_MODE` in configs.js to `true`)
*
* @type {RecNote[]}
*/
export let RECORDED_NOTES = [];
export let IS_RECORDING = false;
/**
* Starts recording. (The recording only starts when the first note after beginRecording is played.)
*
* NOTE: the recording is done in note-tracking.js
*/
window.beginRecording = function() {
IS_RECORDING = true;
RECORDED_NOTES = [];
}
/**
* Finishes recording and dumps the recorded JSON data to the console.
*/
window.endRecording = function() {
IS_RECORDING = false;
console.log(JSON.stringify(RECORDED_NOTES));
window.recordedNotes = RECORDED_NOTES;
}