@kidlib/web-audio 0.1.0 → 0.1.2

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/io.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  declare type AudioInputDevice = DeviceInfo & {
2
- kind: 'audioinput';
2
+ kind: "audioinput";
3
3
  };
4
4
 
5
5
  declare type AudioOutputDevice = DeviceInfo & {
6
- kind: 'audiooutput';
6
+ kind: "audiooutput";
7
7
  };
8
8
 
9
9
  export declare const chromaticKeymap: KeyMap;
@@ -11,7 +11,7 @@ export declare const chromaticKeymap: KeyMap;
11
11
  export declare type ControlCallback = (value: number, event: ControlChangeEvent) => void;
12
12
 
13
13
  export declare type ControlChangeEvent = {
14
- type: 'controlchange';
14
+ type: "controlchange";
15
15
  controller: number;
16
16
  normalizedValue: number;
17
17
  midiValue: number;
@@ -81,7 +81,7 @@ export declare class InputController {
81
81
  onNoteOff(handler: NoteHandler): () => void;
82
82
  onControlChange(handler: ControlChangeHandler): () => void;
83
83
  onSustainPedal(handler: SustainPedalHandler): () => void;
84
- registerNoteTarget(target: NoteTarget, channel?: number | 'all'): () => void;
84
+ registerNoteTarget(target: NoteTarget, channel?: number | "all"): () => void;
85
85
  /**
86
86
  * Register one or more control targets to respond to MIDI CC messages.
87
87
  *
@@ -116,7 +116,7 @@ export declare class InputController {
116
116
  * inputController.registerControlTarget({ setValue: (v) => slider.value = v }, { controller: 15 });
117
117
  */
118
118
  registerControlTarget(target: ControlTarget | ControlTarget[], options: RegisterControlOptions): () => void;
119
- registerSustainPedalTarget(target: SustainPedalTarget, channel?: number | 'all'): () => void;
119
+ registerSustainPedalTarget(target: SustainPedalTarget, channel?: number | "all"): () => void;
120
120
  get initialized(): boolean;
121
121
  get midiSupported(): boolean;
122
122
  get supportInfo(): {
@@ -142,7 +142,7 @@ export declare function isMidiSupported(): boolean;
142
142
 
143
143
  export declare type KeyMap = Record<string, number>;
144
144
 
145
- export declare type KeymapKey = 'piano' | 'major' | 'minor' | 'pentatonic' | 'chromatic';
145
+ export declare type KeymapKey = "piano" | "major" | "minor" | "pentatonic" | "chromatic";
146
146
 
147
147
  export declare const keymaps: Record<KeymapKey, KeyMap>;
148
148
 
@@ -155,7 +155,7 @@ export declare const majorKeymap: KeyMap;
155
155
 
156
156
  export declare const minorKeymap: KeyMap;
157
157
 
158
- export declare type ModifierKey = 'space' | 'caps' | 'meta' | 'shift' | 'ctrl' | 'alt';
158
+ export declare type ModifierKey = "space" | "caps" | "meta" | "shift" | "ctrl" | "alt";
159
159
 
160
160
  /**
161
161
  * MIDI Input Controller - Clean, Flexible API
@@ -189,7 +189,7 @@ export declare type ModifierKey = 'space' | 'caps' | 'meta' | 'shift' | 'ctrl' |
189
189
  * });
190
190
  */
191
191
  export declare type NoteEvent = {
192
- type: 'noteon' | 'noteoff';
192
+ type: "noteon" | "noteoff";
193
193
  note: number;
194
194
  velocity: number;
195
195
  channel: number;
@@ -211,7 +211,7 @@ export declare type PressedModifiers = Partial<Record<ModifierKey, boolean>>;
211
211
 
212
212
  declare type RegisterControlOptions = {
213
213
  controller: number | number[];
214
- channel?: number | 'all';
214
+ channel?: number | "all";
215
215
  transformValue?: (event: ControlChangeEvent) => number;
216
216
  };
217
217
 
@@ -220,7 +220,7 @@ export declare type SimpleControlTarget = {
220
220
  };
221
221
 
222
222
  export declare type SustainPedalEvent = {
223
- type: 'sustainpedal';
223
+ type: "sustainpedal";
224
224
  pressed: boolean;
225
225
  channel: number;
226
226
  raw: any;
@@ -233,7 +233,7 @@ export declare type SustainPedalTarget = {
233
233
  };
234
234
 
235
235
  declare type VideoInputDevice = DeviceInfo & {
236
- kind: 'videoinput';
236
+ kind: "videoinput";
237
237
  };
238
238
 
239
239
  export { }
package/dist/io.js CHANGED
@@ -1,193 +1,131 @@
1
- var M = (t) => {
2
- throw TypeError(t);
3
- };
4
- var w = (t, e, r) => e.has(t) || M("Cannot " + r);
5
- var s = (t, e, r) => (w(t, e, "read from private field"), r ? r.call(t) : e.get(t)), d = (t, e, r) => e.has(t) ? M("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, r), S = (t, e, r, a) => (w(t, e, "write to private field"), a ? a.call(t, r) : e.set(t, r), r), f = (t, e, r) => (w(t, e, "access private method"), r);
6
- import { D as F, c as T, d as H, a as L, b as j, e as Y, f as _, h as $, i as q, g as B, j as G, k as R, m as J, l as Q, o as X, p as Z } from "./keymap-3lZMR1Ak.js";
7
- import { WebMidi as V } from "webmidi";
8
- function A() {
9
- return typeof navigator < "u" && typeof navigator.requestMIDIAccess == "function";
1
+ import { a as e, c as t, d as n, f as r, g as i, h as a, i as o, l as s, m as c, n as l, o as u, p as d, r as f, s as p, t as m, u as h } from "./keymap-C9_BObLQ.js";
2
+ import { WebMidi as g } from "webmidi";
3
+ //#region src/io/midi/input-controller.ts
4
+ function _() {
5
+ return typeof navigator < "u" && typeof navigator.requestMIDIAccess == "function";
10
6
  }
11
- function O() {
12
- const t = navigator.userAgent, e = /Chrome/.test(t) && /Google Inc/.test(navigator.vendor || ""), r = /Edg/.test(t), a = /OPR/.test(t), n = /Safari/.test(t) && !/Chrome/.test(t), o = /Firefox/.test(t);
13
- let u = "Unknown";
14
- e ? u = "Chrome" : r ? u = "Edge" : a ? u = "Opera" : n ? u = "Safari" : o && (u = "Firefox");
15
- const m = A();
16
- let l = "";
17
- return m || (n ? l = "Safari doesn't support Web MIDI API. Use Chrome, Edge, or Opera for MIDI functionality." : o ? l = "Firefox has limited Web MIDI API support. Use Chrome, Edge, or Opera for full MIDI functionality." : l = "Web MIDI API not supported in this browser."), { supported: m, browserName: u, message: l };
7
+ function v() {
8
+ let e = navigator.userAgent, t = /Chrome/.test(e) && /Google Inc/.test(navigator.vendor || ""), n = /Edg/.test(e), r = /OPR/.test(e), i = /Safari/.test(e) && !/Chrome/.test(e), a = /Firefox/.test(e), o = "Unknown";
9
+ t ? o = "Chrome" : n ? o = "Edge" : r ? o = "Opera" : i ? o = "Safari" : a && (o = "Firefox");
10
+ let s = _(), c = "";
11
+ return s || (c = i ? "Safari doesn't support Web MIDI API. Use Chrome, Edge, or Opera for MIDI functionality." : a ? "Firefox has limited Web MIDI API support. Use Chrome, Edge, or Opera for full MIDI functionality." : "Web MIDI API not supported in this browser."), {
12
+ supported: s,
13
+ browserName: o,
14
+ message: c
15
+ };
18
16
  }
19
- var y, b, I, h, p, i, E, D, P, z, C;
20
- class N {
21
- constructor() {
22
- d(this, i);
23
- d(this, y, !1);
24
- d(this, b, /* @__PURE__ */ new Set());
25
- d(this, I, /* @__PURE__ */ new Set());
26
- d(this, h, /* @__PURE__ */ new Set());
27
- d(this, p, /* @__PURE__ */ new Set());
28
- }
29
- async init() {
30
- if (s(this, y)) return !0;
31
- if (!A()) {
32
- const { browserName: e, message: r } = O();
33
- return console.warn(`InputController: ${r} (Browser: ${e})`), !1;
34
- }
35
- try {
36
- await V.enable();
37
- } catch (e) {
38
- return console.warn("InputController: WebMIDI enable failed", e), !1;
39
- }
40
- return V.enabled ? (S(this, y, !0), f(this, i, E).call(this), !0) : (console.warn("InputController: WebMIDI not enabled"), !1);
41
- }
42
- onNoteOn(e) {
43
- return s(this, b).add(e), () => s(this, b).delete(e);
44
- }
45
- onNoteOff(e) {
46
- return s(this, I).add(e), () => s(this, I).delete(e);
47
- }
48
- onControlChange(e) {
49
- return s(this, h).add(e), () => s(this, h).delete(e);
50
- }
51
- onSustainPedal(e) {
52
- return s(this, p).add(e), () => s(this, p).delete(e);
53
- }
54
- registerNoteTarget(e, r = "all") {
55
- const a = this.onNoteOn((o) => {
56
- f(this, i, C).call(this, r, o.channel) && e.play(o.note, o.velocity ?? 0);
57
- }), n = this.onNoteOff((o) => {
58
- f(this, i, C).call(this, r, o.channel) && e.release(o.note);
59
- });
60
- return () => {
61
- a(), n();
62
- };
63
- }
64
- /**
65
- * Register one or more control targets to respond to MIDI CC messages.
66
- *
67
- * By default, passes normalized values (0-1) to targets. Use transformValue for custom behavior.
68
- *
69
- * Supports multiple target types for maximum flexibility:
70
- *
71
- * @example
72
- * // Knobs - automatically calls setValueNormalized if available
73
- * inputController.registerControlTarget(knobElement, { controller: 15 });
74
- *
75
- * @example
76
- * // Simple callback function - cleanest for custom logic
77
- * inputController.registerControlTarget(
78
- * (value, event) => console.log(`CC${event.controller}: ${value}`),
79
- * { controller: 15 }
80
- * );
81
- *
82
- * @example
83
- * // Multiple targets controlled by same CC
84
- * inputController.registerControlTarget([knob1, knob2], { controller: 15 });
85
- *
86
- * @example
87
- * // Raw MIDI values (0-127) instead of normalized (0-1)
88
- * inputController.registerControlTarget(knobElement, {
89
- * controller: 15,
90
- * transformValue: (event) => event.midiValue
91
- * });
92
- *
93
- * @example
94
- * // Object with setValue method (sliders, etc.)
95
- * inputController.registerControlTarget({ setValue: (v) => slider.value = v }, { controller: 15 });
96
- */
97
- registerControlTarget(e, r) {
98
- const a = Array.isArray(e) ? e : [e], n = Array.isArray(r.controller) ? r.controller : [r.controller], o = r.channel ?? "all", u = r.transformValue ?? ((l) => l.normalizedValue);
99
- return this.onControlChange((l) => {
100
- if (!n.includes(l.controller) || !f(this, i, C).call(this, o, l.channel)) return;
101
- const g = u(l);
102
- a.forEach((c) => {
103
- typeof c == "function" ? c(g, l) : "onControlChange" in c ? c.onControlChange(g, l) : "setValueNormalized" in c && c.setValueNormalized ? c.setValueNormalized(g) : "setValue" in c && c.setValue && c.setValue(g);
104
- });
105
- });
106
- }
107
- registerSustainPedalTarget(e, r = "all") {
108
- return this.onSustainPedal((n) => {
109
- f(this, i, C).call(this, r, n.channel) && e.setSustainPedal(n.pressed);
110
- });
111
- }
112
- get initialized() {
113
- return s(this, y);
114
- }
115
- get midiSupported() {
116
- return A();
117
- }
118
- get supportInfo() {
119
- return O();
120
- }
121
- }
122
- y = new WeakMap(), b = new WeakMap(), I = new WeakMap(), h = new WeakMap(), p = new WeakMap(), i = new WeakSet(), E = function() {
123
- V.inputs.forEach((e) => {
124
- e && (e.addListener("noteon", (r) => {
125
- f(this, i, D).call(this, s(this, b), r, "noteon");
126
- }), e.addListener("noteoff", (r) => {
127
- f(this, i, D).call(this, s(this, I), r, "noteoff");
128
- }), e.addListener("controlchange", (r) => {
129
- var n, o;
130
- (((n = r.controller) == null ? void 0 : n.number) ?? ((o = r.controller) == null ? void 0 : o.value) ?? 0) === 64 ? f(this, i, z).call(this, r) : f(this, i, P).call(this, r);
131
- }));
132
- });
133
- }, D = function(e, r, a) {
134
- var o, u, m, l;
135
- if (!e.size) return;
136
- const n = {
137
- type: a,
138
- note: ((o = r.note) == null ? void 0 : o.number) ?? 0,
139
- velocity: ((u = r.note) == null ? void 0 : u.rawAttack) ?? (typeof r.velocity == "number" ? r.velocity : ((m = r.note) == null ? void 0 : m.attack) ?? 0),
140
- channel: ((l = r.message) == null ? void 0 : l.channel) ?? 1,
141
- raw: r
142
- };
143
- e.forEach((g) => g(n));
144
- }, P = function(e) {
145
- var a, n, o;
146
- if (!s(this, h).size) return;
147
- const r = {
148
- type: "controlchange",
149
- controller: ((a = e.controller) == null ? void 0 : a.number) ?? ((n = e.controller) == null ? void 0 : n.value) ?? (typeof e.controller == "number" ? e.controller : 0),
150
- // Provide both values explicitly
151
- normalizedValue: typeof e.value == "number" ? e.value : typeof e.rawValue == "number" ? e.rawValue / 127 : 0,
152
- midiValue: typeof e.rawValue == "number" ? e.rawValue : typeof e.value == "number" ? Math.round(e.value * 127) : 0,
153
- channel: ((o = e.message) == null ? void 0 : o.channel) ?? 1,
154
- raw: e
155
- };
156
- s(this, h).forEach((u) => u(r));
157
- }, z = function(e) {
158
- var n;
159
- if (!s(this, p).size) return;
160
- const a = {
161
- type: "sustainpedal",
162
- pressed: (typeof e.rawValue == "number" ? e.rawValue : typeof e.value == "number" ? Math.round(e.value * 127) : 0) >= 64,
163
- // MIDI standard: >= 64 is "on"
164
- channel: ((n = e.message) == null ? void 0 : n.channel) ?? 1,
165
- raw: e
166
- };
167
- s(this, p).forEach((o) => o(a));
168
- }, C = function(e, r) {
169
- return e === "all" ? !0 : typeof r != "number" ? !1 : e === r;
170
- };
171
- const U = new N();
172
- export {
173
- F as DEFAULT_KEYMAP_KEY,
174
- N as InputController,
175
- T as chromaticKeymap,
176
- H as defaultKeymap,
177
- L as generateKeymap,
178
- j as getAudioInputDevices,
179
- Y as getAudioOutputDevices,
180
- _ as getCamera,
181
- $ as getDevices,
182
- q as getMIDIAccess,
183
- B as getMicrophone,
184
- O as getMidiSupportInfo,
185
- G as getVideoInputDevices,
186
- U as inputController,
187
- A as isMidiSupported,
188
- R as keymaps,
189
- J as majorKeymap,
190
- Q as minorKeymap,
191
- X as onDeviceChange,
192
- Z as pentatonicKeymap
193
- };
17
+ var y = class {
18
+ #e = !1;
19
+ #t = /* @__PURE__ */ new Set();
20
+ #n = /* @__PURE__ */ new Set();
21
+ #r = /* @__PURE__ */ new Set();
22
+ #i = /* @__PURE__ */ new Set();
23
+ async init() {
24
+ if (this.#e) return !0;
25
+ if (!_()) {
26
+ let { browserName: e, message: t } = v();
27
+ return console.warn(`InputController: ${t} (Browser: ${e})`), !1;
28
+ }
29
+ try {
30
+ await g.enable();
31
+ } catch (e) {
32
+ return console.warn("InputController: WebMIDI enable failed", e), !1;
33
+ }
34
+ return g.enabled ? (this.#e = !0, this.#a(), !0) : (console.warn("InputController: WebMIDI not enabled"), !1);
35
+ }
36
+ onNoteOn(e) {
37
+ return this.#t.add(e), () => this.#t.delete(e);
38
+ }
39
+ onNoteOff(e) {
40
+ return this.#n.add(e), () => this.#n.delete(e);
41
+ }
42
+ onControlChange(e) {
43
+ return this.#r.add(e), () => this.#r.delete(e);
44
+ }
45
+ onSustainPedal(e) {
46
+ return this.#i.add(e), () => this.#i.delete(e);
47
+ }
48
+ registerNoteTarget(e, t = "all") {
49
+ let n = this.onNoteOn((n) => {
50
+ this.#l(t, n.channel) && e.play(n.note, n.velocity ?? 0);
51
+ }), r = this.onNoteOff((n) => {
52
+ this.#l(t, n.channel) && e.release(n.note);
53
+ });
54
+ return () => {
55
+ n(), r();
56
+ };
57
+ }
58
+ registerControlTarget(e, t) {
59
+ let n = Array.isArray(e) ? e : [e], r = Array.isArray(t.controller) ? t.controller : [t.controller], i = t.channel ?? "all", a = t.transformValue ?? ((e) => e.normalizedValue);
60
+ return this.onControlChange((e) => {
61
+ if (!r.includes(e.controller) || !this.#l(i, e.channel)) return;
62
+ let t = a(e);
63
+ n.forEach((n) => {
64
+ typeof n == "function" ? n(t, e) : "onControlChange" in n ? n.onControlChange(t, e) : "setValueNormalized" in n && n.setValueNormalized ? n.setValueNormalized(t) : "setValue" in n && n.setValue && n.setValue(t);
65
+ });
66
+ });
67
+ }
68
+ registerSustainPedalTarget(e, t = "all") {
69
+ return this.onSustainPedal((n) => {
70
+ this.#l(t, n.channel) && e.setSustainPedal(n.pressed);
71
+ });
72
+ }
73
+ get initialized() {
74
+ return this.#e;
75
+ }
76
+ get midiSupported() {
77
+ return _();
78
+ }
79
+ get supportInfo() {
80
+ return v();
81
+ }
82
+ #a() {
83
+ g.inputs.forEach((e) => {
84
+ e && (e.addListener("noteon", (e) => {
85
+ this.#o(this.#t, e, "noteon");
86
+ }), e.addListener("noteoff", (e) => {
87
+ this.#o(this.#n, e, "noteoff");
88
+ }), e.addListener("controlchange", (e) => {
89
+ (e.controller?.number ?? e.controller?.value ?? 0) === 64 ? this.#c(e) : this.#s(e);
90
+ }));
91
+ });
92
+ }
93
+ #o(e, t, n) {
94
+ if (!e.size) return;
95
+ let r = {
96
+ type: n,
97
+ note: t.note?.number ?? 0,
98
+ velocity: t.note?.rawAttack ?? (typeof t.velocity == "number" ? t.velocity : t.note?.attack ?? 0),
99
+ channel: t.message?.channel ?? 1,
100
+ raw: t
101
+ };
102
+ e.forEach((e) => e(r));
103
+ }
104
+ #s(e) {
105
+ if (!this.#r.size) return;
106
+ let t = {
107
+ type: "controlchange",
108
+ controller: e.controller?.number ?? e.controller?.value ?? (typeof e.controller == "number" ? e.controller : 0),
109
+ normalizedValue: typeof e.value == "number" ? e.value : typeof e.rawValue == "number" ? e.rawValue / 127 : 0,
110
+ midiValue: typeof e.rawValue == "number" ? e.rawValue : typeof e.value == "number" ? Math.round(e.value * 127) : 0,
111
+ channel: e.message?.channel ?? 1,
112
+ raw: e
113
+ };
114
+ this.#r.forEach((e) => e(t));
115
+ }
116
+ #c(e) {
117
+ if (!this.#i.size) return;
118
+ let t = {
119
+ type: "sustainpedal",
120
+ pressed: (typeof e.rawValue == "number" ? e.rawValue : typeof e.value == "number" ? Math.round(e.value * 127) : 0) >= 64,
121
+ channel: e.message?.channel ?? 1,
122
+ raw: e
123
+ };
124
+ this.#i.forEach((e) => e(t));
125
+ }
126
+ #l(e, t) {
127
+ return e === "all" || typeof t == "number" && e === t;
128
+ }
129
+ }, b = new y();
130
+ //#endregion
131
+ export { m as DEFAULT_KEYMAP_KEY, y as InputController, l as chromaticKeymap, f as defaultKeymap, o as generateKeymap, s as getAudioInputDevices, h as getAudioOutputDevices, n as getCamera, r as getDevices, d as getMIDIAccess, c as getMicrophone, v as getMidiSupportInfo, a as getVideoInputDevices, b as inputController, _ as isMidiSupported, e as keymaps, u as majorKeymap, p as minorKeymap, i as onDeviceChange, t as pentatonicKeymap };
@@ -0,0 +1,239 @@
1
+ //#region src/io/devices/devices.ts
2
+ async function e() {
3
+ try {
4
+ return await navigator.mediaDevices.getUserMedia({
5
+ audio: !0,
6
+ video: !0
7
+ }), (await navigator.mediaDevices.enumerateDevices()).map((e) => ({
8
+ deviceId: e.deviceId,
9
+ label: e.label,
10
+ kind: e.kind
11
+ }));
12
+ } catch (e) {
13
+ return console.error("Failed to enumerate devices:", e), [];
14
+ }
15
+ }
16
+ async function t() {
17
+ if (!navigator.requestMIDIAccess) throw Error("MIDI access not supported in this browser");
18
+ return navigator.requestMIDIAccess();
19
+ }
20
+ async function n(e = {
21
+ echoCancellation: !1,
22
+ noiseSuppression: !0,
23
+ autoGainControl: !0
24
+ }, t = "") {
25
+ try {
26
+ return await navigator.mediaDevices.getUserMedia({ audio: t ? {
27
+ ...e,
28
+ deviceId: { exact: t }
29
+ } : e });
30
+ } catch (n) {
31
+ if (t && n.name === "OverconstrainedError") return console.warn("Requested audio input device unavailable, falling back to default"), navigator.mediaDevices.getUserMedia({ audio: e });
32
+ throw n;
33
+ }
34
+ }
35
+ async function r(e = {
36
+ width: 1280,
37
+ height: 720,
38
+ facingMode: "user"
39
+ }) {
40
+ return navigator.mediaDevices.getUserMedia({ video: e });
41
+ }
42
+ async function i() {
43
+ return (await e()).filter((e) => e.kind === "audioinput");
44
+ }
45
+ async function a() {
46
+ return (await e()).filter((e) => e.kind === "audiooutput");
47
+ }
48
+ async function o() {
49
+ return (await e()).filter((e) => e.kind === "videoinput");
50
+ }
51
+ function s(e) {
52
+ return navigator.mediaDevices.addEventListener("devicechange", e), () => navigator.mediaDevices.removeEventListener("devicechange", e);
53
+ }
54
+ //#endregion
55
+ //#region src/io/mapping/keymap.ts
56
+ var c = {
57
+ KeyZ: 48,
58
+ KeyS: 49,
59
+ KeyX: 50,
60
+ KeyD: 51,
61
+ KeyC: 52,
62
+ KeyV: 53,
63
+ KeyG: 54,
64
+ KeyB: 55,
65
+ KeyH: 56,
66
+ KeyN: 57,
67
+ KeyJ: 58,
68
+ KeyM: 59,
69
+ Comma: 60,
70
+ KeyL: 61,
71
+ Period: 62,
72
+ Semicolon: 63,
73
+ Slash: 64,
74
+ KeyQ: 60,
75
+ Digit2: 61,
76
+ KeyW: 62,
77
+ Digit3: 63,
78
+ KeyE: 64,
79
+ KeyR: 65,
80
+ Digit5: 66,
81
+ KeyT: 67,
82
+ Digit6: 68,
83
+ KeyY: 69,
84
+ Digit7: 70,
85
+ KeyU: 71,
86
+ KeyI: 72,
87
+ Digit9: 73,
88
+ KeyO: 74,
89
+ Digit0: 75,
90
+ KeyP: 76,
91
+ BracketLeft: 77,
92
+ Equal: 78,
93
+ BracketRight: 79,
94
+ Numpad1: 60,
95
+ Numpad2: 62,
96
+ Numpad3: 64,
97
+ Numpad4: 65,
98
+ Numpad5: 67,
99
+ Numpad6: 69,
100
+ Numpad7: 71,
101
+ Numpad8: 72,
102
+ Numpad9: 74
103
+ };
104
+ function l(e) {
105
+ let { baseNote: t, scale: n } = e;
106
+ if (n.length === 0) throw RangeError("scale must contain at least one interval");
107
+ let r = [
108
+ [
109
+ "KeyZ",
110
+ "KeyX",
111
+ "KeyC",
112
+ "KeyV",
113
+ "KeyB",
114
+ "KeyN",
115
+ "KeyM",
116
+ "Comma",
117
+ "Period",
118
+ "Slash"
119
+ ],
120
+ [
121
+ "KeyA",
122
+ "KeyS",
123
+ "KeyD",
124
+ "KeyF",
125
+ "KeyG",
126
+ "KeyH",
127
+ "KeyJ",
128
+ "KeyK",
129
+ "KeyL",
130
+ "Semicolon",
131
+ "Quote",
132
+ "Backslash"
133
+ ],
134
+ [
135
+ "KeyQ",
136
+ "KeyW",
137
+ "KeyE",
138
+ "KeyR",
139
+ "KeyT",
140
+ "KeyY",
141
+ "KeyU",
142
+ "KeyI",
143
+ "KeyO",
144
+ "KeyP",
145
+ "BracketLeft",
146
+ "BracketRight"
147
+ ],
148
+ [
149
+ "Digit1",
150
+ "Digit2",
151
+ "Digit3",
152
+ "Digit4",
153
+ "Digit5",
154
+ "Digit6",
155
+ "Digit7",
156
+ "Digit8",
157
+ "Digit9",
158
+ "Digit0",
159
+ "Minus",
160
+ "Equal"
161
+ ]
162
+ ], i = {};
163
+ return r.forEach((e, r) => {
164
+ let a = t + r * 12;
165
+ e.forEach((e, t) => {
166
+ let r = t % n.length, o = Math.floor(t / n.length);
167
+ i[e] = a + o * 12 + n[r];
168
+ });
169
+ }), [
170
+ "Numpad1",
171
+ "Numpad2",
172
+ "Numpad3",
173
+ "Numpad4",
174
+ "Numpad5",
175
+ "Numpad6",
176
+ "Numpad7",
177
+ "Numpad8",
178
+ "Numpad9"
179
+ ].forEach((e, r) => {
180
+ let a = r % n.length, o = Math.floor(r / n.length);
181
+ i[e] = t + 36 + o * 12 + n[a];
182
+ }), i;
183
+ }
184
+ var u = l({
185
+ baseNote: 36,
186
+ scale: [
187
+ 0,
188
+ 2,
189
+ 4,
190
+ 5,
191
+ 7,
192
+ 9,
193
+ 11
194
+ ]
195
+ }), d = l({
196
+ baseNote: 36,
197
+ scale: [
198
+ 0,
199
+ 2,
200
+ 3,
201
+ 5,
202
+ 7,
203
+ 8,
204
+ 10
205
+ ]
206
+ }), f = l({
207
+ baseNote: 36,
208
+ scale: [
209
+ 0,
210
+ 2,
211
+ 4,
212
+ 7,
213
+ 9
214
+ ]
215
+ }), p = l({
216
+ baseNote: 48,
217
+ scale: [
218
+ 0,
219
+ 1,
220
+ 2,
221
+ 3,
222
+ 4,
223
+ 5,
224
+ 6,
225
+ 7,
226
+ 8,
227
+ 9,
228
+ 10,
229
+ 11
230
+ ]
231
+ }), m = "major", h = {
232
+ piano: c,
233
+ major: u,
234
+ minor: d,
235
+ pentatonic: f,
236
+ chromatic: p
237
+ };
238
+ //#endregion
239
+ export { h as a, f as c, r as d, e as f, s as g, o as h, l as i, i as l, n as m, p as n, u as o, t as p, c as r, d as s, m as t, a as u };