-
Notifications
You must be signed in to change notification settings - Fork 2
/
rhythm.js
31 lines (28 loc) · 1.46 KB
/
rhythm.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
// --------------------------------------------------------------------------
// -- rhythm.js
// -- initial author: Renick Bell ([email protected])
// -- initial creation date: Wed Jun 28 10:08:48 AM CST 2023
// -- contributors: Yiler Huang ([email protected]); Steve Wang ([email protected])
// -- license: GPL 3.0
// --------------------------------------------------------------------------
//Create rhythm map related things:
function createRhythmMap (noteValueData, name){
if (typeof noteValueData.rhythmMap !== 'string'){
//let generatedRhythmPattern = new QuantizedMap(1, [1], [new QuantizedMap(noteValueData.total, quantizedKeys, noteValueData.rhythmMap)])
let generatedRhythmPattern = new QuantizedMap(1, [1], [new QuantizedMap(noteValueData.total, noteValueData.noteDuration, noteValueData.rhythmMap)])
e.rhythmMaps[name] = generatedRhythmPattern
}
}
//Create mask map from note value data:
function createMaskMap (noteValueData, name){
e.maskMaps[name] = new QuantizedMap(noteValueData.total)
let currentMaskMap = e.maskMaps[name]
if (noteValueData.maskMapKeys === undefined){
currentMaskMap.keys = A.buildArray(currentMaskMap.keyspan + 1, x => {return x})
}
else {
currentMaskMap.keys = noteValueData.maskMapKeys
}
currentMaskMap.values = A.resizeArray(currentMaskMap.keyspan, noteValueData.bools)
// currentMaskMap.values = flipBooleans(resizeArray(currentMaskMap.keyspan, noteValueData.bools))
}