-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefault.js
142 lines (127 loc) · 3.14 KB
/
default.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
var PluginParameters = [
{
name: 'Trigger',
type: 'menu',
valueStrings: ['Off', 'On'],
minValue: 0,
maxValue: 1,
defaultValue: 0,
numberOfSteps: 1,
},
{
name: 'Tone',
type: 'menu',
valueStrings: [
'A',
'Bb',
'B',
'C',
'Db',
'D',
'Eb',
'E',
'F',
'Gb',
'G',
'Ab',
],
minValue: 0,
maxValue: 11,
defaultValue: 0,
numberOfSteps: 11,
},
]
function HandleMIDI(event) {
if (event instanceof NoteOn) {
var cc = new ControlChange()
cc.number = 64
cc.value = 0
cc.send()
cc.trace()
event.send()
event.trace()
cc.value = 127
cc.send()
cc.trace()
}
if (event instanceof NoteOff) {
event.send()
event.trace()
}
}
function ParameterChanged() {
var trigger = GetParameter('Trigger')
var transpose = 0
var vel = 127
var dtype = 1
if (trigger === 1) {
var cc = new ControlChange()
cc.number = 64
cc.value = 0
cc.send()
var noteOn = new NoteOn()
var noteOff = new NoteOff()
switch (dtype) {
case 0:
noteOn.pitch = 57 + GetParameter('Tone') + transpose * 12
noteOn.velocity = vel
noteOn.send()
noteOn.pitch = 57 + GetParameter('Tone') + 7 + transpose * 12
noteOn.send()
break
case 1:
noteOn.pitch = 57 + GetParameter('Tone') + transpose * 12
noteOn.velocity = vel
noteOn.send()
noteOn.pitch = 57 + GetParameter('Tone') + 7 + transpose * 12
noteOn.send()
noteOn.pitch = 57 + GetParameter('Tone') + 12 + transpose * 12
noteOn.send()
break
case 2:
noteOn.pitch = 57 + GetParameter('Tone') - 12 + transpose * 12
noteOn.velocity = vel
noteOn.send()
noteOn.pitch = 57 + GetParameter('Tone') + transpose * 12
noteOn.send()
noteOn.pitch = 57 + GetParameter('Tone') + 7 + transpose * 12
noteOn.send()
noteOn.pitch = 57 + GetParameter('Tone') + 12 + transpose * 12
noteOn.send()
break
}
cc.value = 127
cc.send()
switch (dtype) {
case 0:
noteOff.pitch = 57 + GetParameter('Tone') + transpose * 12
noteOff.send()
noteOff.pitch = 57 + GetParameter('Tone') + 7 + transpose * 12
noteOff.send()
break
case 1:
noteOff.pitch = 57 + GetParameter('Tone') + transpose * 12
noteOff.send()
noteOff.pitch = 57 + GetParameter('Tone') + 7 + transpose * 12
noteOff.send()
noteOff.pitch = 57 + GetParameter('Tone') + 12 + transpose * 12
noteOff.send()
break
case 2:
noteOff.pitch = 57 + GetParameter('Tone') - 12 + transpose * 12
noteOff.send()
noteOff.pitch = 57 + GetParameter('Tone') + transpose * 12
noteOff.send()
noteOff.pitch = 57 + GetParameter('Tone') + 7 + transpose * 12
noteOff.send()
noteOff.pitch = 57 + GetParameter('Tone') + 12 + transpose * 12
noteOff.send()
break
}
} else if (trigger === 0) {
var cc = new ControlChange()
cc.number = 64
cc.value = 0
cc.send()
}
}