-
Notifications
You must be signed in to change notification settings - Fork 1
/
monoNote.ts
45 lines (39 loc) · 820 Bytes
/
monoNote.ts
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
inlets = 1;
var lastNote: number | null = null;
var lastTie: boolean = false;
function list() {
const [_, note, vel, duration] = arrayfromargs(arguments) as number[];
const tie = duration == 120;
const rest = vel == 0;
if (
lastNote === null
&& !rest
) {
outlet(0, [note, vel]);
}
else if (
lastTie
&& !rest
&& lastNote !== note
) {
outlet(0, [note, vel]);
outlet(0, [lastNote, 0]);
}
else if (
lastNote !== null
&& rest
) {
outlet(0, [lastNote, 0]);
}
else if (
lastNote !== null
&& !lastTie
) {
outlet(0, [lastNote, 0]);
outlet(0, [note, vel]);
}
lastNote = rest ? null : note;
lastTie = tie;
}
let module = {};
export = {};