@vue-skuilder/courseware 0.1.33 → 0.1.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CourseWare-BTFRjgBR.js +305 -0
- package/dist/CourseWare-BTFRjgBR.js.map +1 -0
- package/dist/CourseWare-DSeyTAtH.cjs +2 -0
- package/dist/CourseWare-DSeyTAtH.cjs.map +1 -0
- package/dist/assets/CourseWare.css +1 -0
- package/dist/assets/chess.css +1 -0
- package/dist/assets/index.css +1 -1
- package/dist/assets/math.css +1 -0
- package/dist/assets/piano.css +1 -0
- package/dist/assets/sightsing.css +1 -0
- package/dist/assets/typing.css +1 -0
- package/dist/backend.cjs.js +1 -1
- package/dist/backend.cjs.js.map +1 -1
- package/dist/backend.mjs +4 -3
- package/dist/backend.mjs.map +1 -1
- package/dist/chess/components/ChessBoard.vue.d.ts.map +1 -1
- package/dist/chess/composables/useChessgroundBounds.d.ts +24 -0
- package/dist/chess/composables/useChessgroundBounds.d.ts.map +1 -0
- package/dist/chess/questions/puzzle/puzzle.vue.d.ts.map +1 -1
- package/dist/chess-BbHATAzk.js +2949 -0
- package/dist/chess-BbHATAzk.js.map +1 -0
- package/dist/chess-BsgVZARV.cjs +7 -0
- package/dist/chess-BsgVZARV.cjs.map +1 -0
- package/dist/chess-C_2RQEuq.cjs +1 -0
- package/dist/chess-X1bmWmh3.js +3 -0
- package/dist/french-Bxet7hJm.cjs +2 -0
- package/dist/french-Bxet7hJm.cjs.map +1 -0
- package/dist/french-Dk7YG8Td.js +140 -0
- package/dist/french-Dk7YG8Td.js.map +1 -0
- package/dist/french-evUMlbbq.js +3 -0
- package/dist/french-x9P8RRn8.cjs +1 -0
- package/dist/index.cjs.js +2 -170
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +172 -62021
- package/dist/index.mjs.map +1 -1
- package/dist/math-B1oDAkOy.cjs +34 -0
- package/dist/math-B1oDAkOy.cjs.map +1 -0
- package/dist/math-B4HbgYf6.js +13391 -0
- package/dist/math-B4HbgYf6.js.map +1 -0
- package/dist/math-BWlIa6-l.cjs +1 -0
- package/dist/math-DYni7rRl.js +3 -0
- package/dist/piano-BN5Btq91.js +3 -0
- package/dist/piano-Btvkzjfz.cjs +1 -0
- package/dist/piano-CefQUc72.cjs +2 -0
- package/dist/piano-CefQUc72.cjs.map +1 -0
- package/dist/piano-DF1g6yaX.js +3603 -0
- package/dist/piano-DF1g6yaX.js.map +1 -0
- package/dist/pitch-C-lh9ezH.cjs +2 -0
- package/dist/pitch-C-lh9ezH.cjs.map +1 -0
- package/dist/pitch-CgGJFkZ1.js +106 -0
- package/dist/pitch-CgGJFkZ1.js.map +1 -0
- package/dist/pitch-Dn0iNqiS.js +3 -0
- package/dist/pitch-DsopN5IR.cjs +1 -0
- package/dist/{shapes-nszfsx3o.js → shapes-BQUVJdp5.js} +3 -21
- package/dist/shapes-BQUVJdp5.js.map +1 -0
- package/dist/shapes-C_-mvrCc.cjs +2 -0
- package/dist/shapes-C_-mvrCc.cjs.map +1 -0
- package/dist/shapes-DRq8J94A.cjs +2 -0
- package/dist/shapes-DRq8J94A.cjs.map +1 -0
- package/dist/shapes-ICeg46lr.js +25 -0
- package/dist/shapes-ICeg46lr.js.map +1 -0
- package/dist/sightsing-BFQ7HRig.js +41061 -0
- package/dist/sightsing-BFQ7HRig.js.map +1 -0
- package/dist/sightsing-CJX3k0Fd.js +3 -0
- package/dist/sightsing-Cr_SJ5Vc.cjs +133 -0
- package/dist/sightsing-Cr_SJ5Vc.cjs.map +1 -0
- package/dist/sightsing-CtagQ0FJ.cjs +1 -0
- package/dist/typing-BevtfWlp.js +184 -0
- package/dist/typing-BevtfWlp.js.map +1 -0
- package/dist/typing-CBPjtwrg.cjs +1 -0
- package/dist/typing-CK-glKhm.cjs +2 -0
- package/dist/typing-CK-glKhm.cjs.map +1 -0
- package/dist/typing-k-ojjO7G.js +3 -0
- package/dist/word-work-BOnRlZgd.js +108 -0
- package/dist/word-work-BOnRlZgd.js.map +1 -0
- package/dist/word-work-C5MTSapy.cjs +1 -0
- package/dist/word-work-Dd6tIKrt.js +3 -0
- package/dist/word-work-fNbCLNuN.cjs +2 -0
- package/dist/word-work-fNbCLNuN.cjs.map +1 -0
- package/package.json +6 -5
- package/dist/shapes-DJ-ujuDr.cjs +0 -2
- package/dist/shapes-DJ-ujuDr.cjs.map +0 -1
- package/dist/shapes-nszfsx3o.js.map +0 -1
|
@@ -0,0 +1,3603 @@
|
|
|
1
|
+
import { a as e, n as t, r as n } from "./shapes-BQUVJdp5.js";
|
|
2
|
+
import { r, t as i } from "./CourseWare-BTFRjgBR.js";
|
|
3
|
+
import { Fragment as a, computed as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createTextVNode as d, createVNode as f, defineComponent as p, normalizeStyle as m, onBeforeUnmount as h, onMounted as g, openBlock as _, ref as v, renderList as y, resolveComponent as b, toDisplayString as x, withCtx as S } from "vue";
|
|
4
|
+
import { Question as C, SkldrMouseTrap as w, alertUser as T, useQuestionView as E, useViewable as ee } from "@vue-skuilder/common-ui";
|
|
5
|
+
import { DataShapeName as D, FieldType as O, Status as k } from "@vue-skuilder/common";
|
|
6
|
+
import A from "moment";
|
|
7
|
+
//#region ../../node_modules/webmidi/webmidi.min.js
|
|
8
|
+
var te = /* @__PURE__ */ t(((e, t) => {
|
|
9
|
+
(function(e) {
|
|
10
|
+
function WebMidi() {
|
|
11
|
+
if (WebMidi.prototype._singleton) throw Error("WebMidi is a singleton, it cannot be instantiated directly.");
|
|
12
|
+
(WebMidi.prototype._singleton = this)._inputs = [], this._outputs = [], this._userHandlers = {}, this._stateChangeQueue = [], this._processingStateChange = !1, this._midiInterfaceEvents = ["connected", "disconnected"], this._nrpnBuffer = [
|
|
13
|
+
[],
|
|
14
|
+
[],
|
|
15
|
+
[],
|
|
16
|
+
[],
|
|
17
|
+
[],
|
|
18
|
+
[],
|
|
19
|
+
[],
|
|
20
|
+
[],
|
|
21
|
+
[],
|
|
22
|
+
[],
|
|
23
|
+
[],
|
|
24
|
+
[],
|
|
25
|
+
[],
|
|
26
|
+
[],
|
|
27
|
+
[],
|
|
28
|
+
[]
|
|
29
|
+
], this._nrpnEventsEnabled = !0, this._nrpnTypes = [
|
|
30
|
+
"entry",
|
|
31
|
+
"increment",
|
|
32
|
+
"decrement"
|
|
33
|
+
], this._notes = [
|
|
34
|
+
"C",
|
|
35
|
+
"C#",
|
|
36
|
+
"D",
|
|
37
|
+
"D#",
|
|
38
|
+
"E",
|
|
39
|
+
"F",
|
|
40
|
+
"F#",
|
|
41
|
+
"G",
|
|
42
|
+
"G#",
|
|
43
|
+
"A",
|
|
44
|
+
"A#",
|
|
45
|
+
"B"
|
|
46
|
+
], this._semitones = {
|
|
47
|
+
C: 0,
|
|
48
|
+
D: 2,
|
|
49
|
+
E: 4,
|
|
50
|
+
F: 5,
|
|
51
|
+
G: 7,
|
|
52
|
+
A: 9,
|
|
53
|
+
B: 11
|
|
54
|
+
}, Object.defineProperties(this, {
|
|
55
|
+
MIDI_SYSTEM_MESSAGES: {
|
|
56
|
+
value: {
|
|
57
|
+
sysex: 240,
|
|
58
|
+
timecode: 241,
|
|
59
|
+
songposition: 242,
|
|
60
|
+
songselect: 243,
|
|
61
|
+
tuningrequest: 246,
|
|
62
|
+
sysexend: 247,
|
|
63
|
+
clock: 248,
|
|
64
|
+
start: 250,
|
|
65
|
+
continue: 251,
|
|
66
|
+
stop: 252,
|
|
67
|
+
activesensing: 254,
|
|
68
|
+
reset: 255,
|
|
69
|
+
midimessage: 0,
|
|
70
|
+
unknownsystemmessage: -1
|
|
71
|
+
},
|
|
72
|
+
writable: !1,
|
|
73
|
+
enumerable: !0,
|
|
74
|
+
configurable: !1
|
|
75
|
+
},
|
|
76
|
+
MIDI_CHANNEL_MESSAGES: {
|
|
77
|
+
value: {
|
|
78
|
+
noteoff: 8,
|
|
79
|
+
noteon: 9,
|
|
80
|
+
keyaftertouch: 10,
|
|
81
|
+
controlchange: 11,
|
|
82
|
+
channelmode: 11,
|
|
83
|
+
nrpn: 11,
|
|
84
|
+
programchange: 12,
|
|
85
|
+
channelaftertouch: 13,
|
|
86
|
+
pitchbend: 14
|
|
87
|
+
},
|
|
88
|
+
writable: !1,
|
|
89
|
+
enumerable: !0,
|
|
90
|
+
configurable: !1
|
|
91
|
+
},
|
|
92
|
+
MIDI_REGISTERED_PARAMETER: {
|
|
93
|
+
value: {
|
|
94
|
+
pitchbendrange: [0, 0],
|
|
95
|
+
channelfinetuning: [0, 1],
|
|
96
|
+
channelcoarsetuning: [0, 2],
|
|
97
|
+
tuningprogram: [0, 3],
|
|
98
|
+
tuningbank: [0, 4],
|
|
99
|
+
modulationrange: [0, 5],
|
|
100
|
+
azimuthangle: [61, 0],
|
|
101
|
+
elevationangle: [61, 1],
|
|
102
|
+
gain: [61, 2],
|
|
103
|
+
distanceratio: [61, 3],
|
|
104
|
+
maximumdistance: [61, 4],
|
|
105
|
+
maximumdistancegain: [61, 5],
|
|
106
|
+
referencedistanceratio: [61, 6],
|
|
107
|
+
panspreadangle: [61, 7],
|
|
108
|
+
rollangle: [61, 8]
|
|
109
|
+
},
|
|
110
|
+
writable: !1,
|
|
111
|
+
enumerable: !0,
|
|
112
|
+
configurable: !1
|
|
113
|
+
},
|
|
114
|
+
MIDI_CONTROL_CHANGE_MESSAGES: {
|
|
115
|
+
value: {
|
|
116
|
+
bankselectcoarse: 0,
|
|
117
|
+
modulationwheelcoarse: 1,
|
|
118
|
+
breathcontrollercoarse: 2,
|
|
119
|
+
footcontrollercoarse: 4,
|
|
120
|
+
portamentotimecoarse: 5,
|
|
121
|
+
dataentrycoarse: 6,
|
|
122
|
+
volumecoarse: 7,
|
|
123
|
+
balancecoarse: 8,
|
|
124
|
+
pancoarse: 10,
|
|
125
|
+
expressioncoarse: 11,
|
|
126
|
+
effectcontrol1coarse: 12,
|
|
127
|
+
effectcontrol2coarse: 13,
|
|
128
|
+
generalpurposeslider1: 16,
|
|
129
|
+
generalpurposeslider2: 17,
|
|
130
|
+
generalpurposeslider3: 18,
|
|
131
|
+
generalpurposeslider4: 19,
|
|
132
|
+
bankselectfine: 32,
|
|
133
|
+
modulationwheelfine: 33,
|
|
134
|
+
breathcontrollerfine: 34,
|
|
135
|
+
footcontrollerfine: 36,
|
|
136
|
+
portamentotimefine: 37,
|
|
137
|
+
dataentryfine: 38,
|
|
138
|
+
volumefine: 39,
|
|
139
|
+
balancefine: 40,
|
|
140
|
+
panfine: 42,
|
|
141
|
+
expressionfine: 43,
|
|
142
|
+
effectcontrol1fine: 44,
|
|
143
|
+
effectcontrol2fine: 45,
|
|
144
|
+
holdpedal: 64,
|
|
145
|
+
portamento: 65,
|
|
146
|
+
sustenutopedal: 66,
|
|
147
|
+
softpedal: 67,
|
|
148
|
+
legatopedal: 68,
|
|
149
|
+
hold2pedal: 69,
|
|
150
|
+
soundvariation: 70,
|
|
151
|
+
resonance: 71,
|
|
152
|
+
soundreleasetime: 72,
|
|
153
|
+
soundattacktime: 73,
|
|
154
|
+
brightness: 74,
|
|
155
|
+
soundcontrol6: 75,
|
|
156
|
+
soundcontrol7: 76,
|
|
157
|
+
soundcontrol8: 77,
|
|
158
|
+
soundcontrol9: 78,
|
|
159
|
+
soundcontrol10: 79,
|
|
160
|
+
generalpurposebutton1: 80,
|
|
161
|
+
generalpurposebutton2: 81,
|
|
162
|
+
generalpurposebutton3: 82,
|
|
163
|
+
generalpurposebutton4: 83,
|
|
164
|
+
reverblevel: 91,
|
|
165
|
+
tremololevel: 92,
|
|
166
|
+
choruslevel: 93,
|
|
167
|
+
celestelevel: 94,
|
|
168
|
+
phaserlevel: 95,
|
|
169
|
+
databuttonincrement: 96,
|
|
170
|
+
databuttondecrement: 97,
|
|
171
|
+
nonregisteredparametercoarse: 98,
|
|
172
|
+
nonregisteredparameterfine: 99,
|
|
173
|
+
registeredparametercoarse: 100,
|
|
174
|
+
registeredparameterfine: 101
|
|
175
|
+
},
|
|
176
|
+
writable: !1,
|
|
177
|
+
enumerable: !0,
|
|
178
|
+
configurable: !1
|
|
179
|
+
},
|
|
180
|
+
MIDI_NRPN_MESSAGES: {
|
|
181
|
+
value: {
|
|
182
|
+
entrymsb: 6,
|
|
183
|
+
entrylsb: 38,
|
|
184
|
+
increment: 96,
|
|
185
|
+
decrement: 97,
|
|
186
|
+
paramlsb: 98,
|
|
187
|
+
parammsb: 99,
|
|
188
|
+
nullactiveparameter: 127
|
|
189
|
+
},
|
|
190
|
+
writable: !1,
|
|
191
|
+
enumerable: !0,
|
|
192
|
+
configurable: !1
|
|
193
|
+
},
|
|
194
|
+
MIDI_CHANNEL_MODE_MESSAGES: {
|
|
195
|
+
value: {
|
|
196
|
+
allsoundoff: 120,
|
|
197
|
+
resetallcontrollers: 121,
|
|
198
|
+
localcontrol: 122,
|
|
199
|
+
allnotesoff: 123,
|
|
200
|
+
omnimodeoff: 124,
|
|
201
|
+
omnimodeon: 125,
|
|
202
|
+
monomodeon: 126,
|
|
203
|
+
polymodeon: 127
|
|
204
|
+
},
|
|
205
|
+
writable: !1,
|
|
206
|
+
enumerable: !0,
|
|
207
|
+
configurable: !1
|
|
208
|
+
},
|
|
209
|
+
octaveOffset: {
|
|
210
|
+
value: 0,
|
|
211
|
+
writable: !0,
|
|
212
|
+
enumerable: !0,
|
|
213
|
+
configurable: !1
|
|
214
|
+
}
|
|
215
|
+
}), Object.defineProperties(this, {
|
|
216
|
+
supported: {
|
|
217
|
+
enumerable: !0,
|
|
218
|
+
get: function() {
|
|
219
|
+
return "requestMIDIAccess" in navigator;
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
enabled: {
|
|
223
|
+
enumerable: !0,
|
|
224
|
+
get: function() {
|
|
225
|
+
return this.interface !== void 0;
|
|
226
|
+
}.bind(this)
|
|
227
|
+
},
|
|
228
|
+
inputs: {
|
|
229
|
+
enumerable: !0,
|
|
230
|
+
get: function() {
|
|
231
|
+
return this._inputs;
|
|
232
|
+
}.bind(this)
|
|
233
|
+
},
|
|
234
|
+
outputs: {
|
|
235
|
+
enumerable: !0,
|
|
236
|
+
get: function() {
|
|
237
|
+
return this._outputs;
|
|
238
|
+
}.bind(this)
|
|
239
|
+
},
|
|
240
|
+
sysexEnabled: {
|
|
241
|
+
enumerable: !0,
|
|
242
|
+
get: function() {
|
|
243
|
+
return !(!this.interface || !this.interface.sysexEnabled);
|
|
244
|
+
}.bind(this)
|
|
245
|
+
},
|
|
246
|
+
nrpnEventsEnabled: {
|
|
247
|
+
enumerable: !0,
|
|
248
|
+
get: function() {
|
|
249
|
+
return !!this._nrpnEventsEnabled;
|
|
250
|
+
}.bind(this),
|
|
251
|
+
set: function(e) {
|
|
252
|
+
return this._nrpnEventsEnabled = e, this._nrpnEventsEnabled;
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
nrpnTypes: {
|
|
256
|
+
enumerable: !0,
|
|
257
|
+
get: function() {
|
|
258
|
+
return this._nrpnTypes;
|
|
259
|
+
}.bind(this)
|
|
260
|
+
},
|
|
261
|
+
time: {
|
|
262
|
+
enumerable: !0,
|
|
263
|
+
get: function() {
|
|
264
|
+
return performance.now();
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
var n = new WebMidi();
|
|
270
|
+
function Input(e) {
|
|
271
|
+
var t = this;
|
|
272
|
+
this._userHandlers = {
|
|
273
|
+
channel: {},
|
|
274
|
+
system: {}
|
|
275
|
+
}, this._midiInput = e, Object.defineProperties(this, {
|
|
276
|
+
connection: {
|
|
277
|
+
enumerable: !0,
|
|
278
|
+
get: function() {
|
|
279
|
+
return t._midiInput.connection;
|
|
280
|
+
}
|
|
281
|
+
},
|
|
282
|
+
id: {
|
|
283
|
+
enumerable: !0,
|
|
284
|
+
get: function() {
|
|
285
|
+
return t._midiInput.id;
|
|
286
|
+
}
|
|
287
|
+
},
|
|
288
|
+
manufacturer: {
|
|
289
|
+
enumerable: !0,
|
|
290
|
+
get: function() {
|
|
291
|
+
return t._midiInput.manufacturer;
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
name: {
|
|
295
|
+
enumerable: !0,
|
|
296
|
+
get: function() {
|
|
297
|
+
return t._midiInput.name;
|
|
298
|
+
}
|
|
299
|
+
},
|
|
300
|
+
state: {
|
|
301
|
+
enumerable: !0,
|
|
302
|
+
get: function() {
|
|
303
|
+
return t._midiInput.state;
|
|
304
|
+
}
|
|
305
|
+
},
|
|
306
|
+
type: {
|
|
307
|
+
enumerable: !0,
|
|
308
|
+
get: function() {
|
|
309
|
+
return t._midiInput.type;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}), this._initializeUserHandlers(), this._midiInput.onmidimessage = this._onMidiMessage.bind(this);
|
|
313
|
+
}
|
|
314
|
+
function Output(e) {
|
|
315
|
+
var t = this;
|
|
316
|
+
this._midiOutput = e, Object.defineProperties(this, {
|
|
317
|
+
connection: {
|
|
318
|
+
enumerable: !0,
|
|
319
|
+
get: function() {
|
|
320
|
+
return t._midiOutput.connection;
|
|
321
|
+
}
|
|
322
|
+
},
|
|
323
|
+
id: {
|
|
324
|
+
enumerable: !0,
|
|
325
|
+
get: function() {
|
|
326
|
+
return t._midiOutput.id;
|
|
327
|
+
}
|
|
328
|
+
},
|
|
329
|
+
manufacturer: {
|
|
330
|
+
enumerable: !0,
|
|
331
|
+
get: function() {
|
|
332
|
+
return t._midiOutput.manufacturer;
|
|
333
|
+
}
|
|
334
|
+
},
|
|
335
|
+
name: {
|
|
336
|
+
enumerable: !0,
|
|
337
|
+
get: function() {
|
|
338
|
+
return t._midiOutput.name;
|
|
339
|
+
}
|
|
340
|
+
},
|
|
341
|
+
state: {
|
|
342
|
+
enumerable: !0,
|
|
343
|
+
get: function() {
|
|
344
|
+
return t._midiOutput.state;
|
|
345
|
+
}
|
|
346
|
+
},
|
|
347
|
+
type: {
|
|
348
|
+
enumerable: !0,
|
|
349
|
+
get: function() {
|
|
350
|
+
return t._midiOutput.type;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
WebMidi.prototype.enable = function(e, t) {
|
|
356
|
+
this.enabled || (this.supported ? navigator.requestMIDIAccess({ sysex: t }).then(function(t) {
|
|
357
|
+
var n, r = [], i = [];
|
|
358
|
+
this.interface = t, this._resetInterfaceUserHandlers(), this.interface.onstatechange = function(e) {
|
|
359
|
+
r.push(e);
|
|
360
|
+
};
|
|
361
|
+
for (var a = t.inputs.values(), o = a.next(); o && !o.done; o = a.next()) i.push(o.value.open());
|
|
362
|
+
for (var s = t.outputs.values(), c = s.next(); c && !c.done; c = s.next()) i.push(c.value.open());
|
|
363
|
+
function onPortsOpen() {
|
|
364
|
+
clearTimeout(n), this._updateInputsAndOutputs(), this.interface.onstatechange = this._onInterfaceStateChange.bind(this), typeof e == "function" && e.call(this), r.forEach(function(e) {
|
|
365
|
+
this._onInterfaceStateChange(e);
|
|
366
|
+
}.bind(this));
|
|
367
|
+
}
|
|
368
|
+
n = setTimeout(onPortsOpen.bind(this), 200), Promise && Promise.all(i).catch(function(e) {}).then(onPortsOpen.bind(this));
|
|
369
|
+
}.bind(this), function(t) {
|
|
370
|
+
typeof e == "function" && e.call(this, t);
|
|
371
|
+
}.bind(this)) : typeof e == "function" && e(/* @__PURE__ */ Error("The Web MIDI API is not supported by your browser.")));
|
|
372
|
+
}, WebMidi.prototype.disable = function() {
|
|
373
|
+
if (!this.supported) throw Error("The Web MIDI API is not supported by your browser.");
|
|
374
|
+
this.enabled && (this.removeListener(), this.inputs.forEach(function(e) {
|
|
375
|
+
e.removeListener();
|
|
376
|
+
})), this.interface && (this.interface.onstatechange = void 0), this.interface = void 0, this._inputs = [], this._outputs = [], this._nrpnEventsEnabled = !0, this._resetInterfaceUserHandlers();
|
|
377
|
+
}, WebMidi.prototype.addListener = function(e, t) {
|
|
378
|
+
if (!this.enabled) throw Error("WebMidi must be enabled before adding event listeners.");
|
|
379
|
+
if (typeof t != "function") throw TypeError("The 'listener' parameter must be a function.");
|
|
380
|
+
if (!(0 <= this._midiInterfaceEvents.indexOf(e))) throw TypeError("The specified event type is not supported.");
|
|
381
|
+
return this._userHandlers[e].push(t), this;
|
|
382
|
+
}, WebMidi.prototype.hasListener = function(e, t) {
|
|
383
|
+
if (!this.enabled) throw Error("WebMidi must be enabled before checking event listeners.");
|
|
384
|
+
if (typeof t != "function") throw TypeError("The 'listener' parameter must be a function.");
|
|
385
|
+
if (!(0 <= this._midiInterfaceEvents.indexOf(e))) throw TypeError("The specified event type is not supported.");
|
|
386
|
+
for (var n = 0; n < this._userHandlers[e].length; n++) if (this._userHandlers[e][n] === t) return !0;
|
|
387
|
+
return !1;
|
|
388
|
+
}, WebMidi.prototype.removeListener = function(e, t) {
|
|
389
|
+
if (!this.enabled) throw Error("WebMidi must be enabled before removing event listeners.");
|
|
390
|
+
if (t !== void 0 && typeof t != "function") throw TypeError("The 'listener' parameter must be a function.");
|
|
391
|
+
if (0 <= this._midiInterfaceEvents.indexOf(e)) if (t) for (var n = 0; n < this._userHandlers[e].length; n++) this._userHandlers[e][n] === t && this._userHandlers[e].splice(n, 1);
|
|
392
|
+
else this._userHandlers[e] = [];
|
|
393
|
+
else {
|
|
394
|
+
if (e !== void 0) throw TypeError("The specified event type is not supported.");
|
|
395
|
+
this._resetInterfaceUserHandlers();
|
|
396
|
+
}
|
|
397
|
+
return this;
|
|
398
|
+
}, WebMidi.prototype.toMIDIChannels = function(e) {
|
|
399
|
+
var t;
|
|
400
|
+
if (e === "all" || e === void 0) t = ["all"];
|
|
401
|
+
else {
|
|
402
|
+
if (e === "none") return t = [];
|
|
403
|
+
t = Array.isArray(e) ? e : [e];
|
|
404
|
+
}
|
|
405
|
+
return -1 < t.indexOf("all") && (t = [
|
|
406
|
+
1,
|
|
407
|
+
2,
|
|
408
|
+
3,
|
|
409
|
+
4,
|
|
410
|
+
5,
|
|
411
|
+
6,
|
|
412
|
+
7,
|
|
413
|
+
8,
|
|
414
|
+
9,
|
|
415
|
+
10,
|
|
416
|
+
11,
|
|
417
|
+
12,
|
|
418
|
+
13,
|
|
419
|
+
14,
|
|
420
|
+
15,
|
|
421
|
+
16
|
|
422
|
+
]), t.map(function(e) {
|
|
423
|
+
return parseInt(e);
|
|
424
|
+
}).filter(function(e) {
|
|
425
|
+
return 1 <= e && e <= 16;
|
|
426
|
+
});
|
|
427
|
+
}, WebMidi.prototype.getInputById = function(e) {
|
|
428
|
+
if (!this.enabled) throw Error("WebMidi is not enabled.");
|
|
429
|
+
e = String(e);
|
|
430
|
+
for (var t = 0; t < this.inputs.length; t++) if (this.inputs[t].id === e) return this.inputs[t];
|
|
431
|
+
return !1;
|
|
432
|
+
}, WebMidi.prototype.getOutputById = function(e) {
|
|
433
|
+
if (!this.enabled) throw Error("WebMidi is not enabled.");
|
|
434
|
+
e = String(e);
|
|
435
|
+
for (var t = 0; t < this.outputs.length; t++) if (this.outputs[t].id === e) return this.outputs[t];
|
|
436
|
+
return !1;
|
|
437
|
+
}, WebMidi.prototype.getInputByName = function(e) {
|
|
438
|
+
if (!this.enabled) throw Error("WebMidi is not enabled.");
|
|
439
|
+
for (var t = 0; t < this.inputs.length; t++) if (~this.inputs[t].name.indexOf(e)) return this.inputs[t];
|
|
440
|
+
return !1;
|
|
441
|
+
}, WebMidi.prototype.getOctave = function(e) {
|
|
442
|
+
if (e != null && 0 <= e && e <= 127) return Math.floor(Math.floor(e) / 12 - 1) + Math.floor(n.octaveOffset);
|
|
443
|
+
}, WebMidi.prototype.getOutputByName = function(e) {
|
|
444
|
+
if (!this.enabled) throw Error("WebMidi is not enabled.");
|
|
445
|
+
for (var t = 0; t < this.outputs.length; t++) if (~this.outputs[t].name.indexOf(e)) return this.outputs[t];
|
|
446
|
+
return !1;
|
|
447
|
+
}, WebMidi.prototype.guessNoteNumber = function(e) {
|
|
448
|
+
var t = !1;
|
|
449
|
+
if (e && e.toFixed && 0 <= e && e <= 127 ? t = Math.round(e) : 0 <= parseInt(e) && parseInt(e) <= 127 ? t = parseInt(e) : (typeof e == "string" || e instanceof String) && (t = this.noteNameToNumber(e)), !1 === t) throw Error("Invalid input value (" + e + ").");
|
|
450
|
+
return t;
|
|
451
|
+
}, WebMidi.prototype.noteNameToNumber = function(e) {
|
|
452
|
+
typeof e != "string" && (e = "");
|
|
453
|
+
var t = e.match(/([CDEFGAB])(#{0,2}|b{0,2})(-?\d+)/i);
|
|
454
|
+
if (!t) throw RangeError("Invalid note name.");
|
|
455
|
+
var r = n._semitones[t[1].toUpperCase()], i = 12 * (parseInt(t[3]) + 1 - Math.floor(n.octaveOffset)) + r;
|
|
456
|
+
if (-1 < t[2].toLowerCase().indexOf("b") ? i -= t[2].length : -1 < t[2].toLowerCase().indexOf("#") && (i += t[2].length), i < 0 || 127 < i) throw RangeError("Invalid note name or note outside valid range.");
|
|
457
|
+
return i;
|
|
458
|
+
}, WebMidi.prototype._updateInputsAndOutputs = function() {
|
|
459
|
+
this._updateInputs(), this._updateOutputs();
|
|
460
|
+
}, WebMidi.prototype._updateInputs = function() {
|
|
461
|
+
for (var e = 0; e < this._inputs.length; e++) {
|
|
462
|
+
for (var t = !0, n = this.interface.inputs.values(), r = n.next(); r && !r.done; r = n.next()) if (this._inputs[e]._midiInput === r.value) {
|
|
463
|
+
t = !1;
|
|
464
|
+
break;
|
|
465
|
+
}
|
|
466
|
+
t && this._inputs.splice(e, 1);
|
|
467
|
+
}
|
|
468
|
+
this.interface && this.interface.inputs.forEach(function(e) {
|
|
469
|
+
for (var t = !0, n = 0; n < this._inputs.length; n++) this._inputs[n]._midiInput === e && (t = !1);
|
|
470
|
+
t && this._inputs.push(new Input(e));
|
|
471
|
+
}.bind(this));
|
|
472
|
+
}, WebMidi.prototype._updateOutputs = function() {
|
|
473
|
+
for (var e = 0; e < this._outputs.length; e++) {
|
|
474
|
+
for (var t = !0, n = this.interface.outputs.values(), r = n.next(); r && !r.done; r = n.next()) if (this._outputs[e]._midiOutput === r.value) {
|
|
475
|
+
t = !1;
|
|
476
|
+
break;
|
|
477
|
+
}
|
|
478
|
+
t && this._outputs.splice(e, 1);
|
|
479
|
+
}
|
|
480
|
+
this.interface && this.interface.outputs.forEach(function(e) {
|
|
481
|
+
for (var t = !0, n = 0; n < this._outputs.length; n++) this._outputs[n]._midiOutput === e && (t = !1);
|
|
482
|
+
t && this._outputs.push(new Output(e));
|
|
483
|
+
}.bind(this));
|
|
484
|
+
}, WebMidi.prototype._onInterfaceStateChange = function(e) {
|
|
485
|
+
this._updateInputsAndOutputs();
|
|
486
|
+
var t = {
|
|
487
|
+
timestamp: e.timeStamp,
|
|
488
|
+
type: e.port.state
|
|
489
|
+
};
|
|
490
|
+
this.interface && e.port.state === "connected" ? e.port.type === "output" ? t.port = this.getOutputById(e.port.id) : e.port.type === "input" && (t.port = this.getInputById(e.port.id)) : t.port = {
|
|
491
|
+
connection: "closed",
|
|
492
|
+
id: e.port.id,
|
|
493
|
+
manufacturer: e.port.manufacturer,
|
|
494
|
+
name: e.port.name,
|
|
495
|
+
state: e.port.state,
|
|
496
|
+
type: e.port.type
|
|
497
|
+
}, this._userHandlers[e.port.state].forEach(function(e) {
|
|
498
|
+
e(t);
|
|
499
|
+
});
|
|
500
|
+
}, WebMidi.prototype._resetInterfaceUserHandlers = function() {
|
|
501
|
+
for (var e = 0; e < this._midiInterfaceEvents.length; e++) this._userHandlers[this._midiInterfaceEvents[e]] = [];
|
|
502
|
+
}, Input.prototype.on = Input.prototype.addListener = function(e, t, r) {
|
|
503
|
+
var i = this;
|
|
504
|
+
if (t === void 0 && (t = "all"), Array.isArray(t) || (t = [t]), t.forEach(function(e) {
|
|
505
|
+
if (e !== "all" && !(1 <= e && e <= 16)) throw RangeError("The 'channel' parameter is invalid.");
|
|
506
|
+
}), typeof r != "function") throw TypeError("The 'listener' parameter must be a function.");
|
|
507
|
+
if (n.MIDI_SYSTEM_MESSAGES[e] !== void 0) this._userHandlers.system[e] || (this._userHandlers.system[e] = []), this._userHandlers.system[e].push(r);
|
|
508
|
+
else {
|
|
509
|
+
if (n.MIDI_CHANNEL_MESSAGES[e] === void 0) throw TypeError("The specified event type is not supported.");
|
|
510
|
+
if (-1 < t.indexOf("all")) {
|
|
511
|
+
t = [];
|
|
512
|
+
for (var a = 1; a <= 16; a++) t.push(a);
|
|
513
|
+
}
|
|
514
|
+
this._userHandlers.channel[e] || (this._userHandlers.channel[e] = []), t.forEach(function(t) {
|
|
515
|
+
i._userHandlers.channel[e][t] || (i._userHandlers.channel[e][t] = []), i._userHandlers.channel[e][t].push(r);
|
|
516
|
+
});
|
|
517
|
+
}
|
|
518
|
+
return this;
|
|
519
|
+
}, Input.prototype.hasListener = function(e, t, r) {
|
|
520
|
+
var i = this;
|
|
521
|
+
if (typeof r != "function") throw TypeError("The 'listener' parameter must be a function.");
|
|
522
|
+
if (t === void 0 && (t = "all"), t.constructor !== Array && (t = [t]), n.MIDI_SYSTEM_MESSAGES[e] !== void 0) {
|
|
523
|
+
for (var a = 0; a < this._userHandlers.system[e].length; a++) if (this._userHandlers.system[e][a] === r) return !0;
|
|
524
|
+
} else if (n.MIDI_CHANNEL_MESSAGES[e] !== void 0) {
|
|
525
|
+
if (-1 < t.indexOf("all")) {
|
|
526
|
+
t = [];
|
|
527
|
+
for (var o = 1; o <= 16; o++) t.push(o);
|
|
528
|
+
}
|
|
529
|
+
return !!this._userHandlers.channel[e] && t.every(function(t) {
|
|
530
|
+
var n = i._userHandlers.channel[e][t];
|
|
531
|
+
return n && -1 < n.indexOf(r);
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
return !1;
|
|
535
|
+
}, Input.prototype.removeListener = function(e, t, r) {
|
|
536
|
+
var i = this;
|
|
537
|
+
if (r !== void 0 && typeof r != "function") throw TypeError("The 'listener' parameter must be a function.");
|
|
538
|
+
if (t === void 0 && (t = "all"), t.constructor !== Array && (t = [t]), n.MIDI_SYSTEM_MESSAGES[e] !== void 0) if (r === void 0) this._userHandlers.system[e] = [];
|
|
539
|
+
else for (var a = 0; a < this._userHandlers.system[e].length; a++) this._userHandlers.system[e][a] === r && this._userHandlers.system[e].splice(a, 1);
|
|
540
|
+
else if (n.MIDI_CHANNEL_MESSAGES[e] !== void 0) {
|
|
541
|
+
if (-1 < t.indexOf("all")) {
|
|
542
|
+
t = [];
|
|
543
|
+
for (var o = 1; o <= 16; o++) t.push(o);
|
|
544
|
+
}
|
|
545
|
+
if (!this._userHandlers.channel[e]) return this;
|
|
546
|
+
t.forEach(function(t) {
|
|
547
|
+
var n = i._userHandlers.channel[e][t];
|
|
548
|
+
if (n) if (r === void 0) i._userHandlers.channel[e][t] = [];
|
|
549
|
+
else for (var a = 0; a < n.length; a++) n[a] === r && n.splice(a, 1);
|
|
550
|
+
});
|
|
551
|
+
} else {
|
|
552
|
+
if (e !== void 0) throw TypeError("The specified event type is not supported.");
|
|
553
|
+
this._initializeUserHandlers();
|
|
554
|
+
}
|
|
555
|
+
return this;
|
|
556
|
+
}, Input.prototype._initializeUserHandlers = function() {
|
|
557
|
+
for (var e in n.MIDI_CHANNEL_MESSAGES) Object.prototype.hasOwnProperty.call(n.MIDI_CHANNEL_MESSAGES, e) && (this._userHandlers.channel[e] = {});
|
|
558
|
+
for (var t in n.MIDI_SYSTEM_MESSAGES) Object.prototype.hasOwnProperty.call(n.MIDI_SYSTEM_MESSAGES, t) && (this._userHandlers.system[t] = []);
|
|
559
|
+
}, Input.prototype._onMidiMessage = function(e) {
|
|
560
|
+
if (0 < this._userHandlers.system.midimessage.length) {
|
|
561
|
+
var t = {
|
|
562
|
+
target: this,
|
|
563
|
+
data: e.data,
|
|
564
|
+
timestamp: e.timeStamp,
|
|
565
|
+
type: "midimessage"
|
|
566
|
+
};
|
|
567
|
+
this._userHandlers.system.midimessage.forEach(function(e) {
|
|
568
|
+
e(t);
|
|
569
|
+
});
|
|
570
|
+
}
|
|
571
|
+
e.data[0] < 240 ? (this._parseChannelEvent(e), this._parseNrpnEvent(e)) : e.data[0] <= 255 && this._parseSystemEvent(e);
|
|
572
|
+
}, Input.prototype._parseNrpnEvent = function(e) {
|
|
573
|
+
var t, r, i = e.data[0] >> 4, a = 15 & e.data[0], o = 1 + a;
|
|
574
|
+
if (1 < e.data.length && (t = e.data[1], r = 2 < e.data.length ? e.data[2] : void 0), n.nrpnEventsEnabled && i === n.MIDI_CHANNEL_MESSAGES.controlchange && (t >= n.MIDI_NRPN_MESSAGES.increment && t <= n.MIDI_NRPN_MESSAGES.parammsb || t === n.MIDI_NRPN_MESSAGES.entrymsb || t === n.MIDI_NRPN_MESSAGES.entrylsb)) {
|
|
575
|
+
var s = {
|
|
576
|
+
target: this,
|
|
577
|
+
type: "controlchange",
|
|
578
|
+
data: e.data,
|
|
579
|
+
timestamp: e.timeStamp,
|
|
580
|
+
channel: o,
|
|
581
|
+
controller: {
|
|
582
|
+
number: t,
|
|
583
|
+
name: this.getCcNameByNumber(t)
|
|
584
|
+
},
|
|
585
|
+
value: r
|
|
586
|
+
};
|
|
587
|
+
if (s.controller.number === n.MIDI_NRPN_MESSAGES.parammsb && s.value != n.MIDI_NRPN_MESSAGES.nullactiveparameter) n._nrpnBuffer[a] = [], n._nrpnBuffer[a][0] = s;
|
|
588
|
+
else if (n._nrpnBuffer[a].length === 1 && s.controller.number === n.MIDI_NRPN_MESSAGES.paramlsb) n._nrpnBuffer[a].push(s);
|
|
589
|
+
else if (n._nrpnBuffer[a].length !== 2 || s.controller.number !== n.MIDI_NRPN_MESSAGES.increment && s.controller.number !== n.MIDI_NRPN_MESSAGES.decrement && s.controller.number !== n.MIDI_NRPN_MESSAGES.entrymsb) if (n._nrpnBuffer[a].length === 3 && n._nrpnBuffer[a][2].number === n.MIDI_NRPN_MESSAGES.entrymsb && s.controller.number === n.MIDI_NRPN_MESSAGES.entrylsb) n._nrpnBuffer[a].push(s);
|
|
590
|
+
else if (3 <= n._nrpnBuffer[a].length && n._nrpnBuffer[a].length <= 4 && s.controller.number === n.MIDI_NRPN_MESSAGES.parammsb && s.value === n.MIDI_NRPN_MESSAGES.nullactiveparameter) n._nrpnBuffer[a].push(s);
|
|
591
|
+
else if (4 <= n._nrpnBuffer[a].length && n._nrpnBuffer[a].length <= 5 && s.controller.number === n.MIDI_NRPN_MESSAGES.paramlsb && s.value === n.MIDI_NRPN_MESSAGES.nullactiveparameter) {
|
|
592
|
+
n._nrpnBuffer[a].push(s);
|
|
593
|
+
var c = [];
|
|
594
|
+
n._nrpnBuffer[a].forEach(function(e) {
|
|
595
|
+
c.push(e.data);
|
|
596
|
+
});
|
|
597
|
+
var l = n._nrpnBuffer[a][0].value << 7 | n._nrpnBuffer[a][1].value, u = n._nrpnBuffer[a][2].value;
|
|
598
|
+
n._nrpnBuffer[a].length === 6 && (u = n._nrpnBuffer[a][2].value << 7 | n._nrpnBuffer[a][3].value);
|
|
599
|
+
var d = "";
|
|
600
|
+
switch (n._nrpnBuffer[a][2].controller.number) {
|
|
601
|
+
case n.MIDI_NRPN_MESSAGES.entrymsb:
|
|
602
|
+
d = n._nrpnTypes[0];
|
|
603
|
+
break;
|
|
604
|
+
case n.MIDI_NRPN_MESSAGES.increment:
|
|
605
|
+
d = n._nrpnTypes[1];
|
|
606
|
+
break;
|
|
607
|
+
case n.MIDI_NRPN_MESSAGES.decrement:
|
|
608
|
+
d = n._nrpnTypes[2];
|
|
609
|
+
break;
|
|
610
|
+
default: throw Error("The NPRN type was unidentifiable.");
|
|
611
|
+
}
|
|
612
|
+
var f = {
|
|
613
|
+
timestamp: s.timestamp,
|
|
614
|
+
channel: s.channel,
|
|
615
|
+
type: "nrpn",
|
|
616
|
+
data: c,
|
|
617
|
+
controller: {
|
|
618
|
+
number: l,
|
|
619
|
+
type: d,
|
|
620
|
+
name: "Non-Registered Parameter " + l
|
|
621
|
+
},
|
|
622
|
+
value: u
|
|
623
|
+
};
|
|
624
|
+
n._nrpnBuffer[a] = [], this._userHandlers.channel[f.type] && this._userHandlers.channel[f.type][f.channel] && this._userHandlers.channel[f.type][f.channel].forEach(function(e) {
|
|
625
|
+
e(f);
|
|
626
|
+
});
|
|
627
|
+
} else n._nrpnBuffer[a] = [];
|
|
628
|
+
else n._nrpnBuffer[a].push(s);
|
|
629
|
+
}
|
|
630
|
+
}, Input.prototype._parseChannelEvent = function(e) {
|
|
631
|
+
var t, r, i = e.data[0] >> 4, a = 1 + (15 & e.data[0]);
|
|
632
|
+
1 < e.data.length && (t = e.data[1], r = 2 < e.data.length ? e.data[2] : void 0);
|
|
633
|
+
var o = {
|
|
634
|
+
target: this,
|
|
635
|
+
data: e.data,
|
|
636
|
+
timestamp: e.timeStamp,
|
|
637
|
+
channel: a
|
|
638
|
+
};
|
|
639
|
+
i === n.MIDI_CHANNEL_MESSAGES.noteoff || i === n.MIDI_CHANNEL_MESSAGES.noteon && r === 0 ? (o.type = "noteoff", o.note = {
|
|
640
|
+
number: t,
|
|
641
|
+
name: n._notes[t % 12],
|
|
642
|
+
octave: n.getOctave(t)
|
|
643
|
+
}, o.velocity = r / 127, o.rawVelocity = r) : i === n.MIDI_CHANNEL_MESSAGES.noteon ? (o.type = "noteon", o.note = {
|
|
644
|
+
number: t,
|
|
645
|
+
name: n._notes[t % 12],
|
|
646
|
+
octave: n.getOctave(t)
|
|
647
|
+
}, o.velocity = r / 127, o.rawVelocity = r) : i === n.MIDI_CHANNEL_MESSAGES.keyaftertouch ? (o.type = "keyaftertouch", o.note = {
|
|
648
|
+
number: t,
|
|
649
|
+
name: n._notes[t % 12],
|
|
650
|
+
octave: n.getOctave(t)
|
|
651
|
+
}, o.value = r / 127) : i === n.MIDI_CHANNEL_MESSAGES.controlchange && 0 <= t && t <= 119 ? (o.type = "controlchange", o.controller = {
|
|
652
|
+
number: t,
|
|
653
|
+
name: this.getCcNameByNumber(t)
|
|
654
|
+
}, o.value = r) : i === n.MIDI_CHANNEL_MESSAGES.channelmode && 120 <= t && t <= 127 ? (o.type = "channelmode", o.controller = {
|
|
655
|
+
number: t,
|
|
656
|
+
name: this.getChannelModeByNumber(t)
|
|
657
|
+
}, o.value = r) : i === n.MIDI_CHANNEL_MESSAGES.programchange ? (o.type = "programchange", o.value = t) : i === n.MIDI_CHANNEL_MESSAGES.channelaftertouch ? (o.type = "channelaftertouch", o.value = t / 127) : i === n.MIDI_CHANNEL_MESSAGES.pitchbend ? (o.type = "pitchbend", o.value = ((r << 7) + t - 8192) / 8192) : o.type = "unknownchannelmessage", this._userHandlers.channel[o.type] && this._userHandlers.channel[o.type][a] && this._userHandlers.channel[o.type][a].forEach(function(e) {
|
|
658
|
+
e(o);
|
|
659
|
+
});
|
|
660
|
+
}, Input.prototype.getCcNameByNumber = function(e) {
|
|
661
|
+
if (!(0 <= (e = Math.floor(e)) && e <= 119)) throw RangeError("The control change number must be between 0 and 119.");
|
|
662
|
+
for (var t in n.MIDI_CONTROL_CHANGE_MESSAGES) if (Object.prototype.hasOwnProperty.call(n.MIDI_CONTROL_CHANGE_MESSAGES, t) && e === n.MIDI_CONTROL_CHANGE_MESSAGES[t]) return t;
|
|
663
|
+
}, Input.prototype.getChannelModeByNumber = function(e) {
|
|
664
|
+
if (!(120 <= (e = Math.floor(e)) && status <= 127)) throw RangeError("The control change number must be between 120 and 127.");
|
|
665
|
+
for (var t in n.MIDI_CHANNEL_MODE_MESSAGES) if (Object.prototype.hasOwnProperty.call(n.MIDI_CHANNEL_MODE_MESSAGES, t) && e === n.MIDI_CHANNEL_MODE_MESSAGES[t]) return t;
|
|
666
|
+
}, Input.prototype._parseSystemEvent = function(e) {
|
|
667
|
+
var t = e.data[0], r = {
|
|
668
|
+
target: this,
|
|
669
|
+
data: e.data,
|
|
670
|
+
timestamp: e.timeStamp
|
|
671
|
+
};
|
|
672
|
+
t === n.MIDI_SYSTEM_MESSAGES.sysex ? r.type = "sysex" : t === n.MIDI_SYSTEM_MESSAGES.timecode ? r.type = "timecode" : t === n.MIDI_SYSTEM_MESSAGES.songposition ? r.type = "songposition" : t === n.MIDI_SYSTEM_MESSAGES.songselect ? (r.type = "songselect", r.song = e.data[1]) : t === n.MIDI_SYSTEM_MESSAGES.tuningrequest ? r.type = "tuningrequest" : t === n.MIDI_SYSTEM_MESSAGES.clock ? r.type = "clock" : t === n.MIDI_SYSTEM_MESSAGES.start ? r.type = "start" : t === n.MIDI_SYSTEM_MESSAGES.continue ? r.type = "continue" : t === n.MIDI_SYSTEM_MESSAGES.stop ? r.type = "stop" : t === n.MIDI_SYSTEM_MESSAGES.activesensing ? r.type = "activesensing" : t === n.MIDI_SYSTEM_MESSAGES.reset ? r.type = "reset" : r.type = "unknownsystemmessage", this._userHandlers.system[r.type] && this._userHandlers.system[r.type].forEach(function(e) {
|
|
673
|
+
e(r);
|
|
674
|
+
});
|
|
675
|
+
}, Output.prototype.send = function(e, t, n) {
|
|
676
|
+
if (!(128 <= e && e <= 255)) throw RangeError("The status byte must be an integer between 128 (0x80) and 255 (0xFF).");
|
|
677
|
+
t === void 0 && (t = []), Array.isArray(t) || (t = [t]);
|
|
678
|
+
var r = [];
|
|
679
|
+
return t.forEach(function(e) {
|
|
680
|
+
var t = Math.floor(e);
|
|
681
|
+
if (!(0 <= t && t <= 255)) throw RangeError("Data bytes must be integers between 0 (0x00) and 255 (0xFF).");
|
|
682
|
+
r.push(t);
|
|
683
|
+
}), this._midiOutput.send([e].concat(r), parseFloat(n) || 0), this;
|
|
684
|
+
}, Output.prototype.sendSysex = function(e, t, r) {
|
|
685
|
+
if (!n.sysexEnabled) throw Error("Sysex message support must first be activated.");
|
|
686
|
+
return r ||= {}, e = [].concat(e), t.forEach(function(e) {
|
|
687
|
+
if (e < 0 || 127 < e) throw RangeError("The data bytes of a sysex message must be integers between 0 (0x00) and 127 (0x7F).");
|
|
688
|
+
}), t = e.concat(t, n.MIDI_SYSTEM_MESSAGES.sysexend), this.send(n.MIDI_SYSTEM_MESSAGES.sysex, t, this._parseTimeParameter(r.time)), this;
|
|
689
|
+
}, Output.prototype.sendTimecodeQuarterFrame = function(e, t) {
|
|
690
|
+
return t ||= {}, this.send(n.MIDI_SYSTEM_MESSAGES.timecode, e, this._parseTimeParameter(t.time)), this;
|
|
691
|
+
}, Output.prototype.sendSongPosition = function(e, t) {
|
|
692
|
+
t ||= {};
|
|
693
|
+
var r = (e = Math.floor(e) || 0) >> 7 & 127, i = 127 & e;
|
|
694
|
+
return this.send(n.MIDI_SYSTEM_MESSAGES.songposition, [r, i], this._parseTimeParameter(t.time)), this;
|
|
695
|
+
}, Output.prototype.sendSongSelect = function(e, t) {
|
|
696
|
+
if (t ||= {}, !(0 <= (e = Math.floor(e)) && e <= 127)) throw RangeError("The song number must be between 0 and 127.");
|
|
697
|
+
return this.send(n.MIDI_SYSTEM_MESSAGES.songselect, [e], this._parseTimeParameter(t.time)), this;
|
|
698
|
+
}, Output.prototype.sendTuningRequest = function(e) {
|
|
699
|
+
return e ||= {}, this.send(n.MIDI_SYSTEM_MESSAGES.tuningrequest, void 0, this._parseTimeParameter(e.time)), this;
|
|
700
|
+
}, Output.prototype.sendClock = function(e) {
|
|
701
|
+
return e ||= {}, this.send(n.MIDI_SYSTEM_MESSAGES.clock, void 0, this._parseTimeParameter(e.time)), this;
|
|
702
|
+
}, Output.prototype.sendStart = function(e) {
|
|
703
|
+
return e ||= {}, this.send(n.MIDI_SYSTEM_MESSAGES.start, void 0, this._parseTimeParameter(e.time)), this;
|
|
704
|
+
}, Output.prototype.sendContinue = function(e) {
|
|
705
|
+
return e ||= {}, this.send(n.MIDI_SYSTEM_MESSAGES.continue, void 0, this._parseTimeParameter(e.time)), this;
|
|
706
|
+
}, Output.prototype.sendStop = function(e) {
|
|
707
|
+
return e ||= {}, this.send(n.MIDI_SYSTEM_MESSAGES.stop, void 0, this._parseTimeParameter(e.time)), this;
|
|
708
|
+
}, Output.prototype.sendActiveSensing = function(e) {
|
|
709
|
+
return e ||= {}, this.send(n.MIDI_SYSTEM_MESSAGES.activesensing, [], this._parseTimeParameter(e.time)), this;
|
|
710
|
+
}, Output.prototype.sendReset = function(e) {
|
|
711
|
+
return e ||= {}, this.send(n.MIDI_SYSTEM_MESSAGES.reset, void 0, this._parseTimeParameter(e.time)), this;
|
|
712
|
+
}, Output.prototype.stopNote = function(e, t, r) {
|
|
713
|
+
if (e === "all") return this.sendChannelMode("allnotesoff", 0, t, r);
|
|
714
|
+
var i = 64;
|
|
715
|
+
return (r ||= {}).rawVelocity ? !isNaN(r.velocity) && 0 <= r.velocity && r.velocity <= 127 && (i = r.velocity) : !isNaN(r.velocity) && 0 <= r.velocity && r.velocity <= 1 && (i = 127 * r.velocity), this._convertNoteToArray(e).forEach(function(e) {
|
|
716
|
+
n.toMIDIChannels(t).forEach(function(t) {
|
|
717
|
+
this.send((n.MIDI_CHANNEL_MESSAGES.noteoff << 4) + (t - 1), [e, Math.round(i)], this._parseTimeParameter(r.time));
|
|
718
|
+
}.bind(this));
|
|
719
|
+
}.bind(this)), this;
|
|
720
|
+
}, Output.prototype.playNote = function(e, t, r) {
|
|
721
|
+
var i, a = 64;
|
|
722
|
+
if ((r ||= {}).rawVelocity ? !isNaN(r.velocity) && 0 <= r.velocity && r.velocity <= 127 && (a = r.velocity) : !isNaN(r.velocity) && 0 <= r.velocity && r.velocity <= 1 && (a = 127 * r.velocity), i = this._parseTimeParameter(r.time), this._convertNoteToArray(e).forEach(function(e) {
|
|
723
|
+
n.toMIDIChannels(t).forEach(function(t) {
|
|
724
|
+
this.send((n.MIDI_CHANNEL_MESSAGES.noteon << 4) + (t - 1), [e, Math.round(a)], i);
|
|
725
|
+
}.bind(this));
|
|
726
|
+
}.bind(this)), !isNaN(r.duration)) {
|
|
727
|
+
r.duration <= 0 && (r.duration = 0);
|
|
728
|
+
var o = 64;
|
|
729
|
+
r.rawVelocity ? !isNaN(r.release) && 0 <= r.release && r.release <= 127 && (o = r.release) : !isNaN(r.release) && 0 <= r.release && r.release <= 1 && (o = 127 * r.release), this._convertNoteToArray(e).forEach(function(e) {
|
|
730
|
+
n.toMIDIChannels(t).forEach(function(t) {
|
|
731
|
+
this.send((n.MIDI_CHANNEL_MESSAGES.noteoff << 4) + (t - 1), [e, Math.round(o)], (i || n.time) + r.duration);
|
|
732
|
+
}.bind(this));
|
|
733
|
+
}.bind(this));
|
|
734
|
+
}
|
|
735
|
+
return this;
|
|
736
|
+
}, Output.prototype.sendKeyAftertouch = function(e, t, r, i) {
|
|
737
|
+
var a = this;
|
|
738
|
+
if (i ||= {}, t < 1 || 16 < t) throw RangeError("The channel must be between 1 and 16.");
|
|
739
|
+
(isNaN(r) || r < 0 || 1 < r) && (r = .5);
|
|
740
|
+
var o = Math.round(127 * r);
|
|
741
|
+
return this._convertNoteToArray(e).forEach(function(e) {
|
|
742
|
+
n.toMIDIChannels(t).forEach(function(t) {
|
|
743
|
+
a.send((n.MIDI_CHANNEL_MESSAGES.keyaftertouch << 4) + (t - 1), [e, o], a._parseTimeParameter(i.time));
|
|
744
|
+
});
|
|
745
|
+
}), this;
|
|
746
|
+
}, Output.prototype.sendControlChange = function(e, t, r, i) {
|
|
747
|
+
if (i ||= {}, typeof e == "string") {
|
|
748
|
+
if ((e = n.MIDI_CONTROL_CHANGE_MESSAGES[e]) === void 0) throw TypeError("Invalid controller name.");
|
|
749
|
+
} else if (!(0 <= (e = Math.floor(e)) && e <= 119)) throw RangeError("Controller numbers must be between 0 and 119.");
|
|
750
|
+
if (!(0 <= (t = Math.floor(t) || 0) && t <= 127)) throw RangeError("Controller value must be between 0 and 127.");
|
|
751
|
+
return n.toMIDIChannels(r).forEach(function(r) {
|
|
752
|
+
this.send((n.MIDI_CHANNEL_MESSAGES.controlchange << 4) + (r - 1), [e, t], this._parseTimeParameter(i.time));
|
|
753
|
+
}.bind(this)), this;
|
|
754
|
+
}, Output.prototype._selectRegisteredParameter = function(e, t, r) {
|
|
755
|
+
var i = this;
|
|
756
|
+
if (e[0] = Math.floor(e[0]), !(0 <= e[0] && e[0] <= 127)) throw RangeError("The control65 value must be between 0 and 127");
|
|
757
|
+
if (e[1] = Math.floor(e[1]), !(0 <= e[1] && e[1] <= 127)) throw RangeError("The control64 value must be between 0 and 127");
|
|
758
|
+
return n.toMIDIChannels(t).forEach(function() {
|
|
759
|
+
i.sendControlChange(101, e[0], t, { time: r }), i.sendControlChange(100, e[1], t, { time: r });
|
|
760
|
+
}), this;
|
|
761
|
+
}, Output.prototype._selectNonRegisteredParameter = function(e, t, r) {
|
|
762
|
+
var i = this;
|
|
763
|
+
if (e[0] = Math.floor(e[0]), !(0 <= e[0] && e[0] <= 127)) throw RangeError("The control63 value must be between 0 and 127");
|
|
764
|
+
if (e[1] = Math.floor(e[1]), !(0 <= e[1] && e[1] <= 127)) throw RangeError("The control62 value must be between 0 and 127");
|
|
765
|
+
return n.toMIDIChannels(t).forEach(function() {
|
|
766
|
+
i.sendControlChange(99, e[0], t, { time: r }), i.sendControlChange(98, e[1], t, { time: r });
|
|
767
|
+
}), this;
|
|
768
|
+
}, Output.prototype._setCurrentRegisteredParameter = function(e, t, r) {
|
|
769
|
+
var i = this;
|
|
770
|
+
if ((e = [].concat(e))[0] = Math.floor(e[0]), !(0 <= e[0] && e[0] <= 127)) throw RangeError("The msb value must be between 0 and 127");
|
|
771
|
+
return n.toMIDIChannels(t).forEach(function() {
|
|
772
|
+
i.sendControlChange(6, e[0], t, { time: r });
|
|
773
|
+
}), e[1] = Math.floor(e[1]), 0 <= e[1] && e[1] <= 127 && n.toMIDIChannels(t).forEach(function() {
|
|
774
|
+
i.sendControlChange(38, e[1], t, { time: r });
|
|
775
|
+
}), this;
|
|
776
|
+
}, Output.prototype._deselectRegisteredParameter = function(e, t) {
|
|
777
|
+
var r = this;
|
|
778
|
+
return n.toMIDIChannels(e).forEach(function() {
|
|
779
|
+
r.sendControlChange(101, 127, e, { time: t }), r.sendControlChange(100, 127, e, { time: t });
|
|
780
|
+
}), this;
|
|
781
|
+
}, Output.prototype.setRegisteredParameter = function(e, t, r, i) {
|
|
782
|
+
var a = this;
|
|
783
|
+
if (i ||= {}, !Array.isArray(e)) {
|
|
784
|
+
if (!n.MIDI_REGISTERED_PARAMETER[e]) throw Error("The specified parameter is not available.");
|
|
785
|
+
e = n.MIDI_REGISTERED_PARAMETER[e];
|
|
786
|
+
}
|
|
787
|
+
return n.toMIDIChannels(r).forEach(function() {
|
|
788
|
+
a._selectRegisteredParameter(e, r, i.time), a._setCurrentRegisteredParameter(t, r, i.time), a._deselectRegisteredParameter(r, i.time);
|
|
789
|
+
}), this;
|
|
790
|
+
}, Output.prototype.setNonRegisteredParameter = function(e, t, r, i) {
|
|
791
|
+
var a = this;
|
|
792
|
+
if (i ||= {}, !(0 <= e[0] && e[0] <= 127 && 0 <= e[1] && e[1] <= 127)) throw Error("Position 0 and 1 of the 2-position parameter array must both be between 0 and 127.");
|
|
793
|
+
return t = [].concat(t), n.toMIDIChannels(r).forEach(function() {
|
|
794
|
+
a._selectNonRegisteredParameter(e, r, i.time), a._setCurrentRegisteredParameter(t, r, i.time), a._deselectRegisteredParameter(r, i.time);
|
|
795
|
+
}), this;
|
|
796
|
+
}, Output.prototype.incrementRegisteredParameter = function(e, t, r) {
|
|
797
|
+
var i = this;
|
|
798
|
+
if (r ||= {}, !Array.isArray(e)) {
|
|
799
|
+
if (!n.MIDI_REGISTERED_PARAMETER[e]) throw Error("The specified parameter is not available.");
|
|
800
|
+
e = n.MIDI_REGISTERED_PARAMETER[e];
|
|
801
|
+
}
|
|
802
|
+
return n.toMIDIChannels(t).forEach(function() {
|
|
803
|
+
i._selectRegisteredParameter(e, t, r.time), i.sendControlChange(96, 0, t, { time: r.time }), i._deselectRegisteredParameter(t, r.time);
|
|
804
|
+
}), this;
|
|
805
|
+
}, Output.prototype.decrementRegisteredParameter = function(e, t, r) {
|
|
806
|
+
if (r ||= {}, !Array.isArray(e)) {
|
|
807
|
+
if (!n.MIDI_REGISTERED_PARAMETER[e]) throw TypeError("The specified parameter is not available.");
|
|
808
|
+
e = n.MIDI_REGISTERED_PARAMETER[e];
|
|
809
|
+
}
|
|
810
|
+
return n.toMIDIChannels(t).forEach(function() {
|
|
811
|
+
this._selectRegisteredParameter(e, t, r.time), this.sendControlChange(97, 0, t, { time: r.time }), this._deselectRegisteredParameter(t, r.time);
|
|
812
|
+
}.bind(this)), this;
|
|
813
|
+
}, Output.prototype.setPitchBendRange = function(e, t, r, i) {
|
|
814
|
+
var a = this;
|
|
815
|
+
if (i ||= {}, !(0 <= (e = Math.floor(e) || 0) && e <= 127)) throw RangeError("The semitones value must be between 0 and 127");
|
|
816
|
+
if (!(0 <= (t = Math.floor(t) || 0) && t <= 127)) throw RangeError("The cents value must be between 0 and 127");
|
|
817
|
+
return n.toMIDIChannels(r).forEach(function() {
|
|
818
|
+
a.setRegisteredParameter("pitchbendrange", [e, t], r, { time: i.time });
|
|
819
|
+
}), this;
|
|
820
|
+
}, Output.prototype.setModulationRange = function(e, t, r, i) {
|
|
821
|
+
var a = this;
|
|
822
|
+
if (i ||= {}, !(0 <= (e = Math.floor(e) || 0) && e <= 127)) throw RangeError("The semitones value must be between 0 and 127");
|
|
823
|
+
if (!(0 <= (t = Math.floor(t) || 0) && t <= 127)) throw RangeError("The cents value must be between 0 and 127");
|
|
824
|
+
return n.toMIDIChannels(r).forEach(function() {
|
|
825
|
+
a.setRegisteredParameter("modulationrange", [e, t], r, { time: i.time });
|
|
826
|
+
}), this;
|
|
827
|
+
}, Output.prototype.setMasterTuning = function(e, t, r) {
|
|
828
|
+
var i = this;
|
|
829
|
+
if (r ||= {}, (e = parseFloat(e) || 0) <= -65 || 64 <= e) throw RangeError("The value must be a decimal number larger than -65 and smaller than 64.");
|
|
830
|
+
var a = Math.floor(e) + 64, o = e - Math.floor(e), s = (o = Math.round((o + 1) / 2 * 16383)) >> 7 & 127, c = 127 & o;
|
|
831
|
+
return n.toMIDIChannels(t).forEach(function() {
|
|
832
|
+
i.setRegisteredParameter("channelcoarsetuning", a, t, { time: r.time }), i.setRegisteredParameter("channelfinetuning", [s, c], t, { time: r.time });
|
|
833
|
+
}), this;
|
|
834
|
+
}, Output.prototype.setTuningProgram = function(e, t, r) {
|
|
835
|
+
var i = this;
|
|
836
|
+
if (r ||= {}, !(0 <= (e = Math.floor(e)) && e <= 127)) throw RangeError("The program value must be between 0 and 127");
|
|
837
|
+
return n.toMIDIChannels(t).forEach(function() {
|
|
838
|
+
i.setRegisteredParameter("tuningprogram", e, t, { time: r.time });
|
|
839
|
+
}), this;
|
|
840
|
+
}, Output.prototype.setTuningBank = function(e, t, r) {
|
|
841
|
+
var i = this;
|
|
842
|
+
if (r ||= {}, !(0 <= (e = Math.floor(e) || 0) && e <= 127)) throw RangeError("The bank value must be between 0 and 127");
|
|
843
|
+
return n.toMIDIChannels(t).forEach(function() {
|
|
844
|
+
i.setRegisteredParameter("tuningbank", e, t, { time: r.time });
|
|
845
|
+
}), this;
|
|
846
|
+
}, Output.prototype.sendChannelMode = function(e, t, r, i) {
|
|
847
|
+
if (i ||= {}, typeof e == "string") {
|
|
848
|
+
if (!(e = n.MIDI_CHANNEL_MODE_MESSAGES[e])) throw TypeError("Invalid channel mode message name.");
|
|
849
|
+
} else if (!(120 <= (e = Math.floor(e)) && e <= 127)) throw RangeError("Channel mode numerical identifiers must be between 120 and 127.");
|
|
850
|
+
if ((t = Math.floor(t) || 0) < 0 || 127 < t) throw RangeError("Value must be an integer between 0 and 127.");
|
|
851
|
+
return n.toMIDIChannels(r).forEach(function(r) {
|
|
852
|
+
this.send((n.MIDI_CHANNEL_MESSAGES.channelmode << 4) + (r - 1), [e, t], this._parseTimeParameter(i.time));
|
|
853
|
+
}.bind(this)), this;
|
|
854
|
+
}, Output.prototype.sendProgramChange = function(e, t, r) {
|
|
855
|
+
var i = this;
|
|
856
|
+
if (r ||= {}, e = Math.floor(e), isNaN(e) || e < 0 || 127 < e) throw RangeError("Program numbers must be between 0 and 127.");
|
|
857
|
+
return n.toMIDIChannels(t).forEach(function(t) {
|
|
858
|
+
i.send((n.MIDI_CHANNEL_MESSAGES.programchange << 4) + (t - 1), [e], i._parseTimeParameter(r.time));
|
|
859
|
+
}), this;
|
|
860
|
+
}, Output.prototype.sendChannelAftertouch = function(e, t, r) {
|
|
861
|
+
var i = this;
|
|
862
|
+
r ||= {}, e = parseFloat(e), (isNaN(e) || e < 0 || 1 < e) && (e = .5);
|
|
863
|
+
var a = Math.round(127 * e);
|
|
864
|
+
return n.toMIDIChannels(t).forEach(function(e) {
|
|
865
|
+
i.send((n.MIDI_CHANNEL_MESSAGES.channelaftertouch << 4) + (e - 1), [a], i._parseTimeParameter(r.time));
|
|
866
|
+
}), this;
|
|
867
|
+
}, Output.prototype.sendPitchBend = function(e, t, r) {
|
|
868
|
+
var i = this;
|
|
869
|
+
if (r ||= {}, isNaN(e) || e < -1 || 1 < e) throw RangeError("Pitch bend value must be between -1 and 1.");
|
|
870
|
+
var a = Math.round((e + 1) / 2 * 16383), o = a >> 7 & 127, s = 127 & a;
|
|
871
|
+
return n.toMIDIChannels(t).forEach(function(e) {
|
|
872
|
+
i.send((n.MIDI_CHANNEL_MESSAGES.pitchbend << 4) + (e - 1), [s, o], i._parseTimeParameter(r.time));
|
|
873
|
+
}), this;
|
|
874
|
+
}, Output.prototype._parseTimeParameter = function(e) {
|
|
875
|
+
var t, r = parseFloat(e);
|
|
876
|
+
return typeof e == "string" && e.substring(0, 1) === "+" ? r && 0 < r && (t = n.time + r) : r > n.time && (t = r), t;
|
|
877
|
+
}, Output.prototype._convertNoteToArray = function(e) {
|
|
878
|
+
var t = [];
|
|
879
|
+
return Array.isArray(e) || (e = [e]), e.forEach(function(e) {
|
|
880
|
+
t.push(n.guessNoteNumber(e));
|
|
881
|
+
}), t;
|
|
882
|
+
}, typeof define == "function" && typeof define.amd == "object" ? define([], function() {
|
|
883
|
+
return n;
|
|
884
|
+
}) : t !== void 0 && t.exports ? t.exports = n : e.WebMidi ||= n;
|
|
885
|
+
})(e);
|
|
886
|
+
})), fillStr = (e, t) => Array(Math.abs(t) + 1).join(e);
|
|
887
|
+
function isNamed(e) {
|
|
888
|
+
return !!(typeof e == "object" && e && typeof e.name == "string");
|
|
889
|
+
}
|
|
890
|
+
function isPitch(e) {
|
|
891
|
+
return !!(typeof e == "object" && e && typeof e.step == "number" && typeof e.alt == "number");
|
|
892
|
+
}
|
|
893
|
+
var j = [
|
|
894
|
+
0,
|
|
895
|
+
2,
|
|
896
|
+
4,
|
|
897
|
+
-1,
|
|
898
|
+
1,
|
|
899
|
+
3,
|
|
900
|
+
5
|
|
901
|
+
], ne = j.map((e) => Math.floor(e * 7 / 12));
|
|
902
|
+
function encode(e) {
|
|
903
|
+
let { step: t, alt: n, oct: r, dir: i = 1 } = e, a = j[t] + 7 * n;
|
|
904
|
+
if (r === void 0) return [i * a];
|
|
905
|
+
let o = r - ne[t] - 4 * n;
|
|
906
|
+
return [i * a, i * o];
|
|
907
|
+
}
|
|
908
|
+
var re = [
|
|
909
|
+
3,
|
|
910
|
+
0,
|
|
911
|
+
4,
|
|
912
|
+
1,
|
|
913
|
+
5,
|
|
914
|
+
2,
|
|
915
|
+
6
|
|
916
|
+
];
|
|
917
|
+
function decode(e) {
|
|
918
|
+
let [t, n, r] = e, i = re[unaltered(t)], a = Math.floor((t + 1) / 7);
|
|
919
|
+
return n === void 0 ? {
|
|
920
|
+
step: i,
|
|
921
|
+
alt: a,
|
|
922
|
+
dir: r
|
|
923
|
+
} : {
|
|
924
|
+
step: i,
|
|
925
|
+
alt: a,
|
|
926
|
+
oct: n + 4 * a + ne[i],
|
|
927
|
+
dir: r
|
|
928
|
+
};
|
|
929
|
+
}
|
|
930
|
+
function unaltered(e) {
|
|
931
|
+
let t = (e + 1) % 7;
|
|
932
|
+
return t < 0 ? 7 + t : t;
|
|
933
|
+
}
|
|
934
|
+
var ie = {
|
|
935
|
+
empty: !0,
|
|
936
|
+
name: "",
|
|
937
|
+
pc: "",
|
|
938
|
+
acc: ""
|
|
939
|
+
}, M = /* @__PURE__ */ new Map(), stepToLetter = (e) => "CDEFGAB".charAt(e), altToAcc = (e) => e < 0 ? fillStr("b", -e) : fillStr("#", e), accToAlt = (e) => e[0] === "b" ? -e.length : e.length;
|
|
940
|
+
function note(e) {
|
|
941
|
+
let t = M.get(e);
|
|
942
|
+
if (t) return t;
|
|
943
|
+
let n = typeof e == "string" ? parse$1(e) : isPitch(e) ? note(pitchName(e)) : isNamed(e) ? note(e.name) : ie;
|
|
944
|
+
return M.set(e, n), n;
|
|
945
|
+
}
|
|
946
|
+
var ae = /^([a-gA-G]?)(#{1,}|b{1,}|x{1,}|)(-?\d*)\s*(.*)$/;
|
|
947
|
+
function tokenizeNote(e) {
|
|
948
|
+
let t = ae.exec(e);
|
|
949
|
+
return [
|
|
950
|
+
t[1].toUpperCase(),
|
|
951
|
+
t[2].replace(/x/g, "##"),
|
|
952
|
+
t[3],
|
|
953
|
+
t[4]
|
|
954
|
+
];
|
|
955
|
+
}
|
|
956
|
+
function coordToNote(e) {
|
|
957
|
+
return note(decode(e));
|
|
958
|
+
}
|
|
959
|
+
var mod = (e, t) => (e % t + t) % t, N = [
|
|
960
|
+
0,
|
|
961
|
+
2,
|
|
962
|
+
4,
|
|
963
|
+
5,
|
|
964
|
+
7,
|
|
965
|
+
9,
|
|
966
|
+
11
|
|
967
|
+
];
|
|
968
|
+
function parse$1(e) {
|
|
969
|
+
let t = tokenizeNote(e);
|
|
970
|
+
if (t[0] === "" || t[3] !== "") return ie;
|
|
971
|
+
let n = t[0], r = t[1], i = t[2], a = (n.charCodeAt(0) + 3) % 7, o = accToAlt(r), s = i.length ? +i : void 0, c = encode({
|
|
972
|
+
step: a,
|
|
973
|
+
alt: o,
|
|
974
|
+
oct: s
|
|
975
|
+
}), l = n + r + i, u = n + r, d = (N[a] + o + 120) % 12, f = s === void 0 ? mod(N[a] + o, 12) - 1188 : N[a] + o + 12 * (s + 1), p = f >= 0 && f <= 127 ? f : null;
|
|
976
|
+
return {
|
|
977
|
+
empty: !1,
|
|
978
|
+
acc: r,
|
|
979
|
+
alt: o,
|
|
980
|
+
chroma: d,
|
|
981
|
+
coord: c,
|
|
982
|
+
freq: s === void 0 ? null : 2 ** ((f - 69) / 12) * 440,
|
|
983
|
+
height: f,
|
|
984
|
+
letter: n,
|
|
985
|
+
midi: p,
|
|
986
|
+
name: l,
|
|
987
|
+
oct: s,
|
|
988
|
+
pc: u,
|
|
989
|
+
step: a
|
|
990
|
+
};
|
|
991
|
+
}
|
|
992
|
+
n(parse$1, "parse");
|
|
993
|
+
function pitchName(e) {
|
|
994
|
+
let { step: t, alt: n, oct: r } = e, i = stepToLetter(t);
|
|
995
|
+
if (!i) return "";
|
|
996
|
+
let a = i + altToAcc(n);
|
|
997
|
+
return r || r === 0 ? a + r : a;
|
|
998
|
+
}
|
|
999
|
+
var P = {
|
|
1000
|
+
empty: !0,
|
|
1001
|
+
name: "",
|
|
1002
|
+
acc: ""
|
|
1003
|
+
}, oe = /* @__PURE__ */ RegExp("^([-+]?\\d+)(d{1,4}|m|M|P|A{1,4})|(AA|A|P|M|m|d|dd)([-+]?\\d+)$");
|
|
1004
|
+
function tokenizeInterval(e) {
|
|
1005
|
+
let t = oe.exec(`${e}`);
|
|
1006
|
+
return t === null ? ["", ""] : t[1] ? [t[1], t[2]] : [t[4], t[3]];
|
|
1007
|
+
}
|
|
1008
|
+
var F = {};
|
|
1009
|
+
function interval(e) {
|
|
1010
|
+
return typeof e == "string" ? F[e] || (F[e] = parse$1$1(e)) : isPitch(e) ? interval(pitchName$1(e)) : isNamed(e) ? interval(e.name) : P;
|
|
1011
|
+
}
|
|
1012
|
+
var I = [
|
|
1013
|
+
0,
|
|
1014
|
+
2,
|
|
1015
|
+
4,
|
|
1016
|
+
5,
|
|
1017
|
+
7,
|
|
1018
|
+
9,
|
|
1019
|
+
11
|
|
1020
|
+
], L = "PMMPPMM";
|
|
1021
|
+
function parse$1$1(e) {
|
|
1022
|
+
let t = tokenizeInterval(e);
|
|
1023
|
+
if (t[0] === "") return P;
|
|
1024
|
+
let n = +t[0], r = t[1], i = (Math.abs(n) - 1) % 7, a = L[i];
|
|
1025
|
+
if (a === "M" && r === "P") return P;
|
|
1026
|
+
let o = a === "M" ? "majorable" : "perfectable", s = "" + n + r, c = n < 0 ? -1 : 1, l = n === 8 || n === -8 ? n : c * (i + 1), u = qToAlt(o, r), d = Math.floor((Math.abs(n) - 1) / 7);
|
|
1027
|
+
return {
|
|
1028
|
+
empty: !1,
|
|
1029
|
+
name: s,
|
|
1030
|
+
num: n,
|
|
1031
|
+
q: r,
|
|
1032
|
+
step: i,
|
|
1033
|
+
alt: u,
|
|
1034
|
+
dir: c,
|
|
1035
|
+
type: o,
|
|
1036
|
+
simple: l,
|
|
1037
|
+
semitones: c * (I[i] + u + 12 * d),
|
|
1038
|
+
chroma: (c * (I[i] + u) % 12 + 12) % 12,
|
|
1039
|
+
coord: encode({
|
|
1040
|
+
step: i,
|
|
1041
|
+
alt: u,
|
|
1042
|
+
oct: d,
|
|
1043
|
+
dir: c
|
|
1044
|
+
}),
|
|
1045
|
+
oct: d
|
|
1046
|
+
};
|
|
1047
|
+
}
|
|
1048
|
+
n(parse$1$1, "parse$1");
|
|
1049
|
+
function coordToInterval(e) {
|
|
1050
|
+
let [t, n = 0] = e;
|
|
1051
|
+
return interval(decode(t * 7 + n * 12 < 0 ? [
|
|
1052
|
+
-t,
|
|
1053
|
+
-n,
|
|
1054
|
+
-1
|
|
1055
|
+
] : [
|
|
1056
|
+
t,
|
|
1057
|
+
n,
|
|
1058
|
+
1
|
|
1059
|
+
]));
|
|
1060
|
+
}
|
|
1061
|
+
function qToAlt(e, t) {
|
|
1062
|
+
return t === "M" && e === "majorable" || t === "P" && e === "perfectable" ? 0 : t === "m" && e === "majorable" ? -1 : /^A+$/.test(t) ? t.length : /^d+$/.test(t) ? -1 * (e === "perfectable" ? t.length : t.length + 1) : 0;
|
|
1063
|
+
}
|
|
1064
|
+
function pitchName$1(e) {
|
|
1065
|
+
let { step: t, alt: n, oct: r = 0, dir: i } = e;
|
|
1066
|
+
if (!i) return "";
|
|
1067
|
+
let a = t + 1 + 7 * r, o = i < 0 ? "-" : "", s = L[t] === "M" ? "majorable" : "perfectable";
|
|
1068
|
+
return o + a + altToQ(s, n);
|
|
1069
|
+
}
|
|
1070
|
+
function altToQ(e, t) {
|
|
1071
|
+
return t === 0 ? e === "majorable" ? "M" : "P" : t === -1 && e === "majorable" ? "m" : t > 0 ? fillStr("A", t) : fillStr("d", e === "perfectable" ? t : t + 1);
|
|
1072
|
+
}
|
|
1073
|
+
function transpose$2(e, t) {
|
|
1074
|
+
let n = note(e), r = interval(t);
|
|
1075
|
+
if (n.empty || r.empty) return "";
|
|
1076
|
+
let i = n.coord, a = r.coord;
|
|
1077
|
+
return coordToNote(i.length === 1 ? [i[0] + a[0]] : [i[0] + a[0], i[1] + a[1]]).name;
|
|
1078
|
+
}
|
|
1079
|
+
n(transpose$2, "transpose");
|
|
1080
|
+
function distance$1(e, t) {
|
|
1081
|
+
let n = note(e), r = note(t);
|
|
1082
|
+
if (n.empty || r.empty) return "";
|
|
1083
|
+
let i = n.coord, a = r.coord, o = a[0] - i[0];
|
|
1084
|
+
return coordToInterval([o, i.length === 2 && a.length === 2 ? a[1] - i[1] : -Math.floor(o * 7 / 12)]).name;
|
|
1085
|
+
}
|
|
1086
|
+
n(distance$1, "distance");
|
|
1087
|
+
//#endregion
|
|
1088
|
+
//#region ../../node_modules/@tonaljs/collection/dist/index.es.js
|
|
1089
|
+
function rotate(e, t) {
|
|
1090
|
+
let n = t.length, r = (e % n + n) % n;
|
|
1091
|
+
return t.slice(r, n).concat(t.slice(0, r));
|
|
1092
|
+
}
|
|
1093
|
+
//#endregion
|
|
1094
|
+
//#region ../../node_modules/@tonaljs/pcset/dist/index.es.js
|
|
1095
|
+
var R = {
|
|
1096
|
+
empty: !0,
|
|
1097
|
+
name: "",
|
|
1098
|
+
setNum: 0,
|
|
1099
|
+
chroma: "000000000000",
|
|
1100
|
+
normalized: "000000000000",
|
|
1101
|
+
intervals: []
|
|
1102
|
+
}, setNumToChroma = (e) => Number(e).toString(2), chromaToNumber = (e) => parseInt(e, 2), se = /^[01]{12}$/;
|
|
1103
|
+
function isChroma(e) {
|
|
1104
|
+
return se.test(e);
|
|
1105
|
+
}
|
|
1106
|
+
var isPcsetNum = (e) => typeof e == "number" && e >= 0 && e <= 4095, isPcset = (e) => e && isChroma(e.chroma), z = { [R.chroma]: R };
|
|
1107
|
+
function get$8(e) {
|
|
1108
|
+
let t = isChroma(e) ? e : isPcsetNum(e) ? setNumToChroma(e) : Array.isArray(e) ? listToChroma(e) : isPcset(e) ? e.chroma : R.chroma;
|
|
1109
|
+
return z[t] = z[t] || chromaToPcset(t);
|
|
1110
|
+
}
|
|
1111
|
+
n(get$8, "get");
|
|
1112
|
+
var ce = [
|
|
1113
|
+
"1P",
|
|
1114
|
+
"2m",
|
|
1115
|
+
"2M",
|
|
1116
|
+
"3m",
|
|
1117
|
+
"3M",
|
|
1118
|
+
"4P",
|
|
1119
|
+
"5d",
|
|
1120
|
+
"5P",
|
|
1121
|
+
"6m",
|
|
1122
|
+
"6M",
|
|
1123
|
+
"7m",
|
|
1124
|
+
"7M"
|
|
1125
|
+
];
|
|
1126
|
+
function chromaToIntervals(e) {
|
|
1127
|
+
let t = [];
|
|
1128
|
+
for (let n = 0; n < 12; n++) e.charAt(n) === "1" && t.push(ce[n]);
|
|
1129
|
+
return t;
|
|
1130
|
+
}
|
|
1131
|
+
function chromaRotations(e) {
|
|
1132
|
+
let t = e.split("");
|
|
1133
|
+
return t.map((e, n) => rotate(n, t).join(""));
|
|
1134
|
+
}
|
|
1135
|
+
function chromaToPcset(e) {
|
|
1136
|
+
let t = chromaToNumber(e), n = chromaRotations(e).map(chromaToNumber).filter((e) => e >= 2048).sort()[0];
|
|
1137
|
+
return {
|
|
1138
|
+
empty: !1,
|
|
1139
|
+
name: "",
|
|
1140
|
+
setNum: t,
|
|
1141
|
+
chroma: e,
|
|
1142
|
+
normalized: setNumToChroma(n),
|
|
1143
|
+
intervals: chromaToIntervals(e)
|
|
1144
|
+
};
|
|
1145
|
+
}
|
|
1146
|
+
function listToChroma(e) {
|
|
1147
|
+
if (e.length === 0) return R.chroma;
|
|
1148
|
+
let t, n = [
|
|
1149
|
+
0,
|
|
1150
|
+
0,
|
|
1151
|
+
0,
|
|
1152
|
+
0,
|
|
1153
|
+
0,
|
|
1154
|
+
0,
|
|
1155
|
+
0,
|
|
1156
|
+
0,
|
|
1157
|
+
0,
|
|
1158
|
+
0,
|
|
1159
|
+
0,
|
|
1160
|
+
0
|
|
1161
|
+
];
|
|
1162
|
+
for (let r = 0; r < e.length; r++) t = note(e[r]), t.empty && (t = interval(e[r])), t.empty || (n[t.chroma] = 1);
|
|
1163
|
+
return n.join("");
|
|
1164
|
+
}
|
|
1165
|
+
//#endregion
|
|
1166
|
+
//#region ../../node_modules/@tonaljs/chord-type/dist/index.es.js
|
|
1167
|
+
var le = [
|
|
1168
|
+
[
|
|
1169
|
+
"1P 3M 5P",
|
|
1170
|
+
"major",
|
|
1171
|
+
"M ^ "
|
|
1172
|
+
],
|
|
1173
|
+
[
|
|
1174
|
+
"1P 3M 5P 7M",
|
|
1175
|
+
"major seventh",
|
|
1176
|
+
"maj7 Δ ma7 M7 Maj7 ^7"
|
|
1177
|
+
],
|
|
1178
|
+
[
|
|
1179
|
+
"1P 3M 5P 7M 9M",
|
|
1180
|
+
"major ninth",
|
|
1181
|
+
"maj9 Δ9 ^9"
|
|
1182
|
+
],
|
|
1183
|
+
[
|
|
1184
|
+
"1P 3M 5P 7M 9M 13M",
|
|
1185
|
+
"major thirteenth",
|
|
1186
|
+
"maj13 Maj13 ^13"
|
|
1187
|
+
],
|
|
1188
|
+
[
|
|
1189
|
+
"1P 3M 5P 6M",
|
|
1190
|
+
"sixth",
|
|
1191
|
+
"6 add6 add13 M6"
|
|
1192
|
+
],
|
|
1193
|
+
[
|
|
1194
|
+
"1P 3M 5P 6M 9M",
|
|
1195
|
+
"sixth/ninth",
|
|
1196
|
+
"6/9 69 M69"
|
|
1197
|
+
],
|
|
1198
|
+
[
|
|
1199
|
+
"1P 3M 6m 7M",
|
|
1200
|
+
"major seventh flat sixth",
|
|
1201
|
+
"M7b6 ^7b6"
|
|
1202
|
+
],
|
|
1203
|
+
[
|
|
1204
|
+
"1P 3M 5P 7M 11A",
|
|
1205
|
+
"major seventh sharp eleventh",
|
|
1206
|
+
"maj#4 Δ#4 Δ#11 M7#11 ^7#11 maj7#11"
|
|
1207
|
+
],
|
|
1208
|
+
[
|
|
1209
|
+
"1P 3m 5P",
|
|
1210
|
+
"minor",
|
|
1211
|
+
"m min -"
|
|
1212
|
+
],
|
|
1213
|
+
[
|
|
1214
|
+
"1P 3m 5P 7m",
|
|
1215
|
+
"minor seventh",
|
|
1216
|
+
"m7 min7 mi7 -7"
|
|
1217
|
+
],
|
|
1218
|
+
[
|
|
1219
|
+
"1P 3m 5P 7M",
|
|
1220
|
+
"minor/major seventh",
|
|
1221
|
+
"m/ma7 m/maj7 mM7 mMaj7 m/M7 -Δ7 mΔ -^7"
|
|
1222
|
+
],
|
|
1223
|
+
[
|
|
1224
|
+
"1P 3m 5P 6M",
|
|
1225
|
+
"minor sixth",
|
|
1226
|
+
"m6 -6"
|
|
1227
|
+
],
|
|
1228
|
+
[
|
|
1229
|
+
"1P 3m 5P 7m 9M",
|
|
1230
|
+
"minor ninth",
|
|
1231
|
+
"m9 -9"
|
|
1232
|
+
],
|
|
1233
|
+
[
|
|
1234
|
+
"1P 3m 5P 7M 9M",
|
|
1235
|
+
"minor/major ninth",
|
|
1236
|
+
"mM9 mMaj9 -^9"
|
|
1237
|
+
],
|
|
1238
|
+
[
|
|
1239
|
+
"1P 3m 5P 7m 9M 11P",
|
|
1240
|
+
"minor eleventh",
|
|
1241
|
+
"m11 -11"
|
|
1242
|
+
],
|
|
1243
|
+
[
|
|
1244
|
+
"1P 3m 5P 7m 9M 13M",
|
|
1245
|
+
"minor thirteenth",
|
|
1246
|
+
"m13 -13"
|
|
1247
|
+
],
|
|
1248
|
+
[
|
|
1249
|
+
"1P 3m 5d",
|
|
1250
|
+
"diminished",
|
|
1251
|
+
"dim ° o"
|
|
1252
|
+
],
|
|
1253
|
+
[
|
|
1254
|
+
"1P 3m 5d 7d",
|
|
1255
|
+
"diminished seventh",
|
|
1256
|
+
"dim7 °7 o7"
|
|
1257
|
+
],
|
|
1258
|
+
[
|
|
1259
|
+
"1P 3m 5d 7m",
|
|
1260
|
+
"half-diminished",
|
|
1261
|
+
"m7b5 ø -7b5 h7 h"
|
|
1262
|
+
],
|
|
1263
|
+
[
|
|
1264
|
+
"1P 3M 5P 7m",
|
|
1265
|
+
"dominant seventh",
|
|
1266
|
+
"7 dom"
|
|
1267
|
+
],
|
|
1268
|
+
[
|
|
1269
|
+
"1P 3M 5P 7m 9M",
|
|
1270
|
+
"dominant ninth",
|
|
1271
|
+
"9"
|
|
1272
|
+
],
|
|
1273
|
+
[
|
|
1274
|
+
"1P 3M 5P 7m 9M 13M",
|
|
1275
|
+
"dominant thirteenth",
|
|
1276
|
+
"13"
|
|
1277
|
+
],
|
|
1278
|
+
[
|
|
1279
|
+
"1P 3M 5P 7m 11A",
|
|
1280
|
+
"lydian dominant seventh",
|
|
1281
|
+
"7#11 7#4"
|
|
1282
|
+
],
|
|
1283
|
+
[
|
|
1284
|
+
"1P 3M 5P 7m 9m",
|
|
1285
|
+
"dominant flat ninth",
|
|
1286
|
+
"7b9"
|
|
1287
|
+
],
|
|
1288
|
+
[
|
|
1289
|
+
"1P 3M 5P 7m 9A",
|
|
1290
|
+
"dominant sharp ninth",
|
|
1291
|
+
"7#9"
|
|
1292
|
+
],
|
|
1293
|
+
[
|
|
1294
|
+
"1P 3M 7m 9m",
|
|
1295
|
+
"altered",
|
|
1296
|
+
"alt7"
|
|
1297
|
+
],
|
|
1298
|
+
[
|
|
1299
|
+
"1P 4P 5P",
|
|
1300
|
+
"suspended fourth",
|
|
1301
|
+
"sus4 sus"
|
|
1302
|
+
],
|
|
1303
|
+
[
|
|
1304
|
+
"1P 2M 5P",
|
|
1305
|
+
"suspended second",
|
|
1306
|
+
"sus2"
|
|
1307
|
+
],
|
|
1308
|
+
[
|
|
1309
|
+
"1P 4P 5P 7m",
|
|
1310
|
+
"suspended fourth seventh",
|
|
1311
|
+
"7sus4 7sus"
|
|
1312
|
+
],
|
|
1313
|
+
[
|
|
1314
|
+
"1P 5P 7m 9M 11P",
|
|
1315
|
+
"eleventh",
|
|
1316
|
+
"11"
|
|
1317
|
+
],
|
|
1318
|
+
[
|
|
1319
|
+
"1P 4P 5P 7m 9m",
|
|
1320
|
+
"suspended fourth flat ninth",
|
|
1321
|
+
"b9sus phryg 7b9sus 7b9sus4"
|
|
1322
|
+
],
|
|
1323
|
+
[
|
|
1324
|
+
"1P 5P",
|
|
1325
|
+
"fifth",
|
|
1326
|
+
"5"
|
|
1327
|
+
],
|
|
1328
|
+
[
|
|
1329
|
+
"1P 3M 5A",
|
|
1330
|
+
"augmented",
|
|
1331
|
+
"aug + +5 ^#5"
|
|
1332
|
+
],
|
|
1333
|
+
[
|
|
1334
|
+
"1P 3m 5A",
|
|
1335
|
+
"minor augmented",
|
|
1336
|
+
"m#5 -#5 m+"
|
|
1337
|
+
],
|
|
1338
|
+
[
|
|
1339
|
+
"1P 3M 5A 7M",
|
|
1340
|
+
"augmented seventh",
|
|
1341
|
+
"maj7#5 maj7+5 +maj7 ^7#5"
|
|
1342
|
+
],
|
|
1343
|
+
[
|
|
1344
|
+
"1P 3M 5P 7M 9M 11A",
|
|
1345
|
+
"major sharp eleventh (lydian)",
|
|
1346
|
+
"maj9#11 Δ9#11 ^9#11"
|
|
1347
|
+
],
|
|
1348
|
+
[
|
|
1349
|
+
"1P 2M 4P 5P",
|
|
1350
|
+
"",
|
|
1351
|
+
"sus24 sus4add9"
|
|
1352
|
+
],
|
|
1353
|
+
[
|
|
1354
|
+
"1P 3M 5A 7M 9M",
|
|
1355
|
+
"",
|
|
1356
|
+
"maj9#5 Maj9#5"
|
|
1357
|
+
],
|
|
1358
|
+
[
|
|
1359
|
+
"1P 3M 5A 7m",
|
|
1360
|
+
"",
|
|
1361
|
+
"7#5 +7 7+ 7aug aug7"
|
|
1362
|
+
],
|
|
1363
|
+
[
|
|
1364
|
+
"1P 3M 5A 7m 9A",
|
|
1365
|
+
"",
|
|
1366
|
+
"7#5#9 7#9#5 7alt"
|
|
1367
|
+
],
|
|
1368
|
+
[
|
|
1369
|
+
"1P 3M 5A 7m 9M",
|
|
1370
|
+
"",
|
|
1371
|
+
"9#5 9+"
|
|
1372
|
+
],
|
|
1373
|
+
[
|
|
1374
|
+
"1P 3M 5A 7m 9M 11A",
|
|
1375
|
+
"",
|
|
1376
|
+
"9#5#11"
|
|
1377
|
+
],
|
|
1378
|
+
[
|
|
1379
|
+
"1P 3M 5A 7m 9m",
|
|
1380
|
+
"",
|
|
1381
|
+
"7#5b9 7b9#5"
|
|
1382
|
+
],
|
|
1383
|
+
[
|
|
1384
|
+
"1P 3M 5A 7m 9m 11A",
|
|
1385
|
+
"",
|
|
1386
|
+
"7#5b9#11"
|
|
1387
|
+
],
|
|
1388
|
+
[
|
|
1389
|
+
"1P 3M 5A 9A",
|
|
1390
|
+
"",
|
|
1391
|
+
"+add#9"
|
|
1392
|
+
],
|
|
1393
|
+
[
|
|
1394
|
+
"1P 3M 5A 9M",
|
|
1395
|
+
"",
|
|
1396
|
+
"M#5add9 +add9"
|
|
1397
|
+
],
|
|
1398
|
+
[
|
|
1399
|
+
"1P 3M 5P 6M 11A",
|
|
1400
|
+
"",
|
|
1401
|
+
"M6#11 M6b5 6#11 6b5"
|
|
1402
|
+
],
|
|
1403
|
+
[
|
|
1404
|
+
"1P 3M 5P 6M 7M 9M",
|
|
1405
|
+
"",
|
|
1406
|
+
"M7add13"
|
|
1407
|
+
],
|
|
1408
|
+
[
|
|
1409
|
+
"1P 3M 5P 6M 9M 11A",
|
|
1410
|
+
"",
|
|
1411
|
+
"69#11"
|
|
1412
|
+
],
|
|
1413
|
+
[
|
|
1414
|
+
"1P 3m 5P 6M 9M",
|
|
1415
|
+
"",
|
|
1416
|
+
"m69 -69"
|
|
1417
|
+
],
|
|
1418
|
+
[
|
|
1419
|
+
"1P 3M 5P 6m 7m",
|
|
1420
|
+
"",
|
|
1421
|
+
"7b6"
|
|
1422
|
+
],
|
|
1423
|
+
[
|
|
1424
|
+
"1P 3M 5P 7M 9A 11A",
|
|
1425
|
+
"",
|
|
1426
|
+
"maj7#9#11"
|
|
1427
|
+
],
|
|
1428
|
+
[
|
|
1429
|
+
"1P 3M 5P 7M 9M 11A 13M",
|
|
1430
|
+
"",
|
|
1431
|
+
"M13#11 maj13#11 M13+4 M13#4"
|
|
1432
|
+
],
|
|
1433
|
+
[
|
|
1434
|
+
"1P 3M 5P 7M 9m",
|
|
1435
|
+
"",
|
|
1436
|
+
"M7b9"
|
|
1437
|
+
],
|
|
1438
|
+
[
|
|
1439
|
+
"1P 3M 5P 7m 11A 13m",
|
|
1440
|
+
"",
|
|
1441
|
+
"7#11b13 7b5b13"
|
|
1442
|
+
],
|
|
1443
|
+
[
|
|
1444
|
+
"1P 3M 5P 7m 13M",
|
|
1445
|
+
"",
|
|
1446
|
+
"7add6 67 7add13"
|
|
1447
|
+
],
|
|
1448
|
+
[
|
|
1449
|
+
"1P 3M 5P 7m 9A 11A",
|
|
1450
|
+
"",
|
|
1451
|
+
"7#9#11 7b5#9 7#9b5"
|
|
1452
|
+
],
|
|
1453
|
+
[
|
|
1454
|
+
"1P 3M 5P 7m 9A 11A 13M",
|
|
1455
|
+
"",
|
|
1456
|
+
"13#9#11"
|
|
1457
|
+
],
|
|
1458
|
+
[
|
|
1459
|
+
"1P 3M 5P 7m 9A 11A 13m",
|
|
1460
|
+
"",
|
|
1461
|
+
"7#9#11b13"
|
|
1462
|
+
],
|
|
1463
|
+
[
|
|
1464
|
+
"1P 3M 5P 7m 9A 13M",
|
|
1465
|
+
"",
|
|
1466
|
+
"13#9"
|
|
1467
|
+
],
|
|
1468
|
+
[
|
|
1469
|
+
"1P 3M 5P 7m 9A 13m",
|
|
1470
|
+
"",
|
|
1471
|
+
"7#9b13"
|
|
1472
|
+
],
|
|
1473
|
+
[
|
|
1474
|
+
"1P 3M 5P 7m 9M 11A",
|
|
1475
|
+
"",
|
|
1476
|
+
"9#11 9+4 9#4"
|
|
1477
|
+
],
|
|
1478
|
+
[
|
|
1479
|
+
"1P 3M 5P 7m 9M 11A 13M",
|
|
1480
|
+
"",
|
|
1481
|
+
"13#11 13+4 13#4"
|
|
1482
|
+
],
|
|
1483
|
+
[
|
|
1484
|
+
"1P 3M 5P 7m 9M 11A 13m",
|
|
1485
|
+
"",
|
|
1486
|
+
"9#11b13 9b5b13"
|
|
1487
|
+
],
|
|
1488
|
+
[
|
|
1489
|
+
"1P 3M 5P 7m 9m 11A",
|
|
1490
|
+
"",
|
|
1491
|
+
"7b9#11 7b5b9 7b9b5"
|
|
1492
|
+
],
|
|
1493
|
+
[
|
|
1494
|
+
"1P 3M 5P 7m 9m 11A 13M",
|
|
1495
|
+
"",
|
|
1496
|
+
"13b9#11"
|
|
1497
|
+
],
|
|
1498
|
+
[
|
|
1499
|
+
"1P 3M 5P 7m 9m 11A 13m",
|
|
1500
|
+
"",
|
|
1501
|
+
"7b9b13#11 7b9#11b13 7b5b9b13"
|
|
1502
|
+
],
|
|
1503
|
+
[
|
|
1504
|
+
"1P 3M 5P 7m 9m 13M",
|
|
1505
|
+
"",
|
|
1506
|
+
"13b9"
|
|
1507
|
+
],
|
|
1508
|
+
[
|
|
1509
|
+
"1P 3M 5P 7m 9m 13m",
|
|
1510
|
+
"",
|
|
1511
|
+
"7b9b13"
|
|
1512
|
+
],
|
|
1513
|
+
[
|
|
1514
|
+
"1P 3M 5P 7m 9m 9A",
|
|
1515
|
+
"",
|
|
1516
|
+
"7b9#9"
|
|
1517
|
+
],
|
|
1518
|
+
[
|
|
1519
|
+
"1P 3M 5P 9M",
|
|
1520
|
+
"",
|
|
1521
|
+
"Madd9 2 add9 add2"
|
|
1522
|
+
],
|
|
1523
|
+
[
|
|
1524
|
+
"1P 3M 5P 9m",
|
|
1525
|
+
"",
|
|
1526
|
+
"Maddb9"
|
|
1527
|
+
],
|
|
1528
|
+
[
|
|
1529
|
+
"1P 3M 5d",
|
|
1530
|
+
"",
|
|
1531
|
+
"Mb5"
|
|
1532
|
+
],
|
|
1533
|
+
[
|
|
1534
|
+
"1P 3M 5d 6M 7m 9M",
|
|
1535
|
+
"",
|
|
1536
|
+
"13b5"
|
|
1537
|
+
],
|
|
1538
|
+
[
|
|
1539
|
+
"1P 3M 5d 7M",
|
|
1540
|
+
"",
|
|
1541
|
+
"M7b5"
|
|
1542
|
+
],
|
|
1543
|
+
[
|
|
1544
|
+
"1P 3M 5d 7M 9M",
|
|
1545
|
+
"",
|
|
1546
|
+
"M9b5"
|
|
1547
|
+
],
|
|
1548
|
+
[
|
|
1549
|
+
"1P 3M 5d 7m",
|
|
1550
|
+
"",
|
|
1551
|
+
"7b5"
|
|
1552
|
+
],
|
|
1553
|
+
[
|
|
1554
|
+
"1P 3M 5d 7m 9M",
|
|
1555
|
+
"",
|
|
1556
|
+
"9b5"
|
|
1557
|
+
],
|
|
1558
|
+
[
|
|
1559
|
+
"1P 3M 7m",
|
|
1560
|
+
"",
|
|
1561
|
+
"7no5"
|
|
1562
|
+
],
|
|
1563
|
+
[
|
|
1564
|
+
"1P 3M 7m 13m",
|
|
1565
|
+
"",
|
|
1566
|
+
"7b13"
|
|
1567
|
+
],
|
|
1568
|
+
[
|
|
1569
|
+
"1P 3M 7m 9M",
|
|
1570
|
+
"",
|
|
1571
|
+
"9no5"
|
|
1572
|
+
],
|
|
1573
|
+
[
|
|
1574
|
+
"1P 3M 7m 9M 13M",
|
|
1575
|
+
"",
|
|
1576
|
+
"13no5"
|
|
1577
|
+
],
|
|
1578
|
+
[
|
|
1579
|
+
"1P 3M 7m 9M 13m",
|
|
1580
|
+
"",
|
|
1581
|
+
"9b13"
|
|
1582
|
+
],
|
|
1583
|
+
[
|
|
1584
|
+
"1P 3m 4P 5P",
|
|
1585
|
+
"",
|
|
1586
|
+
"madd4"
|
|
1587
|
+
],
|
|
1588
|
+
[
|
|
1589
|
+
"1P 3m 5P 6m 7M",
|
|
1590
|
+
"",
|
|
1591
|
+
"mMaj7b6"
|
|
1592
|
+
],
|
|
1593
|
+
[
|
|
1594
|
+
"1P 3m 5P 6m 7M 9M",
|
|
1595
|
+
"",
|
|
1596
|
+
"mMaj9b6"
|
|
1597
|
+
],
|
|
1598
|
+
[
|
|
1599
|
+
"1P 3m 5P 7m 11P",
|
|
1600
|
+
"",
|
|
1601
|
+
"m7add11 m7add4"
|
|
1602
|
+
],
|
|
1603
|
+
[
|
|
1604
|
+
"1P 3m 5P 9M",
|
|
1605
|
+
"",
|
|
1606
|
+
"madd9"
|
|
1607
|
+
],
|
|
1608
|
+
[
|
|
1609
|
+
"1P 3m 5d 6M 7M",
|
|
1610
|
+
"",
|
|
1611
|
+
"o7M7"
|
|
1612
|
+
],
|
|
1613
|
+
[
|
|
1614
|
+
"1P 3m 5d 7M",
|
|
1615
|
+
"",
|
|
1616
|
+
"oM7"
|
|
1617
|
+
],
|
|
1618
|
+
[
|
|
1619
|
+
"1P 3m 6m 7M",
|
|
1620
|
+
"",
|
|
1621
|
+
"mb6M7"
|
|
1622
|
+
],
|
|
1623
|
+
[
|
|
1624
|
+
"1P 3m 6m 7m",
|
|
1625
|
+
"",
|
|
1626
|
+
"m7#5"
|
|
1627
|
+
],
|
|
1628
|
+
[
|
|
1629
|
+
"1P 3m 6m 7m 9M",
|
|
1630
|
+
"",
|
|
1631
|
+
"m9#5"
|
|
1632
|
+
],
|
|
1633
|
+
[
|
|
1634
|
+
"1P 3m 5A 7m 9M 11P",
|
|
1635
|
+
"",
|
|
1636
|
+
"m11A"
|
|
1637
|
+
],
|
|
1638
|
+
[
|
|
1639
|
+
"1P 3m 6m 9m",
|
|
1640
|
+
"",
|
|
1641
|
+
"mb6b9"
|
|
1642
|
+
],
|
|
1643
|
+
[
|
|
1644
|
+
"1P 2M 3m 5d 7m",
|
|
1645
|
+
"",
|
|
1646
|
+
"m9b5"
|
|
1647
|
+
],
|
|
1648
|
+
[
|
|
1649
|
+
"1P 4P 5A 7M",
|
|
1650
|
+
"",
|
|
1651
|
+
"M7#5sus4"
|
|
1652
|
+
],
|
|
1653
|
+
[
|
|
1654
|
+
"1P 4P 5A 7M 9M",
|
|
1655
|
+
"",
|
|
1656
|
+
"M9#5sus4"
|
|
1657
|
+
],
|
|
1658
|
+
[
|
|
1659
|
+
"1P 4P 5A 7m",
|
|
1660
|
+
"",
|
|
1661
|
+
"7#5sus4"
|
|
1662
|
+
],
|
|
1663
|
+
[
|
|
1664
|
+
"1P 4P 5P 7M",
|
|
1665
|
+
"",
|
|
1666
|
+
"M7sus4"
|
|
1667
|
+
],
|
|
1668
|
+
[
|
|
1669
|
+
"1P 4P 5P 7M 9M",
|
|
1670
|
+
"",
|
|
1671
|
+
"M9sus4"
|
|
1672
|
+
],
|
|
1673
|
+
[
|
|
1674
|
+
"1P 4P 5P 7m 9M",
|
|
1675
|
+
"",
|
|
1676
|
+
"9sus4 9sus"
|
|
1677
|
+
],
|
|
1678
|
+
[
|
|
1679
|
+
"1P 4P 5P 7m 9M 13M",
|
|
1680
|
+
"",
|
|
1681
|
+
"13sus4 13sus"
|
|
1682
|
+
],
|
|
1683
|
+
[
|
|
1684
|
+
"1P 4P 5P 7m 9m 13m",
|
|
1685
|
+
"",
|
|
1686
|
+
"7sus4b9b13 7b9b13sus4"
|
|
1687
|
+
],
|
|
1688
|
+
[
|
|
1689
|
+
"1P 4P 7m 10m",
|
|
1690
|
+
"",
|
|
1691
|
+
"4 quartal"
|
|
1692
|
+
],
|
|
1693
|
+
[
|
|
1694
|
+
"1P 5P 7m 9m 11P",
|
|
1695
|
+
"",
|
|
1696
|
+
"11b9"
|
|
1697
|
+
]
|
|
1698
|
+
], ue = {
|
|
1699
|
+
...R,
|
|
1700
|
+
name: "",
|
|
1701
|
+
quality: "Unknown",
|
|
1702
|
+
intervals: [],
|
|
1703
|
+
aliases: []
|
|
1704
|
+
}, B = [], V = {};
|
|
1705
|
+
function get$7(e) {
|
|
1706
|
+
return V[e] || ue;
|
|
1707
|
+
}
|
|
1708
|
+
n(get$7, "get");
|
|
1709
|
+
function all$2() {
|
|
1710
|
+
return B.slice();
|
|
1711
|
+
}
|
|
1712
|
+
n(all$2, "all");
|
|
1713
|
+
function add$3(e, t, n) {
|
|
1714
|
+
let r = getQuality(e), i = {
|
|
1715
|
+
...get$8(e),
|
|
1716
|
+
name: n || "",
|
|
1717
|
+
quality: r,
|
|
1718
|
+
intervals: e,
|
|
1719
|
+
aliases: t
|
|
1720
|
+
};
|
|
1721
|
+
B.push(i), i.name && (V[i.name] = i), V[i.setNum] = i, V[i.chroma] = i, i.aliases.forEach((e) => addAlias$1(i, e));
|
|
1722
|
+
}
|
|
1723
|
+
n(add$3, "add");
|
|
1724
|
+
function addAlias$1(e, t) {
|
|
1725
|
+
V[t] = e;
|
|
1726
|
+
}
|
|
1727
|
+
n(addAlias$1, "addAlias");
|
|
1728
|
+
function getQuality(e) {
|
|
1729
|
+
let has = (t) => e.indexOf(t) !== -1;
|
|
1730
|
+
return has("5A") ? "Augmented" : has("3M") ? "Major" : has("5d") ? "Diminished" : has("3m") ? "Minor" : "Unknown";
|
|
1731
|
+
}
|
|
1732
|
+
le.forEach(([e, t, n]) => add$3(e.split(" "), n.split(" "), t)), B.sort((e, t) => e.setNum - t.setNum);
|
|
1733
|
+
//#endregion
|
|
1734
|
+
//#region ../../node_modules/@tonaljs/scale-type/dist/index.es.js
|
|
1735
|
+
var de = [
|
|
1736
|
+
[
|
|
1737
|
+
"1P 2M 3M 5P 6M",
|
|
1738
|
+
"major pentatonic",
|
|
1739
|
+
"pentatonic"
|
|
1740
|
+
],
|
|
1741
|
+
["1P 3M 4P 5P 7M", "ionian pentatonic"],
|
|
1742
|
+
[
|
|
1743
|
+
"1P 3M 4P 5P 7m",
|
|
1744
|
+
"mixolydian pentatonic",
|
|
1745
|
+
"indian"
|
|
1746
|
+
],
|
|
1747
|
+
["1P 2M 4P 5P 6M", "ritusen"],
|
|
1748
|
+
["1P 2M 4P 5P 7m", "egyptian"],
|
|
1749
|
+
["1P 3M 4P 5d 7m", "neopolitan major pentatonic"],
|
|
1750
|
+
["1P 3m 4P 5P 6m", "vietnamese 1"],
|
|
1751
|
+
["1P 2m 3m 5P 6m", "pelog"],
|
|
1752
|
+
["1P 2m 4P 5P 6m", "kumoijoshi"],
|
|
1753
|
+
["1P 2M 3m 5P 6m", "hirajoshi"],
|
|
1754
|
+
["1P 2m 4P 5d 7m", "iwato"],
|
|
1755
|
+
["1P 2m 4P 5P 7m", "in-sen"],
|
|
1756
|
+
[
|
|
1757
|
+
"1P 3M 4A 5P 7M",
|
|
1758
|
+
"lydian pentatonic",
|
|
1759
|
+
"chinese"
|
|
1760
|
+
],
|
|
1761
|
+
["1P 3m 4P 6m 7m", "malkos raga"],
|
|
1762
|
+
[
|
|
1763
|
+
"1P 3m 4P 5d 7m",
|
|
1764
|
+
"locrian pentatonic",
|
|
1765
|
+
"minor seven flat five pentatonic"
|
|
1766
|
+
],
|
|
1767
|
+
[
|
|
1768
|
+
"1P 3m 4P 5P 7m",
|
|
1769
|
+
"minor pentatonic",
|
|
1770
|
+
"vietnamese 2"
|
|
1771
|
+
],
|
|
1772
|
+
["1P 3m 4P 5P 6M", "minor six pentatonic"],
|
|
1773
|
+
[
|
|
1774
|
+
"1P 2M 3m 5P 6M",
|
|
1775
|
+
"flat three pentatonic",
|
|
1776
|
+
"kumoi"
|
|
1777
|
+
],
|
|
1778
|
+
["1P 2M 3M 5P 6m", "flat six pentatonic"],
|
|
1779
|
+
["1P 2m 3M 5P 6M", "scriabin"],
|
|
1780
|
+
["1P 3M 5d 6m 7m", "whole tone pentatonic"],
|
|
1781
|
+
["1P 3M 4A 5A 7M", "lydian #5P pentatonic"],
|
|
1782
|
+
["1P 3M 4A 5P 7m", "lydian dominant pentatonic"],
|
|
1783
|
+
["1P 3m 4P 5P 7M", "minor #7M pentatonic"],
|
|
1784
|
+
["1P 3m 4d 5d 7m", "super locrian pentatonic"],
|
|
1785
|
+
["1P 2M 3m 4P 5P 7M", "minor hexatonic"],
|
|
1786
|
+
["1P 2A 3M 5P 5A 7M", "augmented"],
|
|
1787
|
+
["1P 2M 3m 3M 5P 6M", "major blues"],
|
|
1788
|
+
["1P 2M 4P 5P 6M 7m", "piongio"],
|
|
1789
|
+
["1P 2m 3M 4A 6M 7m", "prometheus neopolitan"],
|
|
1790
|
+
["1P 2M 3M 4A 6M 7m", "prometheus"],
|
|
1791
|
+
["1P 2m 3M 5d 6m 7m", "mystery #1"],
|
|
1792
|
+
["1P 2m 3M 4P 5A 6M", "six tone symmetric"],
|
|
1793
|
+
[
|
|
1794
|
+
"1P 2M 3M 4A 5A 7m",
|
|
1795
|
+
"whole tone",
|
|
1796
|
+
"messiaen's mode #1"
|
|
1797
|
+
],
|
|
1798
|
+
["1P 2m 4P 4A 5P 7M", "messiaen's mode #5"],
|
|
1799
|
+
[
|
|
1800
|
+
"1P 3m 4P 5d 5P 7m",
|
|
1801
|
+
"minor blues",
|
|
1802
|
+
"blues"
|
|
1803
|
+
],
|
|
1804
|
+
[
|
|
1805
|
+
"1P 2M 3M 4P 5d 6m 7m",
|
|
1806
|
+
"locrian major",
|
|
1807
|
+
"arabian"
|
|
1808
|
+
],
|
|
1809
|
+
["1P 2m 3M 4A 5P 6m 7M", "double harmonic lydian"],
|
|
1810
|
+
["1P 2M 3m 4P 5P 6m 7M", "harmonic minor"],
|
|
1811
|
+
[
|
|
1812
|
+
"1P 2m 3m 4d 5d 6m 7m",
|
|
1813
|
+
"altered",
|
|
1814
|
+
"super locrian",
|
|
1815
|
+
"diminished whole tone",
|
|
1816
|
+
"pomeroy"
|
|
1817
|
+
],
|
|
1818
|
+
[
|
|
1819
|
+
"1P 2M 3m 4P 5d 6m 7m",
|
|
1820
|
+
"locrian #2",
|
|
1821
|
+
"half-diminished",
|
|
1822
|
+
"aeolian b5"
|
|
1823
|
+
],
|
|
1824
|
+
[
|
|
1825
|
+
"1P 2M 3M 4P 5P 6m 7m",
|
|
1826
|
+
"mixolydian b6",
|
|
1827
|
+
"melodic minor fifth mode",
|
|
1828
|
+
"hindu"
|
|
1829
|
+
],
|
|
1830
|
+
[
|
|
1831
|
+
"1P 2M 3M 4A 5P 6M 7m",
|
|
1832
|
+
"lydian dominant",
|
|
1833
|
+
"lydian b7",
|
|
1834
|
+
"overtone"
|
|
1835
|
+
],
|
|
1836
|
+
["1P 2M 3M 4A 5P 6M 7M", "lydian"],
|
|
1837
|
+
["1P 2M 3M 4A 5A 6M 7M", "lydian augmented"],
|
|
1838
|
+
[
|
|
1839
|
+
"1P 2m 3m 4P 5P 6M 7m",
|
|
1840
|
+
"dorian b2",
|
|
1841
|
+
"phrygian #6",
|
|
1842
|
+
"melodic minor second mode"
|
|
1843
|
+
],
|
|
1844
|
+
["1P 2M 3m 4P 5P 6M 7M", "melodic minor"],
|
|
1845
|
+
["1P 2m 3m 4P 5d 6m 7m", "locrian"],
|
|
1846
|
+
[
|
|
1847
|
+
"1P 2m 3m 4d 5d 6m 7d",
|
|
1848
|
+
"ultralocrian",
|
|
1849
|
+
"superlocrian bb7",
|
|
1850
|
+
"·superlocrian diminished"
|
|
1851
|
+
],
|
|
1852
|
+
[
|
|
1853
|
+
"1P 2m 3m 4P 5d 6M 7m",
|
|
1854
|
+
"locrian 6",
|
|
1855
|
+
"locrian natural 6",
|
|
1856
|
+
"locrian sharp 6"
|
|
1857
|
+
],
|
|
1858
|
+
["1P 2A 3M 4P 5P 5A 7M", "augmented heptatonic"],
|
|
1859
|
+
["1P 2M 3m 5d 5P 6M 7m", "romanian minor"],
|
|
1860
|
+
["1P 2M 3m 4A 5P 6M 7m", "dorian #4"],
|
|
1861
|
+
["1P 2M 3m 4A 5P 6M 7M", "lydian diminished"],
|
|
1862
|
+
["1P 2m 3m 4P 5P 6m 7m", "phrygian"],
|
|
1863
|
+
["1P 2M 3M 4A 5A 7m 7M", "leading whole tone"],
|
|
1864
|
+
["1P 2M 3M 4A 5P 6m 7m", "lydian minor"],
|
|
1865
|
+
[
|
|
1866
|
+
"1P 2m 3M 4P 5P 6m 7m",
|
|
1867
|
+
"phrygian dominant",
|
|
1868
|
+
"spanish",
|
|
1869
|
+
"phrygian major"
|
|
1870
|
+
],
|
|
1871
|
+
["1P 2m 3m 4P 5P 6m 7M", "balinese"],
|
|
1872
|
+
["1P 2m 3m 4P 5P 6M 7M", "neopolitan major"],
|
|
1873
|
+
[
|
|
1874
|
+
"1P 2M 3m 4P 5P 6m 7m",
|
|
1875
|
+
"aeolian",
|
|
1876
|
+
"minor"
|
|
1877
|
+
],
|
|
1878
|
+
["1P 2M 3M 4P 5P 6m 7M", "harmonic major"],
|
|
1879
|
+
[
|
|
1880
|
+
"1P 2m 3M 4P 5P 6m 7M",
|
|
1881
|
+
"double harmonic major",
|
|
1882
|
+
"gypsy"
|
|
1883
|
+
],
|
|
1884
|
+
["1P 2M 3m 4P 5P 6M 7m", "dorian"],
|
|
1885
|
+
["1P 2M 3m 4A 5P 6m 7M", "hungarian minor"],
|
|
1886
|
+
["1P 2A 3M 4A 5P 6M 7m", "hungarian major"],
|
|
1887
|
+
["1P 2m 3M 4P 5d 6M 7m", "oriental"],
|
|
1888
|
+
["1P 2m 3m 3M 4A 5P 7m", "flamenco"],
|
|
1889
|
+
["1P 2m 3m 4A 5P 6m 7M", "todi raga"],
|
|
1890
|
+
[
|
|
1891
|
+
"1P 2M 3M 4P 5P 6M 7m",
|
|
1892
|
+
"mixolydian",
|
|
1893
|
+
"dominant"
|
|
1894
|
+
],
|
|
1895
|
+
["1P 2m 3M 4P 5d 6m 7M", "persian"],
|
|
1896
|
+
[
|
|
1897
|
+
"1P 2M 3M 4P 5P 6M 7M",
|
|
1898
|
+
"major",
|
|
1899
|
+
"ionian"
|
|
1900
|
+
],
|
|
1901
|
+
["1P 2m 3M 5d 6m 7m 7M", "enigmatic"],
|
|
1902
|
+
[
|
|
1903
|
+
"1P 2M 3M 4P 5A 6M 7M",
|
|
1904
|
+
"major augmented",
|
|
1905
|
+
"major #5",
|
|
1906
|
+
"ionian augmented",
|
|
1907
|
+
"ionian #5"
|
|
1908
|
+
],
|
|
1909
|
+
["1P 2A 3M 4A 5P 6M 7M", "lydian #9"],
|
|
1910
|
+
["1P 2m 2M 4P 4A 5P 6m 7M", "messiaen's mode #4"],
|
|
1911
|
+
["1P 2m 3M 4P 4A 5P 6m 7M", "purvi raga"],
|
|
1912
|
+
["1P 2m 3m 3M 4P 5P 6m 7m", "spanish heptatonic"],
|
|
1913
|
+
["1P 2M 3M 4P 5P 6M 7m 7M", "bebop"],
|
|
1914
|
+
["1P 2M 3m 3M 4P 5P 6M 7m", "bebop minor"],
|
|
1915
|
+
["1P 2M 3M 4P 5P 5A 6M 7M", "bebop major"],
|
|
1916
|
+
["1P 2m 3m 4P 5d 5P 6m 7m", "bebop locrian"],
|
|
1917
|
+
["1P 2M 3m 4P 5P 6m 7m 7M", "minor bebop"],
|
|
1918
|
+
[
|
|
1919
|
+
"1P 2M 3m 4P 5d 6m 6M 7M",
|
|
1920
|
+
"diminished",
|
|
1921
|
+
"whole-half diminished"
|
|
1922
|
+
],
|
|
1923
|
+
["1P 2M 3M 4P 5d 5P 6M 7M", "ichikosucho"],
|
|
1924
|
+
["1P 2M 3m 4P 5P 6m 6M 7M", "minor six diminished"],
|
|
1925
|
+
[
|
|
1926
|
+
"1P 2m 3m 3M 4A 5P 6M 7m",
|
|
1927
|
+
"half-whole diminished",
|
|
1928
|
+
"dominant diminished",
|
|
1929
|
+
"messiaen's mode #2"
|
|
1930
|
+
],
|
|
1931
|
+
["1P 3m 3M 4P 5P 6M 7m 7M", "kafi raga"],
|
|
1932
|
+
["1P 2M 3M 4P 4A 5A 6A 7M", "messiaen's mode #6"],
|
|
1933
|
+
["1P 2M 3m 3M 4P 5d 5P 6M 7m", "composite blues"],
|
|
1934
|
+
["1P 2M 3m 3M 4A 5P 6m 7m 7M", "messiaen's mode #3"],
|
|
1935
|
+
["1P 2m 2M 3m 4P 4A 5P 6m 6M 7M", "messiaen's mode #7"],
|
|
1936
|
+
["1P 2m 2M 3m 3M 4P 5d 5P 6m 6M 7m 7M", "chromatic"]
|
|
1937
|
+
], fe = {
|
|
1938
|
+
...R,
|
|
1939
|
+
intervals: [],
|
|
1940
|
+
aliases: []
|
|
1941
|
+
}, H = [], U = {};
|
|
1942
|
+
function get$6(e) {
|
|
1943
|
+
return U[e] || fe;
|
|
1944
|
+
}
|
|
1945
|
+
n(get$6, "get");
|
|
1946
|
+
function all$1() {
|
|
1947
|
+
return H.slice();
|
|
1948
|
+
}
|
|
1949
|
+
n(all$1, "all");
|
|
1950
|
+
function add$2(e, t, n = []) {
|
|
1951
|
+
let r = {
|
|
1952
|
+
...get$8(e),
|
|
1953
|
+
name: t,
|
|
1954
|
+
intervals: e,
|
|
1955
|
+
aliases: n
|
|
1956
|
+
};
|
|
1957
|
+
return H.push(r), U[r.name] = r, U[r.setNum] = r, U[r.chroma] = r, r.aliases.forEach((e) => addAlias(r, e)), r;
|
|
1958
|
+
}
|
|
1959
|
+
n(add$2, "add");
|
|
1960
|
+
function addAlias(e, t) {
|
|
1961
|
+
U[t] = e;
|
|
1962
|
+
}
|
|
1963
|
+
de.forEach(([e, t, ...n]) => add$2(e.split(" "), t, n));
|
|
1964
|
+
//#endregion
|
|
1965
|
+
//#region ../../node_modules/@tonaljs/chord/dist/index.es.js
|
|
1966
|
+
var W = {
|
|
1967
|
+
empty: !0,
|
|
1968
|
+
name: "",
|
|
1969
|
+
symbol: "",
|
|
1970
|
+
root: "",
|
|
1971
|
+
rootDegree: 0,
|
|
1972
|
+
type: "",
|
|
1973
|
+
tonic: null,
|
|
1974
|
+
setNum: NaN,
|
|
1975
|
+
quality: "Unknown",
|
|
1976
|
+
chroma: "",
|
|
1977
|
+
normalized: "",
|
|
1978
|
+
aliases: [],
|
|
1979
|
+
notes: [],
|
|
1980
|
+
intervals: []
|
|
1981
|
+
}, pe = /^(6|64|7|9|11|13)$/;
|
|
1982
|
+
function tokenize$2(e) {
|
|
1983
|
+
let [t, n, r, i] = tokenizeNote(e);
|
|
1984
|
+
return t === "" ? ["", e] : t === "A" && i === "ug" ? ["", "aug"] : !i && (r === "4" || r === "5") ? [t + n, r] : pe.test(r) ? [t + n, r + i] : [t + n + r, i];
|
|
1985
|
+
}
|
|
1986
|
+
n(tokenize$2, "tokenize");
|
|
1987
|
+
function get$5(e) {
|
|
1988
|
+
if (e === "") return W;
|
|
1989
|
+
if (Array.isArray(e) && e.length === 2) return getChord(e[1], e[0]);
|
|
1990
|
+
{
|
|
1991
|
+
let [t, n] = tokenize$2(e), r = getChord(n, t);
|
|
1992
|
+
return r.empty ? getChord(e) : r;
|
|
1993
|
+
}
|
|
1994
|
+
}
|
|
1995
|
+
n(get$5, "get");
|
|
1996
|
+
function getChord(e, t, n) {
|
|
1997
|
+
let r = get$7(e), i = note(t || ""), a = note(n || "");
|
|
1998
|
+
if (r.empty || t && i.empty || n && a.empty) return W;
|
|
1999
|
+
let o = distance$1(i.pc, a.pc), s = r.intervals.indexOf(o) + 1;
|
|
2000
|
+
if (!a.empty && !s) return W;
|
|
2001
|
+
let c = Array.from(r.intervals);
|
|
2002
|
+
for (let e = 1; e < s; e++) {
|
|
2003
|
+
let e = c[0][0], t = c[0][1], n = parseInt(e, 10) + 7;
|
|
2004
|
+
c.push(`${n}${t}`), c.shift();
|
|
2005
|
+
}
|
|
2006
|
+
let l = i.empty ? [] : c.map((e) => transpose$2(i, e));
|
|
2007
|
+
e = r.aliases.indexOf(e) === -1 ? r.aliases[0] : e;
|
|
2008
|
+
let u = `${i.empty ? "" : i.pc}${e}${a.empty || s <= 1 ? "" : "/" + a.pc}`, d = `${t ? i.pc + " " : ""}${r.name}${s > 1 && n ? " over " + a.pc : ""}`;
|
|
2009
|
+
return {
|
|
2010
|
+
...r,
|
|
2011
|
+
name: d,
|
|
2012
|
+
symbol: u,
|
|
2013
|
+
type: r.name,
|
|
2014
|
+
root: a.name,
|
|
2015
|
+
intervals: c,
|
|
2016
|
+
rootDegree: s,
|
|
2017
|
+
tonic: i.name,
|
|
2018
|
+
notes: l
|
|
2019
|
+
};
|
|
2020
|
+
}
|
|
2021
|
+
//#endregion
|
|
2022
|
+
//#region ../../node_modules/@tonaljs/duration-value/dist/index.es.js
|
|
2023
|
+
var me = [
|
|
2024
|
+
[
|
|
2025
|
+
.125,
|
|
2026
|
+
"dl",
|
|
2027
|
+
[
|
|
2028
|
+
"large",
|
|
2029
|
+
"duplex longa",
|
|
2030
|
+
"maxima",
|
|
2031
|
+
"octuple",
|
|
2032
|
+
"octuple whole"
|
|
2033
|
+
]
|
|
2034
|
+
],
|
|
2035
|
+
[
|
|
2036
|
+
.25,
|
|
2037
|
+
"l",
|
|
2038
|
+
["long", "longa"]
|
|
2039
|
+
],
|
|
2040
|
+
[
|
|
2041
|
+
.5,
|
|
2042
|
+
"d",
|
|
2043
|
+
[
|
|
2044
|
+
"double whole",
|
|
2045
|
+
"double",
|
|
2046
|
+
"breve"
|
|
2047
|
+
]
|
|
2048
|
+
],
|
|
2049
|
+
[
|
|
2050
|
+
1,
|
|
2051
|
+
"w",
|
|
2052
|
+
["whole", "semibreve"]
|
|
2053
|
+
],
|
|
2054
|
+
[
|
|
2055
|
+
2,
|
|
2056
|
+
"h",
|
|
2057
|
+
["half", "minim"]
|
|
2058
|
+
],
|
|
2059
|
+
[
|
|
2060
|
+
4,
|
|
2061
|
+
"q",
|
|
2062
|
+
["quarter", "crotchet"]
|
|
2063
|
+
],
|
|
2064
|
+
[
|
|
2065
|
+
8,
|
|
2066
|
+
"e",
|
|
2067
|
+
["eighth", "quaver"]
|
|
2068
|
+
],
|
|
2069
|
+
[
|
|
2070
|
+
16,
|
|
2071
|
+
"s",
|
|
2072
|
+
["sixteenth", "semiquaver"]
|
|
2073
|
+
],
|
|
2074
|
+
[
|
|
2075
|
+
32,
|
|
2076
|
+
"t",
|
|
2077
|
+
["thirty-second", "demisemiquaver"]
|
|
2078
|
+
],
|
|
2079
|
+
[
|
|
2080
|
+
64,
|
|
2081
|
+
"sf",
|
|
2082
|
+
["sixty-fourth", "hemidemisemiquaver"]
|
|
2083
|
+
],
|
|
2084
|
+
[
|
|
2085
|
+
128,
|
|
2086
|
+
"h",
|
|
2087
|
+
["hundred twenty-eighth"]
|
|
2088
|
+
],
|
|
2089
|
+
[
|
|
2090
|
+
256,
|
|
2091
|
+
"th",
|
|
2092
|
+
["two hundred fifty-sixth"]
|
|
2093
|
+
]
|
|
2094
|
+
], he = [];
|
|
2095
|
+
me.forEach(([e, t, n]) => add$1(e, t, n));
|
|
2096
|
+
function add$1(e, t, n) {
|
|
2097
|
+
he.push({
|
|
2098
|
+
empty: !1,
|
|
2099
|
+
dots: "",
|
|
2100
|
+
name: "",
|
|
2101
|
+
value: 1 / e,
|
|
2102
|
+
fraction: e < 1 ? [1 / e, 1] : [1, e],
|
|
2103
|
+
shorthand: t,
|
|
2104
|
+
names: n
|
|
2105
|
+
});
|
|
2106
|
+
}
|
|
2107
|
+
n(add$1, "add");
|
|
2108
|
+
//#endregion
|
|
2109
|
+
//#region ../../node_modules/@tonaljs/interval/dist/index.es.js
|
|
2110
|
+
function names$1() {
|
|
2111
|
+
return "1P 2M 3M 4P 5P 6m 7m".split(" ");
|
|
2112
|
+
}
|
|
2113
|
+
n(names$1, "names");
|
|
2114
|
+
var ge = interval, _e = /* @__PURE__ */ n((e) => interval(e).name, "name"), semitones = (e) => interval(e).semitones, quality = (e) => interval(e).q, num = (e) => interval(e).num;
|
|
2115
|
+
function simplify$1(e) {
|
|
2116
|
+
let t = interval(e);
|
|
2117
|
+
return t.empty ? "" : t.simple + t.q;
|
|
2118
|
+
}
|
|
2119
|
+
n(simplify$1, "simplify");
|
|
2120
|
+
function invert(e) {
|
|
2121
|
+
let t = interval(e);
|
|
2122
|
+
return t.empty ? "" : interval({
|
|
2123
|
+
step: (7 - t.step) % 7,
|
|
2124
|
+
alt: t.type === "perfectable" ? -t.alt : -(t.alt + 1),
|
|
2125
|
+
oct: t.oct,
|
|
2126
|
+
dir: t.dir
|
|
2127
|
+
}).name;
|
|
2128
|
+
}
|
|
2129
|
+
var ve = [
|
|
2130
|
+
1,
|
|
2131
|
+
2,
|
|
2132
|
+
2,
|
|
2133
|
+
3,
|
|
2134
|
+
3,
|
|
2135
|
+
4,
|
|
2136
|
+
5,
|
|
2137
|
+
5,
|
|
2138
|
+
6,
|
|
2139
|
+
6,
|
|
2140
|
+
7,
|
|
2141
|
+
7
|
|
2142
|
+
], ye = "P m M m M P d P m M m M".split(" ");
|
|
2143
|
+
function fromSemitones(e) {
|
|
2144
|
+
let t = e < 0 ? -1 : 1, n = Math.abs(e), r = n % 12, i = Math.floor(n / 12);
|
|
2145
|
+
return t * (ve[r] + 7 * i) + ye[r];
|
|
2146
|
+
}
|
|
2147
|
+
var be = distance$1, xe = combinator((e, t) => [e[0] + t[0], e[1] + t[1]]), addTo = (e) => (t) => xe(e, t), Se = {
|
|
2148
|
+
names: names$1,
|
|
2149
|
+
get: ge,
|
|
2150
|
+
name: _e,
|
|
2151
|
+
num,
|
|
2152
|
+
semitones,
|
|
2153
|
+
quality,
|
|
2154
|
+
fromSemitones,
|
|
2155
|
+
distance: be,
|
|
2156
|
+
invert,
|
|
2157
|
+
simplify: simplify$1,
|
|
2158
|
+
add: xe,
|
|
2159
|
+
addTo,
|
|
2160
|
+
substract: combinator((e, t) => [e[0] - t[0], e[1] - t[1]])
|
|
2161
|
+
};
|
|
2162
|
+
function combinator(e) {
|
|
2163
|
+
return (t, n) => {
|
|
2164
|
+
let r = interval(t).coord, i = interval(n).coord;
|
|
2165
|
+
if (r && i) return coordToInterval(e(r, i)).name;
|
|
2166
|
+
};
|
|
2167
|
+
}
|
|
2168
|
+
//#endregion
|
|
2169
|
+
//#region ../../node_modules/@tonaljs/midi/dist/index.es.js
|
|
2170
|
+
var Ce = Math.log(2), we = Math.log(440);
|
|
2171
|
+
function freqToMidi(e) {
|
|
2172
|
+
let t = 12 * (Math.log(e) - we) / Ce + 69;
|
|
2173
|
+
return Math.round(t * 100) / 100;
|
|
2174
|
+
}
|
|
2175
|
+
var Te = "C C# D D# E F F# G G# A A# B".split(" "), Ee = "C Db D Eb E F Gb G Ab A Bb B".split(" ");
|
|
2176
|
+
function midiToNoteName(e, t = {}) {
|
|
2177
|
+
if (isNaN(e) || e === -Infinity || e === Infinity) return "";
|
|
2178
|
+
e = Math.round(e);
|
|
2179
|
+
let n = (t.sharps === !0 ? Te : Ee)[e % 12];
|
|
2180
|
+
return t.pitchClass ? n : n + (Math.floor(e / 12) - 1);
|
|
2181
|
+
}
|
|
2182
|
+
//#endregion
|
|
2183
|
+
//#region ../../node_modules/@tonaljs/note/dist/index.es.js
|
|
2184
|
+
var De = [
|
|
2185
|
+
"C",
|
|
2186
|
+
"D",
|
|
2187
|
+
"E",
|
|
2188
|
+
"F",
|
|
2189
|
+
"G",
|
|
2190
|
+
"A",
|
|
2191
|
+
"B"
|
|
2192
|
+
], toName = (e) => e.name, onlyNotes = (e) => e.map(note).filter((e) => !e.empty);
|
|
2193
|
+
function names(e) {
|
|
2194
|
+
return e === void 0 ? De.slice() : Array.isArray(e) ? onlyNotes(e).map(toName) : [];
|
|
2195
|
+
}
|
|
2196
|
+
var G = note, name = (e) => G(e).name, pitchClass = (e) => G(e).pc, accidentals = (e) => G(e).acc, octave = (e) => G(e).oct, midi = (e) => G(e).midi, freq = (e) => G(e).freq, chroma = (e) => G(e).chroma;
|
|
2197
|
+
function fromMidi(e) {
|
|
2198
|
+
return midiToNoteName(e);
|
|
2199
|
+
}
|
|
2200
|
+
function fromFreq(e) {
|
|
2201
|
+
return midiToNoteName(freqToMidi(e));
|
|
2202
|
+
}
|
|
2203
|
+
function fromFreqSharps(e) {
|
|
2204
|
+
return midiToNoteName(freqToMidi(e), { sharps: !0 });
|
|
2205
|
+
}
|
|
2206
|
+
function fromMidiSharps(e) {
|
|
2207
|
+
return midiToNoteName(e, { sharps: !0 });
|
|
2208
|
+
}
|
|
2209
|
+
var K = transpose$2, Oe = transpose$2, transposeBy = (e) => (t) => K(t, e), ke = transposeBy, transposeFrom = (e) => (t) => K(e, t), Ae = transposeFrom;
|
|
2210
|
+
function transposeFifths(e, t) {
|
|
2211
|
+
let n = G(e);
|
|
2212
|
+
if (n.empty) return "";
|
|
2213
|
+
let [r, i] = n.coord;
|
|
2214
|
+
return coordToNote(i === void 0 ? [r + t] : [r + t, i]).name;
|
|
2215
|
+
}
|
|
2216
|
+
var je = transposeFifths, ascending = (e, t) => e.height - t.height, descending = (e, t) => t.height - e.height;
|
|
2217
|
+
function sortedNames(e, t) {
|
|
2218
|
+
return t ||= ascending, onlyNotes(e).sort(t).map(toName);
|
|
2219
|
+
}
|
|
2220
|
+
function sortedUniqNames(e) {
|
|
2221
|
+
return sortedNames(e, ascending).filter((e, t, n) => t === 0 || e !== n[t - 1]);
|
|
2222
|
+
}
|
|
2223
|
+
var Me = nameBuilder(!0), Ne = nameBuilder(!1);
|
|
2224
|
+
function nameBuilder(e) {
|
|
2225
|
+
return (t) => {
|
|
2226
|
+
let n = G(t);
|
|
2227
|
+
if (n.empty) return "";
|
|
2228
|
+
let r = e ? n.alt > 0 : n.alt < 0, i = n.midi === null;
|
|
2229
|
+
return midiToNoteName(n.midi || n.chroma, {
|
|
2230
|
+
sharps: r,
|
|
2231
|
+
pitchClass: i
|
|
2232
|
+
});
|
|
2233
|
+
};
|
|
2234
|
+
}
|
|
2235
|
+
var q = {
|
|
2236
|
+
names,
|
|
2237
|
+
get: G,
|
|
2238
|
+
name,
|
|
2239
|
+
pitchClass,
|
|
2240
|
+
accidentals,
|
|
2241
|
+
octave,
|
|
2242
|
+
midi,
|
|
2243
|
+
ascending,
|
|
2244
|
+
descending,
|
|
2245
|
+
sortedNames,
|
|
2246
|
+
sortedUniqNames,
|
|
2247
|
+
fromMidi,
|
|
2248
|
+
fromMidiSharps,
|
|
2249
|
+
freq,
|
|
2250
|
+
fromFreq,
|
|
2251
|
+
fromFreqSharps,
|
|
2252
|
+
chroma,
|
|
2253
|
+
transpose: K,
|
|
2254
|
+
tr: Oe,
|
|
2255
|
+
transposeBy,
|
|
2256
|
+
trBy: ke,
|
|
2257
|
+
transposeFrom,
|
|
2258
|
+
trFrom: Ae,
|
|
2259
|
+
transposeFifths,
|
|
2260
|
+
trFifths: je,
|
|
2261
|
+
simplify: Me,
|
|
2262
|
+
enharmonic: Ne
|
|
2263
|
+
}, Pe = {
|
|
2264
|
+
empty: !0,
|
|
2265
|
+
name: "",
|
|
2266
|
+
chordType: ""
|
|
2267
|
+
}, Fe = {};
|
|
2268
|
+
function get$2(e) {
|
|
2269
|
+
return typeof e == "string" ? Fe[e] || (Fe[e] = parse(e)) : typeof e == "number" ? get$2(J[e] || "") : isPitch(e) ? fromPitch(e) : isNamed(e) ? get$2(e.name) : Pe;
|
|
2270
|
+
}
|
|
2271
|
+
n(get$2, "get");
|
|
2272
|
+
function fromPitch(e) {
|
|
2273
|
+
return get$2(altToAcc(e.alt) + J[e.step]);
|
|
2274
|
+
}
|
|
2275
|
+
var Ie = /^(#{1,}|b{1,}|x{1,}|)(IV|I{1,3}|VI{0,2}|iv|i{1,3}|vi{0,2})([^IViv]*)$/;
|
|
2276
|
+
function tokenize$1(e) {
|
|
2277
|
+
return Ie.exec(e) || [
|
|
2278
|
+
"",
|
|
2279
|
+
"",
|
|
2280
|
+
"",
|
|
2281
|
+
""
|
|
2282
|
+
];
|
|
2283
|
+
}
|
|
2284
|
+
n(tokenize$1, "tokenize");
|
|
2285
|
+
var Le = "I II III IV V VI VII", J = Le.split(" ");
|
|
2286
|
+
Le.toLowerCase().split(" ");
|
|
2287
|
+
function parse(e) {
|
|
2288
|
+
let [t, n, r, i] = tokenize$1(e);
|
|
2289
|
+
if (!r) return Pe;
|
|
2290
|
+
let a = r.toUpperCase(), o = J.indexOf(a), s = accToAlt(n);
|
|
2291
|
+
return {
|
|
2292
|
+
empty: !1,
|
|
2293
|
+
name: t,
|
|
2294
|
+
roman: r,
|
|
2295
|
+
interval: interval({
|
|
2296
|
+
step: o,
|
|
2297
|
+
alt: s,
|
|
2298
|
+
dir: 1
|
|
2299
|
+
}).name,
|
|
2300
|
+
acc: n,
|
|
2301
|
+
chordType: i,
|
|
2302
|
+
alt: s,
|
|
2303
|
+
step: o,
|
|
2304
|
+
major: r === a,
|
|
2305
|
+
oct: 0,
|
|
2306
|
+
dir: 1
|
|
2307
|
+
};
|
|
2308
|
+
}
|
|
2309
|
+
//#endregion
|
|
2310
|
+
//#region ../../node_modules/@tonaljs/key/dist/index.es.js
|
|
2311
|
+
var Re = [
|
|
2312
|
+
[
|
|
2313
|
+
0,
|
|
2314
|
+
2773,
|
|
2315
|
+
0,
|
|
2316
|
+
"ionian",
|
|
2317
|
+
"",
|
|
2318
|
+
"Maj7",
|
|
2319
|
+
"major"
|
|
2320
|
+
],
|
|
2321
|
+
[
|
|
2322
|
+
1,
|
|
2323
|
+
2902,
|
|
2324
|
+
2,
|
|
2325
|
+
"dorian",
|
|
2326
|
+
"m",
|
|
2327
|
+
"m7"
|
|
2328
|
+
],
|
|
2329
|
+
[
|
|
2330
|
+
2,
|
|
2331
|
+
3418,
|
|
2332
|
+
4,
|
|
2333
|
+
"phrygian",
|
|
2334
|
+
"m",
|
|
2335
|
+
"m7"
|
|
2336
|
+
],
|
|
2337
|
+
[
|
|
2338
|
+
3,
|
|
2339
|
+
2741,
|
|
2340
|
+
-1,
|
|
2341
|
+
"lydian",
|
|
2342
|
+
"",
|
|
2343
|
+
"Maj7"
|
|
2344
|
+
],
|
|
2345
|
+
[
|
|
2346
|
+
4,
|
|
2347
|
+
2774,
|
|
2348
|
+
1,
|
|
2349
|
+
"mixolydian",
|
|
2350
|
+
"",
|
|
2351
|
+
"7"
|
|
2352
|
+
],
|
|
2353
|
+
[
|
|
2354
|
+
5,
|
|
2355
|
+
2906,
|
|
2356
|
+
3,
|
|
2357
|
+
"aeolian",
|
|
2358
|
+
"m",
|
|
2359
|
+
"m7",
|
|
2360
|
+
"minor"
|
|
2361
|
+
],
|
|
2362
|
+
[
|
|
2363
|
+
6,
|
|
2364
|
+
3434,
|
|
2365
|
+
5,
|
|
2366
|
+
"locrian",
|
|
2367
|
+
"dim",
|
|
2368
|
+
"m7b5"
|
|
2369
|
+
]
|
|
2370
|
+
], ze = {
|
|
2371
|
+
...R,
|
|
2372
|
+
name: "",
|
|
2373
|
+
alt: 0,
|
|
2374
|
+
modeNum: NaN,
|
|
2375
|
+
triad: "",
|
|
2376
|
+
seventh: "",
|
|
2377
|
+
aliases: []
|
|
2378
|
+
}, Be = Re.map(toMode), Y = {};
|
|
2379
|
+
Be.forEach((e) => {
|
|
2380
|
+
Y[e.name] = e, e.aliases.forEach((t) => {
|
|
2381
|
+
Y[t] = e;
|
|
2382
|
+
});
|
|
2383
|
+
});
|
|
2384
|
+
function get$1(e) {
|
|
2385
|
+
return typeof e == "string" ? Y[e.toLowerCase()] || ze : e && e.name ? get$1(e.name) : ze;
|
|
2386
|
+
}
|
|
2387
|
+
n(get$1, "get");
|
|
2388
|
+
function toMode(e) {
|
|
2389
|
+
let [t, n, r, i, a, o, s] = e, c = s ? [s] : [], l = Number(n).toString(2);
|
|
2390
|
+
return {
|
|
2391
|
+
empty: !1,
|
|
2392
|
+
intervals: chromaToIntervals(l),
|
|
2393
|
+
modeNum: t,
|
|
2394
|
+
chroma: l,
|
|
2395
|
+
normalized: l,
|
|
2396
|
+
name: i,
|
|
2397
|
+
setNum: n,
|
|
2398
|
+
alt: r,
|
|
2399
|
+
triad: a,
|
|
2400
|
+
seventh: o,
|
|
2401
|
+
aliases: c
|
|
2402
|
+
};
|
|
2403
|
+
}
|
|
2404
|
+
//#endregion
|
|
2405
|
+
//#region src/piano/utility/midi.ts
|
|
2406
|
+
var Ve = /* @__PURE__ */ e(te(), 1);
|
|
2407
|
+
function transpose(e, t) {
|
|
2408
|
+
let n = { ...e }, r = q.transpose(e.note.name + e.note.octave, Se.fromSemitones(t));
|
|
2409
|
+
return n.note = {
|
|
2410
|
+
name: q.pitchClass(r),
|
|
2411
|
+
number: e.note.number + t,
|
|
2412
|
+
octave: q.octave(r)
|
|
2413
|
+
}, n;
|
|
2414
|
+
}
|
|
2415
|
+
function transposeSyllableSeq(e, t) {
|
|
2416
|
+
return e.map((e) => transpose(e, t));
|
|
2417
|
+
}
|
|
2418
|
+
function eventsToSyllableSequence(e) {
|
|
2419
|
+
let t = [];
|
|
2420
|
+
e = e.filter((e) => e.type === "noteon").sort((e, t) => e.timestamp - t.timestamp);
|
|
2421
|
+
for (let n = 10; n > 0; n--) for (let r = 0; r < e.length - n + 1; r++) try {
|
|
2422
|
+
t.push(new X(e.slice(r, r + n))), e.splice(r, n), r = -1;
|
|
2423
|
+
} catch {}
|
|
2424
|
+
return new He(t);
|
|
2425
|
+
}
|
|
2426
|
+
var He = class SyllableSequence {
|
|
2427
|
+
syllables;
|
|
2428
|
+
rootNote;
|
|
2429
|
+
append(e) {
|
|
2430
|
+
if (this.syllables.length) try {
|
|
2431
|
+
let t = new X(this.syllables[this.syllables.length - 1].notes.map((e) => ({
|
|
2432
|
+
note: e.note,
|
|
2433
|
+
timestamp: e.timestamp,
|
|
2434
|
+
type: e.type,
|
|
2435
|
+
velocity: e.velocity
|
|
2436
|
+
})).concat(e));
|
|
2437
|
+
this.syllables.splice(this.syllables.length - 1, 1, t);
|
|
2438
|
+
} catch {
|
|
2439
|
+
this.syllables.push(new X([e]));
|
|
2440
|
+
}
|
|
2441
|
+
else this.syllables.push(new X([e])), this.rootNote = e.note;
|
|
2442
|
+
}
|
|
2443
|
+
constructor(e) {
|
|
2444
|
+
e.length > 0 ? (this.syllables = e.sort((e, t) => e.timestamp - t.timestamp), this.rootNote = this.syllables[0].notes.reduce((e, t) => t.note.number < e.note.number ? t : e).note) : (this.syllables = [], this.rootNote = {
|
|
2445
|
+
name: "C",
|
|
2446
|
+
octave: 4,
|
|
2447
|
+
number: 0
|
|
2448
|
+
});
|
|
2449
|
+
}
|
|
2450
|
+
grade(e) {
|
|
2451
|
+
let t = [];
|
|
2452
|
+
for (let n = 0; n < this.syllables.length; n++) t.push(this.syllables[n].grade(e.syllables[n]));
|
|
2453
|
+
return new SyllableSequence(t);
|
|
2454
|
+
}
|
|
2455
|
+
toString() {
|
|
2456
|
+
let e = "";
|
|
2457
|
+
return this.syllables.forEach((t, n) => {
|
|
2458
|
+
e += `Syllable ${n + 1}: {\n`, t.notes.forEach((t) => {
|
|
2459
|
+
e += `\t${t.note.name}\t${t.note.number}\t${t.timestamp} ${t.isCorrect ? "" : "(incorrect)"} ${t.isMissing ? "(missing)" : ""}\n`;
|
|
2460
|
+
}), e += `} - ${t.timestamp}, correct: ${t.isCorrect}\n`;
|
|
2461
|
+
}), e;
|
|
2462
|
+
}
|
|
2463
|
+
isCorrect() {
|
|
2464
|
+
let e = !0;
|
|
2465
|
+
return this.syllables.forEach((t) => {
|
|
2466
|
+
t.isCorrect === !1 ? e = !1 : t.notes.forEach((t) => {
|
|
2467
|
+
t.isCorrect === !1 && (e = !1);
|
|
2468
|
+
});
|
|
2469
|
+
}), e;
|
|
2470
|
+
}
|
|
2471
|
+
}, X = class Syllable {
|
|
2472
|
+
notes;
|
|
2473
|
+
isCorrect;
|
|
2474
|
+
get timestamp() {
|
|
2475
|
+
let e = 0;
|
|
2476
|
+
return this.notes.forEach((t) => {
|
|
2477
|
+
if (t.timestamp === 0) return 0;
|
|
2478
|
+
e += t.timestamp;
|
|
2479
|
+
}), e /= this.notes.length, e;
|
|
2480
|
+
}
|
|
2481
|
+
constructor(e) {
|
|
2482
|
+
e = e.filter((e) => e.type === "noteon");
|
|
2483
|
+
let t = e.reduce((e, t) => e.timestamp < t.timestamp ? e : t), n = e.reduce((e, t) => e.timestamp > t.timestamp ? e : t).timestamp - t.timestamp;
|
|
2484
|
+
if (Syllable.gracePeriod(e.length) < n) throw Error(`Notes ${e.toString()} are not close enough together to be a syllable`);
|
|
2485
|
+
this.notes = e.map((e) => ({
|
|
2486
|
+
...e,
|
|
2487
|
+
isCorrect: !0,
|
|
2488
|
+
isMissing: !1
|
|
2489
|
+
})).sort((e, t) => e.note.number - t.note.number);
|
|
2490
|
+
}
|
|
2491
|
+
static gracePeriod(e) {
|
|
2492
|
+
return 1.3 * 12 * e;
|
|
2493
|
+
}
|
|
2494
|
+
grade(e) {
|
|
2495
|
+
return this.notes.length !== e.notes.length && (e.isCorrect = !1), e.notes.forEach((t) => {
|
|
2496
|
+
let n = q.fromMidi(t.note.number), r = q.fromMidiSharps(t.note.number);
|
|
2497
|
+
n = q.pitchClass(n), r = q.pitchClass(r), t.isCorrect = this.notes.filter((e) => q.chroma(n) === q.chroma(e.note.name) || q.chroma(r) === q.chroma(e.note.name)).length >= 1, t.isCorrect || (e.isCorrect = !1);
|
|
2498
|
+
}), this.notes.forEach((t) => {
|
|
2499
|
+
let n = q.fromMidi(t.note.number);
|
|
2500
|
+
n = q.pitchClass(n), e.notes.some((e) => q.chroma(e.note.name) === q.chroma(n)) || e.notes.push({
|
|
2501
|
+
...t,
|
|
2502
|
+
isMissing: !0,
|
|
2503
|
+
isCorrect: !1
|
|
2504
|
+
});
|
|
2505
|
+
}), e;
|
|
2506
|
+
}
|
|
2507
|
+
}, Z = class SkMidi {
|
|
2508
|
+
static _instance;
|
|
2509
|
+
static OFFSET = 5;
|
|
2510
|
+
recording = [];
|
|
2511
|
+
webmidi = Ve.default;
|
|
2512
|
+
input;
|
|
2513
|
+
output;
|
|
2514
|
+
_noteonListeners = [];
|
|
2515
|
+
_noteoffListeners = [];
|
|
2516
|
+
static _initializedWithUserConfig = !1;
|
|
2517
|
+
midiAccess;
|
|
2518
|
+
_state = "initializing";
|
|
2519
|
+
get state() {
|
|
2520
|
+
return this._state;
|
|
2521
|
+
}
|
|
2522
|
+
_userLookup;
|
|
2523
|
+
constructor(e) {
|
|
2524
|
+
this._userLookup = e ?? null;
|
|
2525
|
+
}
|
|
2526
|
+
async init() {
|
|
2527
|
+
if (!this.midiAccess) try {
|
|
2528
|
+
navigator.requestMIDIAccess().then((e) => {
|
|
2529
|
+
this.midiAccess = e, this.midiAccess.onstatechange = (e) => {
|
|
2530
|
+
T({
|
|
2531
|
+
text: `Midi device ${e.port.name} is ${e.port.state}`,
|
|
2532
|
+
status: e.port.state === "connected" ? k.ok : k.error
|
|
2533
|
+
});
|
|
2534
|
+
};
|
|
2535
|
+
});
|
|
2536
|
+
} catch (e) {
|
|
2537
|
+
console.log(`Webmidi not enabled: ${e}`), this._state = "notsupported";
|
|
2538
|
+
}
|
|
2539
|
+
try {
|
|
2540
|
+
this.webmidi.disable();
|
|
2541
|
+
} catch (e) {
|
|
2542
|
+
console.log(`Webmidi not enabled: ${e}`), this._state = "notsupported";
|
|
2543
|
+
}
|
|
2544
|
+
return new Promise((e, t) => {
|
|
2545
|
+
this.webmidi.enable(async (n) => {
|
|
2546
|
+
n ? (this._state = "notsupported", console.log(`Webmidi not enabled: ${n}`), t(n)) : (console.log("Webmidi enabled"), console.log(`Inputs: ${JSON.stringify(this.webmidi.inputs)}`), console.log(`Outputs: ${JSON.stringify(this.webmidi.outputs)}`), this.output = this.webmidi.outputs[0], this.input = this.webmidi.inputs[0], SkMidi._initializedWithUserConfig ||= (await this.loadUserConfiguration(), !0), this.input && this.output ? (console.log("midi init state: ready"), this._state = "ready", this.attachListeners()) : (console.log("midi init state: nodevice"), this._state = "nodevice"), e(!0));
|
|
2547
|
+
});
|
|
2548
|
+
});
|
|
2549
|
+
}
|
|
2550
|
+
async loadUserConfiguration() {
|
|
2551
|
+
try {
|
|
2552
|
+
if (!this._userLookup) {
|
|
2553
|
+
console.log("User lookup function not provided - using default MIDI configuration");
|
|
2554
|
+
return;
|
|
2555
|
+
}
|
|
2556
|
+
let e = await this._userLookup();
|
|
2557
|
+
if (!e) {
|
|
2558
|
+
console.log("No user found, using default MIDI configuration");
|
|
2559
|
+
return;
|
|
2560
|
+
}
|
|
2561
|
+
let t = await e.getActiveCourses();
|
|
2562
|
+
for (let n of t) {
|
|
2563
|
+
let t = await (await e.getCourseInterface(n.courseID)).getCourseSettings();
|
|
2564
|
+
if (t?.midiinput || t?.midioutput) {
|
|
2565
|
+
t.midiinput && this.webmidi.getInputById(t.midiinput.toString()) && (this.selectInput(t.midiinput.toString()), console.log(`Loaded saved MIDI input: ${t.midiinput}`)), t.midioutput && this.webmidi.getOutputById(t.midioutput.toString()) && (this.selectOutput(t.midioutput.toString()), console.log(`Loaded saved MIDI output: ${t.midioutput}`));
|
|
2566
|
+
break;
|
|
2567
|
+
}
|
|
2568
|
+
}
|
|
2569
|
+
} catch (e) {
|
|
2570
|
+
console.error("Failed to load user MIDI configuration:", e);
|
|
2571
|
+
}
|
|
2572
|
+
}
|
|
2573
|
+
setStateChangeListener(e) {
|
|
2574
|
+
if (this.midiAccess) this.midiAccess.onstatechange = (t) => {
|
|
2575
|
+
this.init().then(() => {
|
|
2576
|
+
console.log(`Midi state: ${this.state}`), e();
|
|
2577
|
+
}), T({
|
|
2578
|
+
text: `Midi device ${t.port.name} is ${t.port.state}`,
|
|
2579
|
+
status: t.port.state === "connected" ? k.ok : k.error
|
|
2580
|
+
});
|
|
2581
|
+
};
|
|
2582
|
+
else try {
|
|
2583
|
+
navigator.requestMIDIAccess().then((t) => {
|
|
2584
|
+
this.midiAccess = t, this.midiAccess.onstatechange = (t) => {
|
|
2585
|
+
this.init().then(() => {
|
|
2586
|
+
console.log(`Midi state: ${this.state}`), e();
|
|
2587
|
+
}), T({
|
|
2588
|
+
text: `Midi device ${t.port.name} is ${t.port.state}`,
|
|
2589
|
+
status: t.port.state === "connected" ? k.ok : k.error
|
|
2590
|
+
});
|
|
2591
|
+
};
|
|
2592
|
+
});
|
|
2593
|
+
} catch (e) {
|
|
2594
|
+
console.log(`Webmidi not enabled: ${e}`), this._state = "notsupported";
|
|
2595
|
+
}
|
|
2596
|
+
}
|
|
2597
|
+
attachListeners() {
|
|
2598
|
+
this.input && (this._noteonListeners.forEach((e) => {
|
|
2599
|
+
this.input?.on("noteon", "all", e);
|
|
2600
|
+
}), this._noteoffListeners.forEach((e) => {
|
|
2601
|
+
this.input?.on("noteoff", "all", e);
|
|
2602
|
+
}));
|
|
2603
|
+
}
|
|
2604
|
+
get hasRecording() {
|
|
2605
|
+
return this.record.length > 0;
|
|
2606
|
+
}
|
|
2607
|
+
get configuredInput() {
|
|
2608
|
+
return this.input ? `${this.input.manufacturer}: ${this.input.name}` : "(Not Sure!)";
|
|
2609
|
+
}
|
|
2610
|
+
eraseRecording() {
|
|
2611
|
+
this.recording = [];
|
|
2612
|
+
}
|
|
2613
|
+
stopRecording() {
|
|
2614
|
+
this.input?.removeListener();
|
|
2615
|
+
}
|
|
2616
|
+
record() {
|
|
2617
|
+
let e = 0;
|
|
2618
|
+
if (this.input === void 0) throw Error("Midi input not configured!");
|
|
2619
|
+
this.input.connection === "open" && (this.stopRecording(), this.eraseRecording(), this.input.on("noteon", "all", (t) => {
|
|
2620
|
+
this.recording.length === 0 && (e = t.timestamp), this.recording.push({
|
|
2621
|
+
note: t.note,
|
|
2622
|
+
type: t.type,
|
|
2623
|
+
velocity: t.velocity,
|
|
2624
|
+
timestamp: t.timestamp - e
|
|
2625
|
+
});
|
|
2626
|
+
}), this.input.on("noteoff", "all", (t) => {
|
|
2627
|
+
this.recording.length === 0 && (e = t.timestamp), this.recording.push({
|
|
2628
|
+
note: t.note,
|
|
2629
|
+
velocity: t.velocity,
|
|
2630
|
+
type: t.type,
|
|
2631
|
+
timestamp: t.timestamp - e
|
|
2632
|
+
});
|
|
2633
|
+
}));
|
|
2634
|
+
}
|
|
2635
|
+
addNoteonListenter(e) {
|
|
2636
|
+
this._noteonListeners.push(e), this.input && this.input.on("noteon", "all", e);
|
|
2637
|
+
}
|
|
2638
|
+
addNoteoffListenter(e) {
|
|
2639
|
+
this._noteoffListeners.push(e), this.input && this.input.on("noteoff", "all", e);
|
|
2640
|
+
}
|
|
2641
|
+
play(e) {
|
|
2642
|
+
let t = e || this.recording;
|
|
2643
|
+
t = t.map((e) => ({
|
|
2644
|
+
...e,
|
|
2645
|
+
timestamp: e.timestamp + SkMidi.OFFSET
|
|
2646
|
+
})), t.forEach((e) => {
|
|
2647
|
+
e.type === "noteon" ? this.output?.playNote(e.note.name + e.note.octave, 1, {
|
|
2648
|
+
velocity: e.velocity,
|
|
2649
|
+
time: `+${e.timestamp}`,
|
|
2650
|
+
rawVelocity: !1
|
|
2651
|
+
}) : this.output?.stopNote(e.note.name + e.note.octave, 1, {
|
|
2652
|
+
velocity: e.velocity,
|
|
2653
|
+
time: `+${e.timestamp}`,
|
|
2654
|
+
rawVelocity: !1
|
|
2655
|
+
});
|
|
2656
|
+
});
|
|
2657
|
+
}
|
|
2658
|
+
static async instance() {
|
|
2659
|
+
return SkMidi._instance ? SkMidi._instance : (console.log("Buzz, whirr, Midi instance factory is at work"), SkMidi._instance = new SkMidi(), await SkMidi._instance.init(), SkMidi._instance);
|
|
2660
|
+
}
|
|
2661
|
+
get inputs() {
|
|
2662
|
+
return this.webmidi.inputs;
|
|
2663
|
+
}
|
|
2664
|
+
get outputs() {
|
|
2665
|
+
return this.webmidi.outputs;
|
|
2666
|
+
}
|
|
2667
|
+
selectInput(e) {
|
|
2668
|
+
this.webmidi.getInputById(e) === !1 ? this.webmidi.getInputByName(e) !== !1 && (this.input = this.webmidi.getInputByName(e)) : this.input = this.webmidi.getInputById(e);
|
|
2669
|
+
}
|
|
2670
|
+
selectOutput(e) {
|
|
2671
|
+
this.webmidi.getOutputById(e) === !1 ? this.webmidi.getOutputByName(e) !== !1 && (this.output = this.webmidi.getOutputByName(e)) : this.output = this.webmidi.getOutputById(e);
|
|
2672
|
+
}
|
|
2673
|
+
}, Ue = p({
|
|
2674
|
+
name: "SyllableSeqVis",
|
|
2675
|
+
props: {
|
|
2676
|
+
seq: {
|
|
2677
|
+
type: Object,
|
|
2678
|
+
required: !0
|
|
2679
|
+
},
|
|
2680
|
+
lastTSsuggestion: {
|
|
2681
|
+
type: Number,
|
|
2682
|
+
required: !1,
|
|
2683
|
+
default: 0
|
|
2684
|
+
}
|
|
2685
|
+
},
|
|
2686
|
+
setup(e) {
|
|
2687
|
+
let t = v(0), n = v(0), r = v(0), i = v(500), sayNote = (e) => {
|
|
2688
|
+
console.log(`${JSON.stringify(e)}`);
|
|
2689
|
+
}, a = o(() => {
|
|
2690
|
+
let t = e.seq.syllables[e.seq.syllables.length - 1].timestamp;
|
|
2691
|
+
return Math.max(1, t, e.lastTSsuggestion);
|
|
2692
|
+
}), s = o(() => {
|
|
2693
|
+
let t = 0, n = 500;
|
|
2694
|
+
return e.seq.syllables.forEach((e) => {
|
|
2695
|
+
e.notes.forEach((e) => {
|
|
2696
|
+
e.note.number > t && (t = e.note.number), e.note.number < n && (n = e.note.number);
|
|
2697
|
+
});
|
|
2698
|
+
}), Math.max(3 * (t - n) + 10, 0);
|
|
2699
|
+
}), updateBounds = () => {
|
|
2700
|
+
try {
|
|
2701
|
+
t.value = e.seq.syllables[0].timestamp;
|
|
2702
|
+
let r = e.seq.syllables[e.seq.syllables.length - 1].timestamp, i = t.value + e.lastTSsuggestion;
|
|
2703
|
+
n.value = Math.max(r, i);
|
|
2704
|
+
} catch (e) {
|
|
2705
|
+
console.log(`[SyllableSeqVis] Error updating bounds: ${e}`);
|
|
2706
|
+
}
|
|
2707
|
+
e.seq.syllables.forEach((e) => {
|
|
2708
|
+
e.notes.forEach((e) => {
|
|
2709
|
+
e.note.number > r.value && (r.value = e.note.number), e.note.number < i.value && (i.value = e.note.number);
|
|
2710
|
+
});
|
|
2711
|
+
});
|
|
2712
|
+
};
|
|
2713
|
+
return g(() => {
|
|
2714
|
+
console.log(`SyllableSeqVis created w/ input: \n${e.seq}`), updateBounds();
|
|
2715
|
+
}), {
|
|
2716
|
+
firstTS: t,
|
|
2717
|
+
lastTS: n,
|
|
2718
|
+
high: r,
|
|
2719
|
+
low: i,
|
|
2720
|
+
sayNote,
|
|
2721
|
+
getLastTS: a,
|
|
2722
|
+
getHeight: s,
|
|
2723
|
+
updateBounds
|
|
2724
|
+
};
|
|
2725
|
+
}
|
|
2726
|
+
}), We = ["height"], Ge = [
|
|
2727
|
+
"cx",
|
|
2728
|
+
"cy",
|
|
2729
|
+
"alt",
|
|
2730
|
+
"fill",
|
|
2731
|
+
"stroke",
|
|
2732
|
+
"onMouseenter"
|
|
2733
|
+
];
|
|
2734
|
+
function _sfc_render$3(e, t, n, r, i, o) {
|
|
2735
|
+
return _(), l("div", null, [(_(), l("svg", {
|
|
2736
|
+
width: 510,
|
|
2737
|
+
height: Math.max(3 * (e.high - e.low) + 10, 0)
|
|
2738
|
+
}, [(_(!0), l(a, null, y(e.seq.syllables, (t) => (_(), l(a, null, [(_(!0), l(a, null, y(t.notes, (n) => (_(), l("circle", {
|
|
2739
|
+
key: t.timestamp + "-" + n.note.number,
|
|
2740
|
+
cx: (t.timestamp - e.firstTS) * 500 / (e.lastTS - e.firstTS) + 4,
|
|
2741
|
+
cy: 3 * (e.high - n.note.number) + 4,
|
|
2742
|
+
alt: n.note.name,
|
|
2743
|
+
r: "3",
|
|
2744
|
+
fill: n.isCorrect ? "black" : n.isMissing ? "none" : "red",
|
|
2745
|
+
stroke: n.isMissing ? "red" : "none",
|
|
2746
|
+
onMouseenter: (t) => e.sayNote(n)
|
|
2747
|
+
}, null, 40, Ge))), 128))], 64))), 256))], 8, We))]);
|
|
2748
|
+
}
|
|
2749
|
+
n(_sfc_render$3, "_sfc_render");
|
|
2750
|
+
var Ke = /* @__PURE__ */ r(Ue, [["render", _sfc_render$3], ["__scopeId", "data-v-2f79c080"]]), qe = p({
|
|
2751
|
+
name: "NoteDisplay",
|
|
2752
|
+
props: { chroma: {
|
|
2753
|
+
type: Number,
|
|
2754
|
+
required: !0
|
|
2755
|
+
} },
|
|
2756
|
+
setup(e) {
|
|
2757
|
+
let style = (t) => {
|
|
2758
|
+
let n = "#ffffff";
|
|
2759
|
+
return t === e.chroma ? n = "#1976D2" : (t === 1 || t === 3 || t === 6 || t === 8 || t === 10 || t === -2) && (n = "#000000"), {
|
|
2760
|
+
fill: n,
|
|
2761
|
+
"fill-opacity": 1,
|
|
2762
|
+
stroke: "#000000",
|
|
2763
|
+
"stroke-width": .79375,
|
|
2764
|
+
"stroke-miterlimit": 4,
|
|
2765
|
+
"stroke-dasharray": "none",
|
|
2766
|
+
"stroke-opacity": 1
|
|
2767
|
+
};
|
|
2768
|
+
};
|
|
2769
|
+
return {
|
|
2770
|
+
style,
|
|
2771
|
+
white: -1,
|
|
2772
|
+
black: -2
|
|
2773
|
+
};
|
|
2774
|
+
}
|
|
2775
|
+
}), Je = {
|
|
2776
|
+
id: "svg8",
|
|
2777
|
+
width: "300px",
|
|
2778
|
+
height: "auto",
|
|
2779
|
+
"xmlns:dc": "http://purl.org/dc/elements/1.1/",
|
|
2780
|
+
"xmlns:cc": "http://creativecommons.org/ns#",
|
|
2781
|
+
"xmlns:rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
|
|
2782
|
+
"xmlns:svg": "http://www.w3.org/2000/svg",
|
|
2783
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2784
|
+
"xmlns:sodipodi": "http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd",
|
|
2785
|
+
"xmlns:inkscape": "http://www.inkscape.org/namespaces/inkscape",
|
|
2786
|
+
"sodipodi:docname": "keys.svg",
|
|
2787
|
+
"inkscape:version": "1.0rc1 (09960d6f05, 2020-04-09)",
|
|
2788
|
+
version: "1.1",
|
|
2789
|
+
viewBox: "0 0 175.24936 73.594925"
|
|
2790
|
+
}, Ye = { id: "metadata5" }, Xe = {
|
|
2791
|
+
id: "layer1",
|
|
2792
|
+
transform: "translate(167.75219,-151.96011)",
|
|
2793
|
+
"inkscape:groupmode": "layer",
|
|
2794
|
+
"inkscape:label": "Layer 1"
|
|
2795
|
+
};
|
|
2796
|
+
function _sfc_render$2(e, t, n, r, i, a) {
|
|
2797
|
+
let o = b("sodipodi:namedview"), s = b("dc:format"), c = b("dc:type"), p = b("dc:title"), h = b("cc:Work"), g = b("rdf:RDF");
|
|
2798
|
+
return _(), l("svg", Je, [
|
|
2799
|
+
t[1] ||= u("defs", { id: "defs2" }, null, -1),
|
|
2800
|
+
f(o, {
|
|
2801
|
+
id: "base",
|
|
2802
|
+
"inkscape:window-maximized": "1",
|
|
2803
|
+
"inkscape:window-y": "726",
|
|
2804
|
+
"inkscape:window-x": "1491",
|
|
2805
|
+
"inkscape:window-height": "1321",
|
|
2806
|
+
"inkscape:window-width": "2400",
|
|
2807
|
+
showborder: "false",
|
|
2808
|
+
showgrid: "false",
|
|
2809
|
+
"inkscape:document-rotation": "0",
|
|
2810
|
+
"inkscape:current-layer": "layer1",
|
|
2811
|
+
"inkscape:document-units": "mm",
|
|
2812
|
+
"inkscape:cy": "255.88343",
|
|
2813
|
+
"inkscape:cx": "754.94284",
|
|
2814
|
+
"inkscape:zoom": "0.98994949",
|
|
2815
|
+
"inkscape:pageshadow": "2",
|
|
2816
|
+
"inkscape:pageopacity": "0.0",
|
|
2817
|
+
borderopacity: "1.0",
|
|
2818
|
+
bordercolor: "#666666",
|
|
2819
|
+
pagecolor: "#ffffff"
|
|
2820
|
+
}),
|
|
2821
|
+
u("metadata", Ye, [f(g, null, {
|
|
2822
|
+
default: S(() => [f(h, { "rdf:about": "" }, {
|
|
2823
|
+
default: S(() => [
|
|
2824
|
+
f(s, null, {
|
|
2825
|
+
default: S(() => t[0] ||= [d("image/svg+xml")]),
|
|
2826
|
+
_: 1
|
|
2827
|
+
}),
|
|
2828
|
+
f(c, { "rdf:resource": "http://purl.org/dc/dcmitype/StillImage" }),
|
|
2829
|
+
f(p)
|
|
2830
|
+
]),
|
|
2831
|
+
_: 1
|
|
2832
|
+
})]),
|
|
2833
|
+
_: 1
|
|
2834
|
+
})]),
|
|
2835
|
+
u("g", Xe, [
|
|
2836
|
+
u("rect", {
|
|
2837
|
+
id: "rect845",
|
|
2838
|
+
y: "152.19064",
|
|
2839
|
+
x: "-150.12129",
|
|
2840
|
+
height: "73.220116",
|
|
2841
|
+
width: "17.486626",
|
|
2842
|
+
style: m(e.style(0))
|
|
2843
|
+
}, null, 4),
|
|
2844
|
+
u("rect", {
|
|
2845
|
+
id: "rect845-9",
|
|
2846
|
+
style: m(e.style(2)),
|
|
2847
|
+
width: "17.486626",
|
|
2848
|
+
height: "73.220116",
|
|
2849
|
+
x: "-132.63466",
|
|
2850
|
+
y: "152.19064"
|
|
2851
|
+
}, null, 4),
|
|
2852
|
+
u("rect", {
|
|
2853
|
+
id: "rect845-6",
|
|
2854
|
+
style: m(e.style(4)),
|
|
2855
|
+
width: "17.486626",
|
|
2856
|
+
height: "73.220116",
|
|
2857
|
+
x: "-115.14803",
|
|
2858
|
+
y: "152.19064"
|
|
2859
|
+
}, null, 4),
|
|
2860
|
+
u("rect", {
|
|
2861
|
+
id: "rect845-4",
|
|
2862
|
+
style: m(e.style(5)),
|
|
2863
|
+
width: "17.486626",
|
|
2864
|
+
height: "73.220116",
|
|
2865
|
+
x: "-97.661407",
|
|
2866
|
+
y: "152.19064"
|
|
2867
|
+
}, null, 4),
|
|
2868
|
+
u("rect", {
|
|
2869
|
+
id: "rect845-92",
|
|
2870
|
+
style: m(e.style(7)),
|
|
2871
|
+
width: "17.486626",
|
|
2872
|
+
height: "73.220116",
|
|
2873
|
+
x: "-80.174782",
|
|
2874
|
+
y: "152.19064"
|
|
2875
|
+
}, null, 4),
|
|
2876
|
+
u("rect", {
|
|
2877
|
+
id: "rect845-3",
|
|
2878
|
+
style: m(e.style(9)),
|
|
2879
|
+
width: "17.486626",
|
|
2880
|
+
height: "73.220116",
|
|
2881
|
+
x: "-62.688156",
|
|
2882
|
+
y: "152.19064"
|
|
2883
|
+
}, null, 4),
|
|
2884
|
+
u("rect", {
|
|
2885
|
+
id: "rect845-0",
|
|
2886
|
+
style: m(e.style(11)),
|
|
2887
|
+
width: "17.486626",
|
|
2888
|
+
height: "73.220116",
|
|
2889
|
+
x: "-45.20153",
|
|
2890
|
+
y: "152.19064"
|
|
2891
|
+
}, null, 4),
|
|
2892
|
+
u("rect", {
|
|
2893
|
+
id: "rect845-30",
|
|
2894
|
+
style: m(e.style(e.white)),
|
|
2895
|
+
width: "17.486626",
|
|
2896
|
+
height: "73.220116",
|
|
2897
|
+
x: "-27.714905",
|
|
2898
|
+
y: "152.10745"
|
|
2899
|
+
}, null, 4),
|
|
2900
|
+
u("rect", {
|
|
2901
|
+
id: "rect898",
|
|
2902
|
+
ry: "0",
|
|
2903
|
+
y: "152.10744",
|
|
2904
|
+
x: "-138.43532",
|
|
2905
|
+
height: "54.415863",
|
|
2906
|
+
width: "10.466455",
|
|
2907
|
+
style: m(e.style(1))
|
|
2908
|
+
}, null, 4),
|
|
2909
|
+
u("rect", {
|
|
2910
|
+
id: "rect898-3",
|
|
2911
|
+
style: m(e.style(3)),
|
|
2912
|
+
width: "10.466455",
|
|
2913
|
+
height: "54.415863",
|
|
2914
|
+
x: "-120.84978",
|
|
2915
|
+
y: "152.10744",
|
|
2916
|
+
ry: "0"
|
|
2917
|
+
}, null, 4),
|
|
2918
|
+
u("rect", {
|
|
2919
|
+
id: "rect898-7",
|
|
2920
|
+
style: m(e.style(6)),
|
|
2921
|
+
width: "10.466455",
|
|
2922
|
+
height: "54.415863",
|
|
2923
|
+
x: "-85.678711",
|
|
2924
|
+
y: "152.10744",
|
|
2925
|
+
ry: "0"
|
|
2926
|
+
}, null, 4),
|
|
2927
|
+
u("rect", {
|
|
2928
|
+
id: "rect898-8",
|
|
2929
|
+
style: m(e.style(8)),
|
|
2930
|
+
width: "10.466455",
|
|
2931
|
+
height: "54.415863",
|
|
2932
|
+
x: "-68.09317",
|
|
2933
|
+
y: "152.10744",
|
|
2934
|
+
ry: "0"
|
|
2935
|
+
}, null, 4),
|
|
2936
|
+
u("rect", {
|
|
2937
|
+
id: "rect898-1",
|
|
2938
|
+
style: m(e.style(10)),
|
|
2939
|
+
width: "10.466455",
|
|
2940
|
+
height: "54.415863",
|
|
2941
|
+
x: "-50.507633",
|
|
2942
|
+
y: "152.10744",
|
|
2943
|
+
ry: "0"
|
|
2944
|
+
}, null, 4),
|
|
2945
|
+
u("rect", {
|
|
2946
|
+
id: "rect845-30-1",
|
|
2947
|
+
y: "152.10745",
|
|
2948
|
+
x: "-10.228278",
|
|
2949
|
+
height: "73.220116",
|
|
2950
|
+
width: "17.486626",
|
|
2951
|
+
style: m(e.style(e.white))
|
|
2952
|
+
}, null, 4),
|
|
2953
|
+
u("rect", {
|
|
2954
|
+
id: "rect845-30-9",
|
|
2955
|
+
y: "152.10744",
|
|
2956
|
+
x: "-167.60791",
|
|
2957
|
+
height: "73.220116",
|
|
2958
|
+
width: "17.486626",
|
|
2959
|
+
style: m(e.style(e.white))
|
|
2960
|
+
}, null, 4),
|
|
2961
|
+
u("rect", {
|
|
2962
|
+
id: "rect898-4",
|
|
2963
|
+
style: m(e.style(e.black)),
|
|
2964
|
+
width: "10.466455",
|
|
2965
|
+
height: "54.415863",
|
|
2966
|
+
x: "-15.336554",
|
|
2967
|
+
y: "152.10744",
|
|
2968
|
+
ry: "0"
|
|
2969
|
+
}, null, 4),
|
|
2970
|
+
u("rect", {
|
|
2971
|
+
id: "rect898-74",
|
|
2972
|
+
style: m(e.style(e.black)),
|
|
2973
|
+
width: "4.4679713",
|
|
2974
|
+
height: "54.415863",
|
|
2975
|
+
x: "-167.60791",
|
|
2976
|
+
y: "152.10744",
|
|
2977
|
+
ry: "0"
|
|
2978
|
+
}, null, 4),
|
|
2979
|
+
u("rect", {
|
|
2980
|
+
id: "rect898-10",
|
|
2981
|
+
style: m(e.style(e.black)),
|
|
2982
|
+
width: "5.1863246",
|
|
2983
|
+
height: "54.507248",
|
|
2984
|
+
x: "2.2092075",
|
|
2985
|
+
y: "152.06175",
|
|
2986
|
+
ry: "0"
|
|
2987
|
+
}, null, 4)
|
|
2988
|
+
])
|
|
2989
|
+
]);
|
|
2990
|
+
}
|
|
2991
|
+
n(_sfc_render$2, "_sfc_render");
|
|
2992
|
+
//#endregion
|
|
2993
|
+
//#region src/piano/questions/echo/Playback.vue?vue&type=script&lang.ts
|
|
2994
|
+
var Ze = p({
|
|
2995
|
+
name: "Playback",
|
|
2996
|
+
components: {
|
|
2997
|
+
SyllableSeqVis: Ke,
|
|
2998
|
+
NoteDisplay: /* @__PURE__ */ r(qe, [["render", _sfc_render$2]])
|
|
2999
|
+
},
|
|
3000
|
+
props: {
|
|
3001
|
+
data: {
|
|
3002
|
+
type: Array,
|
|
3003
|
+
required: !0
|
|
3004
|
+
},
|
|
3005
|
+
modifyDifficulty: {
|
|
3006
|
+
type: Number,
|
|
3007
|
+
required: !1,
|
|
3008
|
+
default: 0
|
|
3009
|
+
}
|
|
3010
|
+
},
|
|
3011
|
+
setup(e, { emit: t }) {
|
|
3012
|
+
let n = ee(e, t, "Playback"), r = E(n), i = v(), a = v(!1), s = v("notSet"), c = v(!1), l = v(0), u = v(A.utc()), d = v(0), f = v(0), p = v(eventsToSyllableSequence([])), m = v(!1), _ = v(eventsToSyllableSequence([])), y = v(0), b = v(""), x = v(0), S = v(0), C = v(), D = v();
|
|
3013
|
+
r.question.value = new Q(e.data);
|
|
3014
|
+
let O = o(() => new Q(e.data)), te = o(() => eventsToSyllableSequence(O.value.midi).syllables[0].notes.length > 1 ? "Lowest note of first chord:" : "First note:"), j = o(() => a.value ? eventsToSyllableSequence(O.value.midi).rootNote.number % 12 : 0), init = () => {
|
|
3015
|
+
s.value ? s.value !== i.value?.state && (a.value = !1, s.value = i.value?.state || "notSet", a.value = !0) : (s.value = i.value?.state || "notSet", a.value = !0), n.logger.log(`Playback is running init with state: ${s.value}`), s.value === "ready" && (d.value = O.value.duration, play());
|
|
3016
|
+
}, runProgressBar = () => {
|
|
3017
|
+
try {
|
|
3018
|
+
C.value && (C.value.style.animationName = "", requestAnimationFrame(() => {
|
|
3019
|
+
requestAnimationFrame(() => {
|
|
3020
|
+
C.value && (C.value.style.animationDuration = d.value + "ms", C.value.style.animationName = "progress");
|
|
3021
|
+
});
|
|
3022
|
+
}));
|
|
3023
|
+
} catch {
|
|
3024
|
+
setTimeout(runProgressBar, 50);
|
|
3025
|
+
}
|
|
3026
|
+
}, record = () => {
|
|
3027
|
+
i.value?.record(), c.value = !0, i.value?.addNoteonListenter((e) => {
|
|
3028
|
+
x.value++, _.value.append(e), D.value?.updateBounds(), x.value + S.value >= O.value.midi.length && submit();
|
|
3029
|
+
}), i.value?.addNoteoffListenter(() => {
|
|
3030
|
+
S.value++, x.value + S.value >= O.value.midi.length && submit();
|
|
3031
|
+
});
|
|
3032
|
+
}, play = () => {
|
|
3033
|
+
i.value?.stopRecording(), i.value?.eraseRecording(), u.value = A.utc(), x.value = 0, S.value = 0, c.value = !1, l.value = 0, runProgressBar(), i.value?.play(O.value.midi), setTimeout(() => {
|
|
3034
|
+
n.logger.log("done playback..."), record();
|
|
3035
|
+
}, O.value.lastNoteOnTimestamp);
|
|
3036
|
+
}, submit = () => {
|
|
3037
|
+
if (!i.value?.recording) return !1;
|
|
3038
|
+
let e = eventsToSyllableSequence(O.value.midi), t = eventsToSyllableSequence(i.value.recording);
|
|
3039
|
+
return p.value = e.grade(t), _.value = eventsToSyllableSequence([]), r.submitAnswer(i.value.recording).isCorrect ? !0 : (f.value++, m.value = !0, f.value < r.maxAttemptsPerView.value && play(), !1);
|
|
3040
|
+
}, clearAttempt = () => {
|
|
3041
|
+
x.value > 0 ? submit() : play();
|
|
3042
|
+
};
|
|
3043
|
+
return g(async () => {
|
|
3044
|
+
try {
|
|
3045
|
+
i.value = await Z.instance(), i.value.setStateChangeListener(() => {
|
|
3046
|
+
init();
|
|
3047
|
+
}), a.value = !0;
|
|
3048
|
+
} catch (e) {
|
|
3049
|
+
T({
|
|
3050
|
+
status: k.error,
|
|
3051
|
+
text: "Midi device not supported"
|
|
3052
|
+
}), b.value = JSON.stringify(e), s.value = "notsupported", a.value = !0;
|
|
3053
|
+
}
|
|
3054
|
+
init(), w.addBinding([{
|
|
3055
|
+
hotkey: "space",
|
|
3056
|
+
callback: clearAttempt,
|
|
3057
|
+
command: "Clear attempt or play again"
|
|
3058
|
+
}]);
|
|
3059
|
+
}), h(() => {
|
|
3060
|
+
w.removeBinding("space");
|
|
3061
|
+
}), {
|
|
3062
|
+
...n,
|
|
3063
|
+
...r,
|
|
3064
|
+
initialized: a,
|
|
3065
|
+
state: s,
|
|
3066
|
+
recording: c,
|
|
3067
|
+
inputSeq: _,
|
|
3068
|
+
lastTSsuggestion: y,
|
|
3069
|
+
gradedSeq: p,
|
|
3070
|
+
graded: m,
|
|
3071
|
+
promptText: te,
|
|
3072
|
+
firstNoteChroma: j,
|
|
3073
|
+
progressBar: C,
|
|
3074
|
+
inputVisRef: D,
|
|
3075
|
+
clearAttempt,
|
|
3076
|
+
notesOn: x
|
|
3077
|
+
};
|
|
3078
|
+
}
|
|
3079
|
+
}), Qe = {
|
|
3080
|
+
key: 0,
|
|
3081
|
+
"data-viewable": "Playback"
|
|
3082
|
+
}, $e = { key: 0 }, et = { class: "text-h4" }, tt = { class: "text-h5" }, nt = { key: 0 }, rt = { class: "progressContainer" }, it = {
|
|
3083
|
+
id: "progress",
|
|
3084
|
+
ref: "progressBar"
|
|
3085
|
+
}, at = { key: 1 }, ot = { key: 2 };
|
|
3086
|
+
function _sfc_render$1(e, t, n, r, i, a) {
|
|
3087
|
+
let o = b("note-display"), p = b("v-icon"), m = b("v-btn"), h = b("syllable-seq-vis");
|
|
3088
|
+
return e.initialized ? (_(), l("div", Qe, [e.state === "ready" ? (_(), l("div", $e, [
|
|
3089
|
+
u("div", et, [d(x(e.promptText) + " ", 1), f(o, { chroma: e.firstNoteChroma }, null, 8, ["chroma"])]),
|
|
3090
|
+
u("div", tt, [t[0] ||= d("Listen..."), e.recording ? (_(), l("span", nt, " and Repeat")) : c("", !0)]),
|
|
3091
|
+
u("div", rt, [u("div", it, null, 512)]),
|
|
3092
|
+
f(m, {
|
|
3093
|
+
color: "primary",
|
|
3094
|
+
autofocus: "",
|
|
3095
|
+
onClick: e.clearAttempt
|
|
3096
|
+
}, {
|
|
3097
|
+
default: S(() => [t[2] ||= d(" Play again "), f(p, { end: "" }, {
|
|
3098
|
+
default: S(() => t[1] ||= [d("volume_up")]),
|
|
3099
|
+
_: 1
|
|
3100
|
+
})]),
|
|
3101
|
+
_: 1
|
|
3102
|
+
}, 8, ["onClick"]),
|
|
3103
|
+
(_(), s(h, {
|
|
3104
|
+
key: 0,
|
|
3105
|
+
ref: "inputVisRef",
|
|
3106
|
+
seq: e.inputSeq,
|
|
3107
|
+
"last-t-ssuggestion": e.lastTSsuggestion
|
|
3108
|
+
}, null, 8, ["seq", "last-t-ssuggestion"])),
|
|
3109
|
+
e.graded ? (_(), s(h, {
|
|
3110
|
+
key: 1,
|
|
3111
|
+
seq: e.gradedSeq
|
|
3112
|
+
}, null, 8, ["seq"])) : c("", !0)
|
|
3113
|
+
])) : e.state === "nodevice" ? (_(), l("div", at, "No midi device detected. Please attach one!")) : e.state === "notsupported" ? (_(), l("div", ot, t[3] ||= [u("p", null, "This exercise requires a midi input device, which is not supported by this browser ☹", -1), u("div", null, [u("p", null, "Please try again with one of the following browsers:"), u("ul", null, [
|
|
3114
|
+
u("li", null, [u("a", { href: "https://www.google.com/chrome/" }, "Google Chrome")]),
|
|
3115
|
+
u("li", null, [u("a", { href: "https://www.microsoft.com/edge" }, "Microsoft Edge")]),
|
|
3116
|
+
u("li", null, [u("a", { href: "https://brave.com/" }, "Brave")])
|
|
3117
|
+
])], -1)])) : c("", !0)])) : c("", !0);
|
|
3118
|
+
}
|
|
3119
|
+
n(_sfc_render$1, "_sfc_render");
|
|
3120
|
+
var st = /* @__PURE__ */ r(Ze, [["render", _sfc_render$1]]), ct = [{
|
|
3121
|
+
name: "Melody",
|
|
3122
|
+
type: O.MIDI
|
|
3123
|
+
}], Q = class EchoQuestion extends C {
|
|
3124
|
+
static dataShapes = [{
|
|
3125
|
+
fields: ct,
|
|
3126
|
+
name: D.PIANO_Echo
|
|
3127
|
+
}];
|
|
3128
|
+
static views = [st];
|
|
3129
|
+
midi;
|
|
3130
|
+
constructor(e) {
|
|
3131
|
+
super(e), this.midi = e[0].Melody;
|
|
3132
|
+
}
|
|
3133
|
+
get duration() {
|
|
3134
|
+
return this.midi.reduce((e, t) => t.timestamp > e.timestamp ? t : e).timestamp;
|
|
3135
|
+
}
|
|
3136
|
+
get lastNoteOnTimestamp() {
|
|
3137
|
+
return this.midi.filter((e) => e.type === "noteon").reduce((e, t) => t.timestamp > e.timestamp ? t : e).timestamp;
|
|
3138
|
+
}
|
|
3139
|
+
isCorrect(e) {
|
|
3140
|
+
let t = eventsToSyllableSequence(this.midi), n = eventsToSyllableSequence(e);
|
|
3141
|
+
try {
|
|
3142
|
+
return t.grade(n).isCorrect();
|
|
3143
|
+
} catch (e) {
|
|
3144
|
+
return console.log("ERROR grading this midi sequence!", e), !1;
|
|
3145
|
+
}
|
|
3146
|
+
}
|
|
3147
|
+
dataShapes() {
|
|
3148
|
+
return EchoQuestion.dataShapes;
|
|
3149
|
+
}
|
|
3150
|
+
views() {
|
|
3151
|
+
return EchoQuestion.views;
|
|
3152
|
+
}
|
|
3153
|
+
}, lt = p({
|
|
3154
|
+
name: "NotePlayback",
|
|
3155
|
+
components: {},
|
|
3156
|
+
props: {
|
|
3157
|
+
data: {
|
|
3158
|
+
type: Array,
|
|
3159
|
+
required: !0
|
|
3160
|
+
},
|
|
3161
|
+
modifyDifficulty: {
|
|
3162
|
+
type: Number,
|
|
3163
|
+
required: !1,
|
|
3164
|
+
default: 0
|
|
3165
|
+
}
|
|
3166
|
+
},
|
|
3167
|
+
setup(e, { emit: t }) {
|
|
3168
|
+
let n = ee(e, t, "NotePlayback"), r = E(n), i = v(), a = v(!1), s = v(!1), c = v(0), l = v(A.utc()), u = v(0), d = v(eventsToSyllableSequence([])), f = v(!1), p = v(eventsToSyllableSequence([])), m = v("");
|
|
3169
|
+
r.question.value = new $(e.data);
|
|
3170
|
+
let h = o(() => new $(e.data)), record = () => {
|
|
3171
|
+
i.value?.record(), s.value = !0, i.value?.addNoteonListenter((e) => {
|
|
3172
|
+
p.value.append(e);
|
|
3173
|
+
}), i.value?.addNoteoffListenter(() => {
|
|
3174
|
+
i.value?.recording?.length && i.value?.recording?.length >= 2 && submit();
|
|
3175
|
+
});
|
|
3176
|
+
}, play = () => {
|
|
3177
|
+
i.value?.stopRecording(), i.value?.eraseRecording(), l.value = A.utc(), s.value = !1, c.value = 0, record();
|
|
3178
|
+
}, submit = () => i.value?.recording ? (p.value = eventsToSyllableSequence([]), r.submitAnswer(i.value.recording).isCorrect ? !0 : (u.value++, f.value = !0, u.value < r.maxAttemptsPerView.value && play(), !1)) : !1;
|
|
3179
|
+
return g(async () => {
|
|
3180
|
+
try {
|
|
3181
|
+
i.value = await Z.instance(), m.value = h.value.note, play(), a.value = !0;
|
|
3182
|
+
} catch (e) {
|
|
3183
|
+
n.logger.error("Failed to initialize MIDI:", e);
|
|
3184
|
+
}
|
|
3185
|
+
}), {
|
|
3186
|
+
...n,
|
|
3187
|
+
...r,
|
|
3188
|
+
initialized: a,
|
|
3189
|
+
recording: s,
|
|
3190
|
+
inputSeq: p,
|
|
3191
|
+
gradedSeq: d,
|
|
3192
|
+
graded: f,
|
|
3193
|
+
note: m,
|
|
3194
|
+
attempts: u
|
|
3195
|
+
};
|
|
3196
|
+
}
|
|
3197
|
+
}), ut = { "data-viewable": "NotePlayback" }, dt = { class: "text-h4" }, ft = { class: "font-weight-bold" }, pt = {
|
|
3198
|
+
key: 0,
|
|
3199
|
+
id: "svg8",
|
|
3200
|
+
width: "300px",
|
|
3201
|
+
height: "auto",
|
|
3202
|
+
"xmlns:dc": "http://purl.org/dc/elements/1.1/",
|
|
3203
|
+
"xmlns:cc": "http://creativecommons.org/ns#",
|
|
3204
|
+
"xmlns:rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
|
|
3205
|
+
"xmlns:svg": "http://www.w3.org/2000/svg",
|
|
3206
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3207
|
+
"xmlns:sodipodi": "http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd",
|
|
3208
|
+
"xmlns:inkscape": "http://www.inkscape.org/namespaces/inkscape",
|
|
3209
|
+
"sodipodi:docname": "keys.svg",
|
|
3210
|
+
"inkscape:version": "1.0rc1 (09960d6f05, 2020-04-09)",
|
|
3211
|
+
version: "1.1",
|
|
3212
|
+
viewBox: "0 0 175.24936 73.594925"
|
|
3213
|
+
}, mt = { id: "metadata5" };
|
|
3214
|
+
function _sfc_render(e, t, n, r, i, a) {
|
|
3215
|
+
let o = b("sodipodi:namedview"), s = b("dc:format"), p = b("dc:type"), m = b("dc:title"), h = b("cc:Work"), g = b("rdf:RDF");
|
|
3216
|
+
return _(), l("div", ut, [u("div", dt, [t[0] ||= d(" Play the note: "), u("span", ft, x(e.note), 1)]), e.graded ? (_(), l("svg", pt, [
|
|
3217
|
+
t[2] ||= u("defs", { id: "defs2" }, null, -1),
|
|
3218
|
+
f(o, {
|
|
3219
|
+
id: "base",
|
|
3220
|
+
"inkscape:window-maximized": "1",
|
|
3221
|
+
"inkscape:window-y": "726",
|
|
3222
|
+
"inkscape:window-x": "1491",
|
|
3223
|
+
"inkscape:window-height": "1321",
|
|
3224
|
+
"inkscape:window-width": "2400",
|
|
3225
|
+
showborder: "false",
|
|
3226
|
+
showgrid: "false",
|
|
3227
|
+
"inkscape:document-rotation": "0",
|
|
3228
|
+
"inkscape:current-layer": "layer1",
|
|
3229
|
+
"inkscape:document-units": "mm",
|
|
3230
|
+
"inkscape:cy": "255.88343",
|
|
3231
|
+
"inkscape:cx": "754.94284",
|
|
3232
|
+
"inkscape:zoom": "0.98994949",
|
|
3233
|
+
"inkscape:pageshadow": "2",
|
|
3234
|
+
"inkscape:pageopacity": "0.0",
|
|
3235
|
+
borderopacity: "1.0",
|
|
3236
|
+
bordercolor: "#666666",
|
|
3237
|
+
pagecolor: "#ffffff"
|
|
3238
|
+
}),
|
|
3239
|
+
u("metadata", mt, [f(g, null, {
|
|
3240
|
+
default: S(() => [f(h, { "rdf:about": "" }, {
|
|
3241
|
+
default: S(() => [
|
|
3242
|
+
f(s, null, {
|
|
3243
|
+
default: S(() => t[1] ||= [d("image/svg+xml")]),
|
|
3244
|
+
_: 1
|
|
3245
|
+
}),
|
|
3246
|
+
f(p, { "rdf:resource": "http://purl.org/dc/dcmitype/StillImage" }),
|
|
3247
|
+
f(m)
|
|
3248
|
+
]),
|
|
3249
|
+
_: 1
|
|
3250
|
+
})]),
|
|
3251
|
+
_: 1
|
|
3252
|
+
})]),
|
|
3253
|
+
t[3] ||= u("g", {
|
|
3254
|
+
id: "layer1",
|
|
3255
|
+
transform: "translate(167.75219,-151.96011)",
|
|
3256
|
+
"inkscape:groupmode": "layer",
|
|
3257
|
+
"inkscape:label": "Layer 1"
|
|
3258
|
+
}, [
|
|
3259
|
+
u("rect", {
|
|
3260
|
+
id: "rect845",
|
|
3261
|
+
y: "152.19064",
|
|
3262
|
+
x: "-150.12129",
|
|
3263
|
+
height: "73.220116",
|
|
3264
|
+
width: "17.486626",
|
|
3265
|
+
style: {
|
|
3266
|
+
fill: "#ffffff",
|
|
3267
|
+
"fill-opacity": "0",
|
|
3268
|
+
stroke: "#000000",
|
|
3269
|
+
"stroke-width": "0.79375",
|
|
3270
|
+
"stroke-miterlimit": "4",
|
|
3271
|
+
"stroke-dasharray": "none",
|
|
3272
|
+
"stroke-opacity": "1"
|
|
3273
|
+
}
|
|
3274
|
+
}),
|
|
3275
|
+
u("rect", {
|
|
3276
|
+
id: "rect845-9",
|
|
3277
|
+
style: {
|
|
3278
|
+
fill: "#ffffff",
|
|
3279
|
+
"fill-opacity": "0",
|
|
3280
|
+
stroke: "#000000",
|
|
3281
|
+
"stroke-width": "0.79375",
|
|
3282
|
+
"stroke-miterlimit": "4",
|
|
3283
|
+
"stroke-dasharray": "none",
|
|
3284
|
+
"stroke-opacity": "1"
|
|
3285
|
+
},
|
|
3286
|
+
width: "17.486626",
|
|
3287
|
+
height: "73.220116",
|
|
3288
|
+
x: "-132.63466",
|
|
3289
|
+
y: "152.19064"
|
|
3290
|
+
}),
|
|
3291
|
+
u("rect", {
|
|
3292
|
+
id: "rect845-6",
|
|
3293
|
+
style: {
|
|
3294
|
+
fill: "#ffffff",
|
|
3295
|
+
"fill-opacity": "0",
|
|
3296
|
+
stroke: "#000000",
|
|
3297
|
+
"stroke-width": "0.79375",
|
|
3298
|
+
"stroke-miterlimit": "4",
|
|
3299
|
+
"stroke-dasharray": "none",
|
|
3300
|
+
"stroke-opacity": "1"
|
|
3301
|
+
},
|
|
3302
|
+
width: "17.486626",
|
|
3303
|
+
height: "73.220116",
|
|
3304
|
+
x: "-115.14803",
|
|
3305
|
+
y: "152.19064"
|
|
3306
|
+
}),
|
|
3307
|
+
u("rect", {
|
|
3308
|
+
id: "rect845-0",
|
|
3309
|
+
style: {
|
|
3310
|
+
fill: "#ffffff",
|
|
3311
|
+
"fill-opacity": "0",
|
|
3312
|
+
stroke: "#000000",
|
|
3313
|
+
"stroke-width": "0.79375",
|
|
3314
|
+
"stroke-miterlimit": "4",
|
|
3315
|
+
"stroke-dasharray": "none",
|
|
3316
|
+
"stroke-opacity": "1"
|
|
3317
|
+
},
|
|
3318
|
+
width: "17.486626",
|
|
3319
|
+
height: "73.220116",
|
|
3320
|
+
x: "-45.20153",
|
|
3321
|
+
y: "152.19064"
|
|
3322
|
+
}),
|
|
3323
|
+
u("rect", {
|
|
3324
|
+
id: "rect845-92",
|
|
3325
|
+
style: {
|
|
3326
|
+
fill: "#ffffff",
|
|
3327
|
+
"fill-opacity": "0",
|
|
3328
|
+
stroke: "#000000",
|
|
3329
|
+
"stroke-width": "0.79375",
|
|
3330
|
+
"stroke-miterlimit": "4",
|
|
3331
|
+
"stroke-dasharray": "none",
|
|
3332
|
+
"stroke-opacity": "1"
|
|
3333
|
+
},
|
|
3334
|
+
width: "17.486626",
|
|
3335
|
+
height: "73.220116",
|
|
3336
|
+
x: "-80.174782",
|
|
3337
|
+
y: "152.19064"
|
|
3338
|
+
}),
|
|
3339
|
+
u("rect", {
|
|
3340
|
+
id: "rect845-3",
|
|
3341
|
+
style: {
|
|
3342
|
+
fill: "#ffffff",
|
|
3343
|
+
"fill-opacity": "0",
|
|
3344
|
+
stroke: "#000000",
|
|
3345
|
+
"stroke-width": "0.79375",
|
|
3346
|
+
"stroke-miterlimit": "4",
|
|
3347
|
+
"stroke-dasharray": "none",
|
|
3348
|
+
"stroke-opacity": "1"
|
|
3349
|
+
},
|
|
3350
|
+
width: "17.486626",
|
|
3351
|
+
height: "73.220116",
|
|
3352
|
+
x: "-62.688156",
|
|
3353
|
+
y: "152.19064"
|
|
3354
|
+
}),
|
|
3355
|
+
u("rect", {
|
|
3356
|
+
id: "rect845-4",
|
|
3357
|
+
style: {
|
|
3358
|
+
fill: "#ffffff",
|
|
3359
|
+
"fill-opacity": "0",
|
|
3360
|
+
stroke: "#000000",
|
|
3361
|
+
"stroke-width": "0.79375",
|
|
3362
|
+
"stroke-miterlimit": "4",
|
|
3363
|
+
"stroke-dasharray": "none",
|
|
3364
|
+
"stroke-opacity": "1"
|
|
3365
|
+
},
|
|
3366
|
+
width: "17.486626",
|
|
3367
|
+
height: "73.220116",
|
|
3368
|
+
x: "-97.661407",
|
|
3369
|
+
y: "152.19064"
|
|
3370
|
+
}),
|
|
3371
|
+
u("rect", {
|
|
3372
|
+
id: "rect845-30",
|
|
3373
|
+
style: {
|
|
3374
|
+
fill: "#ffffff",
|
|
3375
|
+
"fill-opacity": "0",
|
|
3376
|
+
stroke: "#000000",
|
|
3377
|
+
"stroke-width": "0.79375",
|
|
3378
|
+
"stroke-miterlimit": "4",
|
|
3379
|
+
"stroke-dasharray": "none",
|
|
3380
|
+
"stroke-opacity": "1"
|
|
3381
|
+
},
|
|
3382
|
+
width: "17.486626",
|
|
3383
|
+
height: "73.220116",
|
|
3384
|
+
x: "-27.714905",
|
|
3385
|
+
y: "152.10745"
|
|
3386
|
+
}),
|
|
3387
|
+
u("rect", {
|
|
3388
|
+
id: "rect898",
|
|
3389
|
+
ry: "0",
|
|
3390
|
+
y: "152.10744",
|
|
3391
|
+
x: "-138.43532",
|
|
3392
|
+
height: "54.415863",
|
|
3393
|
+
width: "10.466455",
|
|
3394
|
+
style: {
|
|
3395
|
+
fill: "#000000",
|
|
3396
|
+
"fill-opacity": "1",
|
|
3397
|
+
stroke: "#000000",
|
|
3398
|
+
"stroke-width": "0.79375",
|
|
3399
|
+
"stroke-miterlimit": "4",
|
|
3400
|
+
"stroke-dasharray": "none",
|
|
3401
|
+
"stroke-opacity": "1"
|
|
3402
|
+
}
|
|
3403
|
+
}),
|
|
3404
|
+
u("rect", {
|
|
3405
|
+
id: "rect898-3",
|
|
3406
|
+
style: {
|
|
3407
|
+
fill: "#000000",
|
|
3408
|
+
"fill-opacity": "1",
|
|
3409
|
+
stroke: "#000000",
|
|
3410
|
+
"stroke-width": "0.79375",
|
|
3411
|
+
"stroke-miterlimit": "4",
|
|
3412
|
+
"stroke-dasharray": "none",
|
|
3413
|
+
"stroke-opacity": "1"
|
|
3414
|
+
},
|
|
3415
|
+
width: "10.466455",
|
|
3416
|
+
height: "54.415863",
|
|
3417
|
+
x: "-120.84978",
|
|
3418
|
+
y: "152.10744",
|
|
3419
|
+
ry: "0"
|
|
3420
|
+
}),
|
|
3421
|
+
u("rect", {
|
|
3422
|
+
id: "rect898-7",
|
|
3423
|
+
style: {
|
|
3424
|
+
fill: "#000000",
|
|
3425
|
+
"fill-opacity": "1",
|
|
3426
|
+
stroke: "#000000",
|
|
3427
|
+
"stroke-width": "0.79375",
|
|
3428
|
+
"stroke-miterlimit": "4",
|
|
3429
|
+
"stroke-dasharray": "none",
|
|
3430
|
+
"stroke-opacity": "1"
|
|
3431
|
+
},
|
|
3432
|
+
width: "10.466455",
|
|
3433
|
+
height: "54.415863",
|
|
3434
|
+
x: "-85.678711",
|
|
3435
|
+
y: "152.10744",
|
|
3436
|
+
ry: "0"
|
|
3437
|
+
}),
|
|
3438
|
+
u("rect", {
|
|
3439
|
+
id: "rect898-8",
|
|
3440
|
+
style: {
|
|
3441
|
+
fill: "#000000",
|
|
3442
|
+
"fill-opacity": "1",
|
|
3443
|
+
stroke: "#000000",
|
|
3444
|
+
"stroke-width": "0.79375",
|
|
3445
|
+
"stroke-miterlimit": "4",
|
|
3446
|
+
"stroke-dasharray": "none",
|
|
3447
|
+
"stroke-opacity": "1"
|
|
3448
|
+
},
|
|
3449
|
+
width: "10.466455",
|
|
3450
|
+
height: "54.415863",
|
|
3451
|
+
x: "-68.09317",
|
|
3452
|
+
y: "152.10744",
|
|
3453
|
+
ry: "0"
|
|
3454
|
+
}),
|
|
3455
|
+
u("rect", {
|
|
3456
|
+
id: "rect898-1",
|
|
3457
|
+
style: {
|
|
3458
|
+
fill: "#000000",
|
|
3459
|
+
"fill-opacity": "1",
|
|
3460
|
+
stroke: "#000000",
|
|
3461
|
+
"stroke-width": "0.79375",
|
|
3462
|
+
"stroke-miterlimit": "4",
|
|
3463
|
+
"stroke-dasharray": "none",
|
|
3464
|
+
"stroke-opacity": "1"
|
|
3465
|
+
},
|
|
3466
|
+
width: "10.466455",
|
|
3467
|
+
height: "54.415863",
|
|
3468
|
+
x: "-50.507633",
|
|
3469
|
+
y: "152.10744",
|
|
3470
|
+
ry: "0"
|
|
3471
|
+
}),
|
|
3472
|
+
u("rect", {
|
|
3473
|
+
id: "rect845-30-1",
|
|
3474
|
+
y: "152.10745",
|
|
3475
|
+
x: "-10.228278",
|
|
3476
|
+
height: "73.220116",
|
|
3477
|
+
width: "17.486626",
|
|
3478
|
+
style: {
|
|
3479
|
+
fill: "#ffffff",
|
|
3480
|
+
"fill-opacity": "0",
|
|
3481
|
+
stroke: "#000000",
|
|
3482
|
+
"stroke-width": "0.79375",
|
|
3483
|
+
"stroke-miterlimit": "4",
|
|
3484
|
+
"stroke-dasharray": "none",
|
|
3485
|
+
"stroke-opacity": "1"
|
|
3486
|
+
}
|
|
3487
|
+
}),
|
|
3488
|
+
u("rect", {
|
|
3489
|
+
id: "rect845-30-9",
|
|
3490
|
+
y: "152.10744",
|
|
3491
|
+
x: "-167.60791",
|
|
3492
|
+
height: "73.220116",
|
|
3493
|
+
width: "17.486626",
|
|
3494
|
+
style: {
|
|
3495
|
+
fill: "#ffffff",
|
|
3496
|
+
"fill-opacity": "0",
|
|
3497
|
+
stroke: "#000000",
|
|
3498
|
+
"stroke-width": "0.79375",
|
|
3499
|
+
"stroke-miterlimit": "4",
|
|
3500
|
+
"stroke-dasharray": "none",
|
|
3501
|
+
"stroke-opacity": "1"
|
|
3502
|
+
}
|
|
3503
|
+
}),
|
|
3504
|
+
u("rect", {
|
|
3505
|
+
id: "rect898-4",
|
|
3506
|
+
style: {
|
|
3507
|
+
fill: "#000000",
|
|
3508
|
+
"fill-opacity": "1",
|
|
3509
|
+
stroke: "#000000",
|
|
3510
|
+
"stroke-width": "0.79375",
|
|
3511
|
+
"stroke-miterlimit": "4",
|
|
3512
|
+
"stroke-dasharray": "none",
|
|
3513
|
+
"stroke-opacity": "1"
|
|
3514
|
+
},
|
|
3515
|
+
width: "10.466455",
|
|
3516
|
+
height: "54.415863",
|
|
3517
|
+
x: "-15.336554",
|
|
3518
|
+
y: "152.10744",
|
|
3519
|
+
ry: "0"
|
|
3520
|
+
}),
|
|
3521
|
+
u("rect", {
|
|
3522
|
+
id: "rect898-74",
|
|
3523
|
+
style: {
|
|
3524
|
+
fill: "#000000",
|
|
3525
|
+
"fill-opacity": "1",
|
|
3526
|
+
stroke: "#000000",
|
|
3527
|
+
"stroke-width": "0.79375",
|
|
3528
|
+
"stroke-miterlimit": "4",
|
|
3529
|
+
"stroke-dasharray": "none",
|
|
3530
|
+
"stroke-opacity": "1"
|
|
3531
|
+
},
|
|
3532
|
+
width: "4.4679713",
|
|
3533
|
+
height: "54.415863",
|
|
3534
|
+
x: "-167.60791",
|
|
3535
|
+
y: "152.10744",
|
|
3536
|
+
ry: "0"
|
|
3537
|
+
}),
|
|
3538
|
+
u("rect", {
|
|
3539
|
+
id: "rect898-10",
|
|
3540
|
+
style: {
|
|
3541
|
+
fill: "#000000",
|
|
3542
|
+
"fill-opacity": "1",
|
|
3543
|
+
stroke: "#000000",
|
|
3544
|
+
"stroke-width": "0.79375",
|
|
3545
|
+
"stroke-miterlimit": "4",
|
|
3546
|
+
"stroke-dasharray": "none",
|
|
3547
|
+
"stroke-opacity": "1"
|
|
3548
|
+
},
|
|
3549
|
+
width: "5.1863246",
|
|
3550
|
+
height: "54.507248",
|
|
3551
|
+
x: "2.2092075",
|
|
3552
|
+
y: "152.06175",
|
|
3553
|
+
ry: "0"
|
|
3554
|
+
})
|
|
3555
|
+
], -1)
|
|
3556
|
+
])) : c("", !0)]);
|
|
3557
|
+
}
|
|
3558
|
+
var ht = /* @__PURE__ */ r(lt, [["render", _sfc_render]]), gt = [{
|
|
3559
|
+
name: "Note",
|
|
3560
|
+
type: O.STRING
|
|
3561
|
+
}], _t = [
|
|
3562
|
+
"A",
|
|
3563
|
+
"B",
|
|
3564
|
+
"C",
|
|
3565
|
+
"D",
|
|
3566
|
+
"E",
|
|
3567
|
+
"F",
|
|
3568
|
+
"G",
|
|
3569
|
+
"A♯",
|
|
3570
|
+
"C♯",
|
|
3571
|
+
"D♯",
|
|
3572
|
+
"F♯",
|
|
3573
|
+
"G♯",
|
|
3574
|
+
"D♭",
|
|
3575
|
+
"E♭",
|
|
3576
|
+
"G♭",
|
|
3577
|
+
"A♭",
|
|
3578
|
+
"B♭"
|
|
3579
|
+
], $ = class PlayNote extends C {
|
|
3580
|
+
static dataShapes = [{
|
|
3581
|
+
fields: gt,
|
|
3582
|
+
name: D.PIANO_PlayNote
|
|
3583
|
+
}];
|
|
3584
|
+
static seedData = _t.map((e) => ({ Note: e }));
|
|
3585
|
+
static views = [ht];
|
|
3586
|
+
note;
|
|
3587
|
+
constructor(e) {
|
|
3588
|
+
super(e), this.note = e[0].Note;
|
|
3589
|
+
}
|
|
3590
|
+
isCorrect(e) {
|
|
3591
|
+
return e[0].note.name === this.note;
|
|
3592
|
+
}
|
|
3593
|
+
dataShapes() {
|
|
3594
|
+
return PlayNote.dataShapes;
|
|
3595
|
+
}
|
|
3596
|
+
views() {
|
|
3597
|
+
return PlayNote.views;
|
|
3598
|
+
}
|
|
3599
|
+
}, vt = new i("piano", [Q, $]);
|
|
3600
|
+
//#endregion
|
|
3601
|
+
export { eventsToSyllableSequence as a, He as i, Ke as n, transposeSyllableSeq as o, Z as r, vt as t };
|
|
3602
|
+
|
|
3603
|
+
//# sourceMappingURL=piano-DF1g6yaX.js.map
|