kordweb 0.7.0 → 0.8.1

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/klib_bg.js CHANGED
@@ -5,46 +5,33 @@ export function __wbg_set_wasm(val) {
5
5
  }
6
6
 
7
7
 
8
- const heap = new Array(128).fill(undefined);
9
-
10
- heap.push(undefined, null, true, false);
11
-
12
- function getObject(idx) { return heap[idx]; }
13
-
14
- let heap_next = heap.length;
15
-
16
- function dropObject(idx) {
17
- if (idx < 132) return;
18
- heap[idx] = heap_next;
19
- heap_next = idx;
20
- }
21
-
22
- function takeObject(idx) {
23
- const ret = getObject(idx);
24
- dropObject(idx);
25
- return ret;
8
+ function addToExternrefTable0(obj) {
9
+ const idx = wasm.__externref_table_alloc();
10
+ wasm.__wbindgen_export_2.set(idx, obj);
11
+ return idx;
26
12
  }
27
13
 
28
- function isLikeNone(x) {
29
- return x === undefined || x === null;
14
+ function handleError(f, args) {
15
+ try {
16
+ return f.apply(this, args);
17
+ } catch (e) {
18
+ const idx = addToExternrefTable0(e);
19
+ wasm.__wbindgen_exn_store(idx);
20
+ }
30
21
  }
31
22
 
32
- let cachedFloat64Memory0 = null;
23
+ let cachedFloat32ArrayMemory0 = null;
33
24
 
34
- function getFloat64Memory0() {
35
- if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
36
- cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
25
+ function getFloat32ArrayMemory0() {
26
+ if (cachedFloat32ArrayMemory0 === null || cachedFloat32ArrayMemory0.byteLength === 0) {
27
+ cachedFloat32ArrayMemory0 = new Float32Array(wasm.memory.buffer);
37
28
  }
38
- return cachedFloat64Memory0;
29
+ return cachedFloat32ArrayMemory0;
39
30
  }
40
31
 
41
- let cachedInt32Memory0 = null;
42
-
43
- function getInt32Memory0() {
44
- if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
45
- cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
46
- }
47
- return cachedInt32Memory0;
32
+ function getArrayF32FromWasm0(ptr, len) {
33
+ ptr = ptr >>> 0;
34
+ return getFloat32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
48
35
  }
49
36
 
50
37
  const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder;
@@ -53,84 +40,53 @@ let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true
53
40
 
54
41
  cachedTextDecoder.decode();
55
42
 
56
- let cachedUint8Memory0 = null;
43
+ let cachedUint8ArrayMemory0 = null;
57
44
 
58
- function getUint8Memory0() {
59
- if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
60
- cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
45
+ function getUint8ArrayMemory0() {
46
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
47
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
61
48
  }
62
- return cachedUint8Memory0;
49
+ return cachedUint8ArrayMemory0;
63
50
  }
64
51
 
65
52
  function getStringFromWasm0(ptr, len) {
66
53
  ptr = ptr >>> 0;
67
- return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
54
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
68
55
  }
69
56
 
70
- function addHeapObject(obj) {
71
- if (heap_next === heap.length) heap.push(heap.length + 1);
72
- const idx = heap_next;
73
- heap_next = heap[idx];
74
-
75
- heap[idx] = obj;
76
- return idx;
57
+ function isLikeNone(x) {
58
+ return x === undefined || x === null;
77
59
  }
78
60
 
79
- let WASM_VECTOR_LEN = 0;
80
-
81
- const lTextEncoder = typeof TextEncoder === 'undefined' ? (0, module.require)('util').TextEncoder : TextEncoder;
82
-
83
- let cachedTextEncoder = new lTextEncoder('utf-8');
84
-
85
- const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
86
- ? function (arg, view) {
87
- return cachedTextEncoder.encodeInto(arg, view);
88
- }
89
- : function (arg, view) {
90
- const buf = cachedTextEncoder.encode(arg);
91
- view.set(buf);
92
- return {
93
- read: arg.length,
94
- written: buf.length
95
- };
61
+ const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
62
+ ? { register: () => {}, unregister: () => {} }
63
+ : new FinalizationRegistry(state => {
64
+ wasm.__wbindgen_export_3.get(state.dtor)(state.a, state.b)
96
65
  });
97
66
 
98
- function passStringToWasm0(arg, malloc, realloc) {
99
-
100
- if (realloc === undefined) {
101
- const buf = cachedTextEncoder.encode(arg);
102
- const ptr = malloc(buf.length, 1) >>> 0;
103
- getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
104
- WASM_VECTOR_LEN = buf.length;
105
- return ptr;
106
- }
107
-
108
- let len = arg.length;
109
- let ptr = malloc(len, 1) >>> 0;
110
-
111
- const mem = getUint8Memory0();
112
-
113
- let offset = 0;
114
-
115
- for (; offset < len; offset++) {
116
- const code = arg.charCodeAt(offset);
117
- if (code > 0x7F) break;
118
- mem[ptr + offset] = code;
119
- }
120
-
121
- if (offset !== len) {
122
- if (offset !== 0) {
123
- arg = arg.slice(offset);
67
+ function makeMutClosure(arg0, arg1, dtor, f) {
68
+ const state = { a: arg0, b: arg1, cnt: 1, dtor };
69
+ const real = (...args) => {
70
+ // First up with a closure we increment the internal reference
71
+ // count. This ensures that the Rust closure environment won't
72
+ // be deallocated while we're invoking it.
73
+ state.cnt++;
74
+ const a = state.a;
75
+ state.a = 0;
76
+ try {
77
+ return f(a, state.b, ...args);
78
+ } finally {
79
+ if (--state.cnt === 0) {
80
+ wasm.__wbindgen_export_3.get(state.dtor)(a, state.b);
81
+ CLOSURE_DTORS.unregister(state);
82
+ } else {
83
+ state.a = a;
84
+ }
124
85
  }
125
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
126
- const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
127
- const ret = encodeString(arg, view);
128
-
129
- offset += ret.written;
130
- }
131
-
132
- WASM_VECTOR_LEN = offset;
133
- return ptr;
86
+ };
87
+ real.original = state;
88
+ CLOSURE_DTORS.register(real, state, state);
89
+ return real;
134
90
  }
135
91
 
136
92
  function debugString(val) {
@@ -174,7 +130,7 @@ function debugString(val) {
174
130
  // Test for built-in
175
131
  const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
176
132
  let className;
177
- if (builtInMatches.length > 1) {
133
+ if (builtInMatches && builtInMatches.length > 1) {
178
134
  className = builtInMatches[1];
179
135
  } else {
180
136
  // Failed to match the standard '[object ClassName]'
@@ -198,1255 +154,1651 @@ function debugString(val) {
198
154
  return className;
199
155
  }
200
156
 
201
- function makeMutClosure(arg0, arg1, dtor, f) {
202
- const state = { a: arg0, b: arg1, cnt: 1, dtor };
203
- const real = (...args) => {
204
- // First up with a closure we increment the internal reference
205
- // count. This ensures that the Rust closure environment won't
206
- // be deallocated while we're invoking it.
207
- state.cnt++;
208
- const a = state.a;
209
- state.a = 0;
210
- try {
211
- return f(a, state.b, ...args);
212
- } finally {
213
- if (--state.cnt === 0) {
214
- wasm.__wbindgen_export_2.get(state.dtor)(a, state.b);
157
+ let WASM_VECTOR_LEN = 0;
215
158
 
216
- } else {
217
- state.a = a;
218
- }
219
- }
220
- };
221
- real.original = state;
159
+ const lTextEncoder = typeof TextEncoder === 'undefined' ? (0, module.require)('util').TextEncoder : TextEncoder;
222
160
 
223
- return real;
224
- }
225
- function __wbg_adapter_24(arg0, arg1, arg2) {
226
- wasm.wasm_bindgen__convert__closures__invoke1_mut__h7ae5fa43571d2d1a(arg0, arg1, addHeapObject(arg2));
227
- }
161
+ let cachedTextEncoder = new lTextEncoder('utf-8');
228
162
 
229
- function __wbg_adapter_27(arg0, arg1) {
230
- wasm.wasm_bindgen__convert__closures__invoke0_mut__h9a3cc0c6ffc8f26a(arg0, arg1);
163
+ const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
164
+ ? function (arg, view) {
165
+ return cachedTextEncoder.encodeInto(arg, view);
231
166
  }
167
+ : function (arg, view) {
168
+ const buf = cachedTextEncoder.encode(arg);
169
+ view.set(buf);
170
+ return {
171
+ read: arg.length,
172
+ written: buf.length
173
+ };
174
+ });
175
+
176
+ function passStringToWasm0(arg, malloc, realloc) {
177
+
178
+ if (realloc === undefined) {
179
+ const buf = cachedTextEncoder.encode(arg);
180
+ const ptr = malloc(buf.length, 1) >>> 0;
181
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
182
+ WASM_VECTOR_LEN = buf.length;
183
+ return ptr;
184
+ }
185
+
186
+ let len = arg.length;
187
+ let ptr = malloc(len, 1) >>> 0;
188
+
189
+ const mem = getUint8ArrayMemory0();
190
+
191
+ let offset = 0;
192
+
193
+ for (; offset < len; offset++) {
194
+ const code = arg.charCodeAt(offset);
195
+ if (code > 0x7F) break;
196
+ mem[ptr + offset] = code;
197
+ }
198
+
199
+ if (offset !== len) {
200
+ if (offset !== 0) {
201
+ arg = arg.slice(offset);
202
+ }
203
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
204
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
205
+ const ret = encodeString(arg, view);
206
+
207
+ offset += ret.written;
208
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
209
+ }
232
210
 
233
- function __wbg_adapter_30(arg0, arg1) {
234
- wasm.wasm_bindgen__convert__closures__invoke0_mut__hddbc9bcc7c6455be(arg0, arg1);
211
+ WASM_VECTOR_LEN = offset;
212
+ return ptr;
235
213
  }
236
214
 
237
- let cachedFloat32Memory0 = null;
215
+ let cachedDataViewMemory0 = null;
238
216
 
239
- function getFloat32Memory0() {
240
- if (cachedFloat32Memory0 === null || cachedFloat32Memory0.byteLength === 0) {
241
- cachedFloat32Memory0 = new Float32Array(wasm.memory.buffer);
217
+ function getDataViewMemory0() {
218
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
219
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
242
220
  }
243
- return cachedFloat32Memory0;
221
+ return cachedDataViewMemory0;
244
222
  }
245
223
 
246
- function passArrayF32ToWasm0(arg, malloc) {
247
- const ptr = malloc(arg.length * 4, 4) >>> 0;
248
- getFloat32Memory0().set(arg, ptr / 4);
249
- WASM_VECTOR_LEN = arg.length;
250
- return ptr;
224
+ function takeFromExternrefTable0(idx) {
225
+ const value = wasm.__wbindgen_export_2.get(idx);
226
+ wasm.__externref_table_dealloc(idx);
227
+ return value;
251
228
  }
252
229
 
253
230
  function _assertClass(instance, klass) {
254
231
  if (!(instance instanceof klass)) {
255
232
  throw new Error(`expected instance of ${klass.name}`);
256
233
  }
257
- return instance.ptr;
258
234
  }
259
235
 
260
- function handleError(f, args) {
261
- try {
262
- return f.apply(this, args);
263
- } catch (e) {
264
- wasm.__wbindgen_exn_store(addHeapObject(e));
265
- }
236
+ function passArrayF32ToWasm0(arg, malloc) {
237
+ const ptr = malloc(arg.length * 4, 4) >>> 0;
238
+ getFloat32ArrayMemory0().set(arg, ptr / 4);
239
+ WASM_VECTOR_LEN = arg.length;
240
+ return ptr;
241
+ }
242
+ function __wbg_adapter_28(arg0, arg1) {
243
+ wasm._dyn_core_86a6a94adeda8493___ops__function__FnMut_____Output______as_wasm_bindgen_2ca0cf1d0eae7d9___closure__WasmClosure___describe__invoke______(arg0, arg1);
266
244
  }
267
245
 
268
- function getArrayF32FromWasm0(ptr, len) {
269
- ptr = ptr >>> 0;
270
- return getFloat32Memory0().subarray(ptr / 4, ptr / 4 + len);
246
+ function __wbg_adapter_31(arg0, arg1, arg2) {
247
+ wasm.closure656_externref_shim(arg0, arg1, arg2);
271
248
  }
272
- function __wbg_adapter_152(arg0, arg1, arg2, arg3) {
273
- wasm.wasm_bindgen__convert__closures__invoke2_mut__h1c849f10298b6e57(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
249
+
250
+ function __wbg_adapter_34(arg0, arg1) {
251
+ wasm._dyn_core_86a6a94adeda8493___ops__function__FnMut_____Output______as_wasm_bindgen_2ca0cf1d0eae7d9___closure__WasmClosure___describe__invoke______11(arg0, arg1);
252
+ }
253
+
254
+ function __wbg_adapter_186(arg0, arg1, arg2, arg3) {
255
+ wasm.closure759_externref_shim(arg0, arg1, arg2, arg3);
274
256
  }
275
257
 
276
258
  /**
277
- * The chord modifiers.
278
- */
279
- export const KordModifier = Object.freeze({
280
- /**
281
- * Minor modifier.
282
- */
283
- Minor:0,"0":"Minor",
284
- /**
285
- * Flat 5 modifier.
286
- */
287
- Flat5:1,"1":"Flat5",
288
- /**
289
- * Sharp 5 modifier.
290
- */
291
- Augmented5:2,"2":"Augmented5",
292
- /**
293
- * Major 7 modifier.
294
- */
295
- Major7:3,"3":"Major7",
296
- /**
297
- * Dominant 7 modifier.
298
- */
299
- Dominant7:4,"4":"Dominant7",
300
- /**
301
- * Dominant 9 modifier.
302
- */
303
- Dominant9:5,"5":"Dominant9",
304
- /**
305
- * Dominant 11 modifier.
306
- */
307
- Dominant11:6,"6":"Dominant11",
308
- /**
309
- * Dominant 13 modifier.
310
- */
311
- Dominant13:7,"7":"Dominant13",
312
- /**
313
- * Flat 9 modifier.
314
- */
315
- Flat9:8,"8":"Flat9",
316
- /**
317
- * Sharp 9 modifier.
318
- */
319
- Sharp9:9,"9":"Sharp9",
320
- /**
321
- * Sharp 11 modifier.
322
- */
323
- Sharp11:10,"10":"Sharp11",
324
- /**
325
- * Diminished modifier.
326
- */
327
- Diminished:11,"11":"Diminished", });
328
- /**
329
- * An enum representing the extension of a chord.
330
- *
331
- * Extensions are not really "special" in the sense that they do not change how the
332
- * chord is interpreted by the system. E.g., an `add2` just adds a 2 to the chord,
333
- * and the chord is still interpreted as a major chord.
334
- */
259
+ * An enum representing the extension of a chord.
260
+ *
261
+ * Extensions are not really "special" in the sense that they do not change how the
262
+ * chord is interpreted by the system. E.g., an `add2` just adds a 2 to the chord,
263
+ * and the chord is still interpreted as a major chord.
264
+ * @enum {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9}
265
+ */
335
266
  export const KordExtension = Object.freeze({
267
+ /**
268
+ * Sus2 extension.
269
+ */
270
+ Sus2: 0, "0": "Sus2",
271
+ /**
272
+ * Sus4 extension.
273
+ */
274
+ Sus4: 1, "1": "Sus4",
275
+ /**
276
+ * Flat 11 extension.
277
+ */
278
+ Flat11: 2, "2": "Flat11",
279
+ /**
280
+ * Sharp 13 extension.
281
+ */
282
+ Sharp13: 3, "3": "Sharp13",
283
+ /**
284
+ * Add2 extension.
285
+ */
286
+ Add2: 4, "4": "Add2",
287
+ /**
288
+ * Add4 extension.
289
+ */
290
+ Add4: 5, "5": "Add4",
291
+ /**
292
+ * Add6 extension.
293
+ */
294
+ Add6: 6, "6": "Add6",
295
+ /**
296
+ * Add9 extension.
297
+ */
298
+ Add9: 7, "7": "Add9",
299
+ /**
300
+ * Add11 extension.
301
+ */
302
+ Add11: 8, "8": "Add11",
303
+ /**
304
+ * Add13 extension.
305
+ */
306
+ Add13: 9, "9": "Add13",
307
+ });
336
308
  /**
337
- * Sus2 extension.
338
- */
339
- Sus2:0,"0":"Sus2",
340
- /**
341
- * Sus4 extension.
342
- */
343
- Sus4:1,"1":"Sus4",
344
- /**
345
- * Flat 11 extension.
346
- */
347
- Flat11:2,"2":"Flat11",
348
- /**
349
- * Flat 13 extension.
350
- */
351
- Flat13:3,"3":"Flat13",
352
- /**
353
- * Sharp 13 extension.
354
- */
355
- Sharp13:4,"4":"Sharp13",
356
- /**
357
- * Add2 extension.
358
- */
359
- Add2:5,"5":"Add2",
360
- /**
361
- * Add4 extension.
362
- */
363
- Add4:6,"6":"Add4",
364
- /**
365
- * Add6 extension.
366
- */
367
- Add6:7,"7":"Add6",
368
- /**
369
- * Add9 extension.
370
- */
371
- Add9:8,"8":"Add9",
372
- /**
373
- * Add11 extension.
374
- */
375
- Add11:9,"9":"Add11",
376
- /**
377
- * Add13 extension.
378
- */
379
- Add13:10,"10":"Add13", });
380
- /**
381
- * An enum representing the interval between two notes.
382
- */
309
+ * An enum representing the interval between two notes.
310
+ * @enum {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47}
311
+ */
383
312
  export const KordInterval = Object.freeze({
313
+ /**
314
+ * A perfect unison interval.
315
+ */
316
+ PerfectUnison: 0, "0": "PerfectUnison",
317
+ /**
318
+ * A diminished second interval.
319
+ */
320
+ DiminishedSecond: 1, "1": "DiminishedSecond",
321
+ /**
322
+ * An augmented unison interval.
323
+ */
324
+ AugmentedUnison: 2, "2": "AugmentedUnison",
325
+ /**
326
+ * A minor second interval.
327
+ */
328
+ MinorSecond: 3, "3": "MinorSecond",
329
+ /**
330
+ * A major second interval.
331
+ */
332
+ MajorSecond: 4, "4": "MajorSecond",
333
+ /**
334
+ * A diminished third interval.
335
+ */
336
+ DiminishedThird: 5, "5": "DiminishedThird",
337
+ /**
338
+ * An augmented second interval.
339
+ */
340
+ AugmentedSecond: 6, "6": "AugmentedSecond",
341
+ /**
342
+ * A minor third interval.
343
+ */
344
+ MinorThird: 7, "7": "MinorThird",
345
+ /**
346
+ * A major third interval.
347
+ */
348
+ MajorThird: 8, "8": "MajorThird",
349
+ /**
350
+ * A diminished fourth interval.
351
+ */
352
+ DiminishedFourth: 9, "9": "DiminishedFourth",
353
+ /**
354
+ * An augmented third interval.
355
+ */
356
+ AugmentedThird: 10, "10": "AugmentedThird",
357
+ /**
358
+ * A perfect fourth interval.
359
+ */
360
+ PerfectFourth: 11, "11": "PerfectFourth",
361
+ /**
362
+ * An augmented fourth interval.
363
+ */
364
+ AugmentedFourth: 12, "12": "AugmentedFourth",
365
+ /**
366
+ * A diminished fifth interval.
367
+ */
368
+ DiminishedFifth: 13, "13": "DiminishedFifth",
369
+ /**
370
+ * A perfect fifth interval.
371
+ */
372
+ PerfectFifth: 14, "14": "PerfectFifth",
373
+ /**
374
+ * A diminished sixth interval.
375
+ */
376
+ DiminishedSixth: 15, "15": "DiminishedSixth",
377
+ /**
378
+ * An augmented fifth interval.
379
+ */
380
+ AugmentedFifth: 16, "16": "AugmentedFifth",
381
+ /**
382
+ * A minor sixth interval.
383
+ */
384
+ MinorSixth: 17, "17": "MinorSixth",
385
+ /**
386
+ * A major sixth interval.
387
+ */
388
+ MajorSixth: 18, "18": "MajorSixth",
389
+ /**
390
+ * A diminished seventh interval.
391
+ */
392
+ DiminishedSeventh: 19, "19": "DiminishedSeventh",
393
+ /**
394
+ * An augmented sixth interval.
395
+ */
396
+ AugmentedSixth: 20, "20": "AugmentedSixth",
397
+ /**
398
+ * A minor seventh interval.
399
+ */
400
+ MinorSeventh: 21, "21": "MinorSeventh",
401
+ /**
402
+ * A major seventh interval.
403
+ */
404
+ MajorSeventh: 22, "22": "MajorSeventh",
405
+ /**
406
+ * A diminished octave interval.
407
+ */
408
+ DiminishedOctave: 23, "23": "DiminishedOctave",
409
+ /**
410
+ * An augmented seventh interval.
411
+ */
412
+ AugmentedSeventh: 24, "24": "AugmentedSeventh",
413
+ /**
414
+ * A perfect octave interval.
415
+ */
416
+ PerfectOctave: 25, "25": "PerfectOctave",
417
+ /**
418
+ * An minor ninth interval.
419
+ */
420
+ MinorNinth: 26, "26": "MinorNinth",
421
+ /**
422
+ * A major ninth interval.
423
+ */
424
+ MajorNinth: 27, "27": "MajorNinth",
425
+ /**
426
+ * An augmented ninth interval.
427
+ */
428
+ AugmentedNinth: 28, "28": "AugmentedNinth",
429
+ /**
430
+ * A diminished eleventh interval.
431
+ */
432
+ DiminishedEleventh: 29, "29": "DiminishedEleventh",
433
+ /**
434
+ * A perfect eleventh interval.
435
+ */
436
+ PerfectEleventh: 30, "30": "PerfectEleventh",
437
+ /**
438
+ * An augmented eleventh interval.
439
+ */
440
+ AugmentedEleventh: 31, "31": "AugmentedEleventh",
441
+ /**
442
+ * A minor thirteenth interval.
443
+ */
444
+ MinorThirteenth: 32, "32": "MinorThirteenth",
445
+ /**
446
+ * A major thirteenth interval.
447
+ */
448
+ MajorThirteenth: 33, "33": "MajorThirteenth",
449
+ /**
450
+ * An augmented thirteenth interval.
451
+ */
452
+ AugmentedThirteenth: 34, "34": "AugmentedThirteenth",
453
+ /**
454
+ * A perfect octave and perfect fifth interval.
455
+ */
456
+ PerfectOctaveAndPerfectFifth: 35, "35": "PerfectOctaveAndPerfectFifth",
457
+ /**
458
+ * Two perfect octaves.
459
+ */
460
+ TwoPerfectOctaves: 36, "36": "TwoPerfectOctaves",
461
+ /**
462
+ * Two perfect octaves and a major third.
463
+ */
464
+ TwoPerfectOctavesAndMajorThird: 37, "37": "TwoPerfectOctavesAndMajorThird",
465
+ /**
466
+ * Two perfect octaves and a perfect fifth.
467
+ */
468
+ TwoPerfectOctavesAndPerfectFifth: 38, "38": "TwoPerfectOctavesAndPerfectFifth",
469
+ /**
470
+ * Two perfect octaves and a minor sixth.
471
+ */
472
+ TwoPerfectOctavesAndMinorSeventh: 39, "39": "TwoPerfectOctavesAndMinorSeventh",
473
+ /**
474
+ * Three perfect octaves.
475
+ */
476
+ ThreePerfectOctaves: 40, "40": "ThreePerfectOctaves",
477
+ /**
478
+ * Three perfect octaves and a major second.
479
+ */
480
+ ThreePerfectOctavesAndMajorSecond: 41, "41": "ThreePerfectOctavesAndMajorSecond",
481
+ /**
482
+ * Three perfect octaves and a major third.
483
+ */
484
+ ThreePerfectOctavesAndMajorThird: 42, "42": "ThreePerfectOctavesAndMajorThird",
485
+ /**
486
+ * Three perfect octaves and an augmented fourth.
487
+ */
488
+ ThreePerfectOctavesAndAugmentedFourth: 43, "43": "ThreePerfectOctavesAndAugmentedFourth",
489
+ /**
490
+ * Three perfect octaves and a perfect fifth.
491
+ */
492
+ ThreePerfectOctavesAndPerfectFifth: 44, "44": "ThreePerfectOctavesAndPerfectFifth",
493
+ /**
494
+ * Three perfect octaves and a minor sixth.
495
+ */
496
+ ThreePerfectOctavesAndMinorSixth: 45, "45": "ThreePerfectOctavesAndMinorSixth",
497
+ /**
498
+ * Three perfect octaves and a minor seventh.
499
+ */
500
+ ThreePerfectOctavesAndMinorSeventh: 46, "46": "ThreePerfectOctavesAndMinorSeventh",
501
+ /**
502
+ * Three perfect octaves and a major seventh.
503
+ */
504
+ ThreePerfectOctavesAndMajorSeventh: 47, "47": "ThreePerfectOctavesAndMajorSeventh",
505
+ });
384
506
  /**
385
- * A perfect unison interval.
386
- */
387
- PerfectUnison:0,"0":"PerfectUnison",
388
- /**
389
- * A diminished second interval.
390
- */
391
- DiminishedSecond:1,"1":"DiminishedSecond",
392
- /**
393
- * An augmented unison interval.
394
- */
395
- AugmentedUnison:2,"2":"AugmentedUnison",
396
- /**
397
- * A minor second interval.
398
- */
399
- MinorSecond:3,"3":"MinorSecond",
400
- /**
401
- * A major second interval.
402
- */
403
- MajorSecond:4,"4":"MajorSecond",
404
- /**
405
- * A diminished third interval.
406
- */
407
- DiminishedThird:5,"5":"DiminishedThird",
408
- /**
409
- * An augmented second interval.
410
- */
411
- AugmentedSecond:6,"6":"AugmentedSecond",
412
- /**
413
- * A minor third interval.
414
- */
415
- MinorThird:7,"7":"MinorThird",
416
- /**
417
- * A major third interval.
418
- */
419
- MajorThird:8,"8":"MajorThird",
420
- /**
421
- * A diminished fourth interval.
422
- */
423
- DiminishedFourth:9,"9":"DiminishedFourth",
424
- /**
425
- * An augmented third interval.
426
- */
427
- AugmentedThird:10,"10":"AugmentedThird",
428
- /**
429
- * A perfect fourth interval.
430
- */
431
- PerfectFourth:11,"11":"PerfectFourth",
432
- /**
433
- * An augmented fourth interval.
434
- */
435
- AugmentedFourth:12,"12":"AugmentedFourth",
436
- /**
437
- * A diminished fifth interval.
438
- */
439
- DiminishedFifth:13,"13":"DiminishedFifth",
440
- /**
441
- * A perfect fifth interval.
442
- */
443
- PerfectFifth:14,"14":"PerfectFifth",
444
- /**
445
- * A diminished sixth interval.
446
- */
447
- DiminishedSixth:15,"15":"DiminishedSixth",
448
- /**
449
- * An augmented fifth interval.
450
- */
451
- AugmentedFifth:16,"16":"AugmentedFifth",
452
- /**
453
- * A minor sixth interval.
454
- */
455
- MinorSixth:17,"17":"MinorSixth",
456
- /**
457
- * A major sixth interval.
458
- */
459
- MajorSixth:18,"18":"MajorSixth",
460
- /**
461
- * A diminished seventh interval.
462
- */
463
- DiminishedSeventh:19,"19":"DiminishedSeventh",
464
- /**
465
- * An augmented sixth interval.
466
- */
467
- AugmentedSixth:20,"20":"AugmentedSixth",
468
- /**
469
- * A minor seventh interval.
470
- */
471
- MinorSeventh:21,"21":"MinorSeventh",
472
- /**
473
- * A major seventh interval.
474
- */
475
- MajorSeventh:22,"22":"MajorSeventh",
476
- /**
477
- * A diminished octave interval.
478
- */
479
- DiminishedOctave:23,"23":"DiminishedOctave",
480
- /**
481
- * An augmented seventh interval.
482
- */
483
- AugmentedSeventh:24,"24":"AugmentedSeventh",
484
- /**
485
- * A perfect octave interval.
486
- */
487
- PerfectOctave:25,"25":"PerfectOctave",
488
- /**
489
- * An minor ninth interval.
490
- */
491
- MinorNinth:26,"26":"MinorNinth",
492
- /**
493
- * A major ninth interval.
494
- */
495
- MajorNinth:27,"27":"MajorNinth",
496
- /**
497
- * An augmented ninth interval.
498
- */
499
- AugmentedNinth:28,"28":"AugmentedNinth",
500
- /**
501
- * A diminished eleventh interval.
502
- */
503
- DiminishedEleventh:29,"29":"DiminishedEleventh",
504
- /**
505
- * A perfect eleventh interval.
506
- */
507
- PerfectEleventh:30,"30":"PerfectEleventh",
508
- /**
509
- * An augmented eleventh interval.
510
- */
511
- AugmentedEleventh:31,"31":"AugmentedEleventh",
512
- /**
513
- * A minor thirteenth interval.
514
- */
515
- MinorThirteenth:32,"32":"MinorThirteenth",
516
- /**
517
- * A major thirteenth interval.
518
- */
519
- MajorThirteenth:33,"33":"MajorThirteenth",
520
- /**
521
- * An augmented thirteenth interval.
522
- */
523
- AugmentedThirteenth:34,"34":"AugmentedThirteenth",
524
- /**
525
- * A perfect octave and perfect fifth interval.
526
- */
527
- PerfectOctaveAndPerfectFifth:35,"35":"PerfectOctaveAndPerfectFifth",
528
- /**
529
- * Two perfect octaves.
530
- */
531
- TwoPerfectOctaves:36,"36":"TwoPerfectOctaves",
532
- /**
533
- * Two perfect octaves and a major third.
534
- */
535
- TwoPerfectOctavesAndMajorThird:37,"37":"TwoPerfectOctavesAndMajorThird",
536
- /**
537
- * Two perfect octaves and a perfect fifth.
538
- */
539
- TwoPerfectOctavesAndPerfectFifth:38,"38":"TwoPerfectOctavesAndPerfectFifth",
540
- /**
541
- * Two perfect octaves and a minor sixth.
542
- */
543
- TwoPerfectOctavesAndMinorSeventh:39,"39":"TwoPerfectOctavesAndMinorSeventh",
544
- /**
545
- * Three perfect octaves.
546
- */
547
- ThreePerfectOctaves:40,"40":"ThreePerfectOctaves",
548
- /**
549
- * Three perfect octaves and a major second.
550
- */
551
- ThreePerfectOctavesAndMajorSecond:41,"41":"ThreePerfectOctavesAndMajorSecond",
552
- /**
553
- * Three perfect octaves and a major third.
554
- */
555
- ThreePerfectOctavesAndMajorThird:42,"42":"ThreePerfectOctavesAndMajorThird",
556
- /**
557
- * Three perfect octaves and an augmented fourth.
558
- */
559
- ThreePerfectOctavesAndAugmentedFourth:43,"43":"ThreePerfectOctavesAndAugmentedFourth",
560
- /**
561
- * Three perfect octaves and a perfect fifth.
562
- */
563
- ThreePerfectOctavesAndPerfectFifth:44,"44":"ThreePerfectOctavesAndPerfectFifth",
564
- /**
565
- * Three perfect octaves and a minor sixth.
566
- */
567
- ThreePerfectOctavesAndMinorSixth:45,"45":"ThreePerfectOctavesAndMinorSixth",
568
- /**
569
- * Three perfect octaves and a minor seventh.
570
- */
571
- ThreePerfectOctavesAndMinorSeventh:46,"46":"ThreePerfectOctavesAndMinorSeventh",
572
- /**
573
- * Three perfect octaves and a major seventh.
574
- */
575
- ThreePerfectOctavesAndMajorSeventh:47,"47":"ThreePerfectOctavesAndMajorSeventh", });
507
+ * The chord modifiers.
508
+ * @enum {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11}
509
+ */
510
+ export const KordModifier = Object.freeze({
511
+ /**
512
+ * Minor modifier.
513
+ */
514
+ Minor: 0, "0": "Minor",
515
+ /**
516
+ * Flat 5 modifier.
517
+ */
518
+ Flat5: 1, "1": "Flat5",
519
+ /**
520
+ * Sharp 5 modifier.
521
+ */
522
+ Augmented5: 2, "2": "Augmented5",
523
+ /**
524
+ * Major 7 modifier.
525
+ */
526
+ Major7: 3, "3": "Major7",
527
+ /**
528
+ * Dominant 7 modifier.
529
+ */
530
+ Dominant7: 4, "4": "Dominant7",
531
+ /**
532
+ * Dominant 9 modifier.
533
+ */
534
+ Dominant9: 5, "5": "Dominant9",
535
+ /**
536
+ * Dominant 11 modifier.
537
+ */
538
+ Dominant11: 6, "6": "Dominant11",
539
+ /**
540
+ * Dominant 13 modifier.
541
+ */
542
+ Dominant13: 7, "7": "Dominant13",
543
+ /**
544
+ * Flat 9 modifier.
545
+ */
546
+ Flat9: 8, "8": "Flat9",
547
+ /**
548
+ * Sharp 9 modifier.
549
+ */
550
+ Sharp9: 9, "9": "Sharp9",
551
+ /**
552
+ * Sharp 11 modifier.
553
+ */
554
+ Sharp11: 10, "10": "Sharp11",
555
+ /**
556
+ * Diminished modifier.
557
+ */
558
+ Diminished: 11, "11": "Diminished",
559
+ });
560
+
561
+ const KordChordFinalization = (typeof FinalizationRegistry === 'undefined')
562
+ ? { register: () => {}, unregister: () => {} }
563
+ : new FinalizationRegistry(ptr => wasm.__wbg_kordchord_free(ptr >>> 0, 1));
576
564
  /**
577
- * The [`Chord`] wrapper.
578
- */
565
+ * The [`Chord`] wrapper.
566
+ */
579
567
  export class KordChord {
580
568
 
581
569
  static __wrap(ptr) {
582
570
  ptr = ptr >>> 0;
583
571
  const obj = Object.create(KordChord.prototype);
584
572
  obj.__wbg_ptr = ptr;
585
-
573
+ KordChordFinalization.register(obj, obj.__wbg_ptr, obj);
586
574
  return obj;
587
575
  }
588
576
 
589
577
  __destroy_into_raw() {
590
578
  const ptr = this.__wbg_ptr;
591
579
  this.__wbg_ptr = 0;
592
-
580
+ KordChordFinalization.unregister(this);
593
581
  return ptr;
594
582
  }
595
583
 
596
584
  free() {
597
585
  const ptr = this.__destroy_into_raw();
598
- wasm.__wbg_kordchord_free(ptr);
586
+ wasm.__wbg_kordchord_free(ptr, 0);
599
587
  }
600
588
  /**
601
- * Creates a new [`Chord`] from a frequency.
602
- * @param {string} name
603
- * @returns {KordChord}
604
- */
605
- static parse(name) {
606
- try {
607
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
608
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
609
- const len0 = WASM_VECTOR_LEN;
610
- wasm.kordchord_parse(retptr, ptr0, len0);
611
- var r0 = getInt32Memory0()[retptr / 4 + 0];
612
- var r1 = getInt32Memory0()[retptr / 4 + 1];
613
- var r2 = getInt32Memory0()[retptr / 4 + 2];
614
- if (r2) {
615
- throw takeObject(r1);
616
- }
617
- return KordChord.__wrap(r0);
618
- } finally {
619
- wasm.__wbindgen_add_to_stack_pointer(16);
589
+ * Plays the [`Chord`].
590
+ * @param {number} delay
591
+ * @param {number} length
592
+ * @param {number} fade_in
593
+ * @returns {Promise<void>}
594
+ */
595
+ play(delay, length, fade_in) {
596
+ const ret = wasm.kordchord_play(this.__wbg_ptr, delay, length, fade_in);
597
+ return ret;
598
+ }
599
+ /**
600
+ * Returns the [`Chord`]'s extensions.
601
+ * @returns {Array<any>}
602
+ */
603
+ extensions() {
604
+ const ret = wasm.kordchord_extensions(this.__wbg_ptr);
605
+ return ret;
606
+ }
607
+ /**
608
+ * Creates a new [`Chord`] from a set of [`Note`]s.
609
+ * @param {Array<any>} notes
610
+ * @returns {Array<any>}
611
+ */
612
+ static fromNotes(notes) {
613
+ const ret = wasm.kordchord_fromNotes(notes);
614
+ if (ret[2]) {
615
+ throw takeFromExternrefTable0(ret[1]);
620
616
  }
617
+ return takeFromExternrefTable0(ret[0]);
621
618
  }
622
619
  /**
623
- * Creates a new [`Chord`] from a set of [`Note`]s.
624
- *
625
- * The [`Note`]s should be represented as a space-separated string.
626
- * E.g., `C E G`.
627
- * @param {string} notes
628
- * @returns {Array<any>}
629
- */
630
- static fromNotesString(notes) {
620
+ * Returns whether or not the [`Chord`] is "crunchy".
621
+ * @returns {boolean}
622
+ */
623
+ isCrunchy() {
624
+ const ret = wasm.kordchord_isCrunchy(this.__wbg_ptr);
625
+ return ret !== 0;
626
+ }
627
+ /**
628
+ * Returns a new [`Chord`] with the slash set to the provided value.
629
+ * @param {KordNote} slash
630
+ * @returns {KordChord}
631
+ */
632
+ withSlash(slash) {
633
+ _assertClass(slash, KordNote);
634
+ const ret = wasm.kordchord_withSlash(this.__wbg_ptr, slash.__wbg_ptr);
635
+ return KordChord.__wrap(ret);
636
+ }
637
+ /**
638
+ * Returns the [`Chord`]'s description.
639
+ * @returns {string}
640
+ */
641
+ description() {
642
+ let deferred1_0;
643
+ let deferred1_1;
631
644
  try {
632
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
633
- const ptr0 = passStringToWasm0(notes, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
634
- const len0 = WASM_VECTOR_LEN;
635
- wasm.kordchord_fromNotesString(retptr, ptr0, len0);
636
- var r0 = getInt32Memory0()[retptr / 4 + 0];
637
- var r1 = getInt32Memory0()[retptr / 4 + 1];
638
- var r2 = getInt32Memory0()[retptr / 4 + 2];
639
- if (r2) {
640
- throw takeObject(r1);
641
- }
642
- return takeObject(r0);
645
+ const ret = wasm.kordchord_description(this.__wbg_ptr);
646
+ deferred1_0 = ret[0];
647
+ deferred1_1 = ret[1];
648
+ return getStringFromWasm0(ret[0], ret[1]);
643
649
  } finally {
644
- wasm.__wbindgen_add_to_stack_pointer(16);
650
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
645
651
  }
646
652
  }
647
653
  /**
648
- * Creates a new [`Chord`] from a set of [`Note`]s.
649
- * @param {Array<any>} notes
650
- * @returns {Array<any>}
651
- */
652
- static fromNotes(notes) {
653
- try {
654
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
655
- wasm.kordchord_fromNotes(retptr, addHeapObject(notes));
656
- var r0 = getInt32Memory0()[retptr / 4 + 0];
657
- var r1 = getInt32Memory0()[retptr / 4 + 1];
658
- var r2 = getInt32Memory0()[retptr / 4 + 2];
659
- if (r2) {
660
- throw takeObject(r1);
661
- }
662
- return takeObject(r0);
663
- } finally {
664
- wasm.__wbindgen_add_to_stack_pointer(16);
654
+ * Returns a new [`Chord`] with the octave of the root set to the provided value.
655
+ * @param {number} octave
656
+ * @returns {KordChord}
657
+ */
658
+ withOctave(octave) {
659
+ const ret = wasm.kordchord_withOctave(this.__wbg_ptr, octave);
660
+ if (ret[2]) {
661
+ throw takeFromExternrefTable0(ret[1]);
665
662
  }
663
+ return KordChord.__wrap(ret[0]);
666
664
  }
667
665
  /**
668
- * Returns the [`Chord`]'s friendly name.
669
- * @returns {string}
670
- */
671
- name() {
666
+ * Returns the [`Chord`]'s chord tones as a string.
667
+ * @returns {string}
668
+ */
669
+ chordString() {
672
670
  let deferred1_0;
673
671
  let deferred1_1;
674
672
  try {
675
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
676
- wasm.kordchord_name(retptr, this.__wbg_ptr);
677
- var r0 = getInt32Memory0()[retptr / 4 + 0];
678
- var r1 = getInt32Memory0()[retptr / 4 + 1];
679
- deferred1_0 = r0;
680
- deferred1_1 = r1;
681
- return getStringFromWasm0(r0, r1);
673
+ const ret = wasm.kordchord_chordString(this.__wbg_ptr);
674
+ deferred1_0 = ret[0];
675
+ deferred1_1 = ret[1];
676
+ return getStringFromWasm0(ret[0], ret[1]);
682
677
  } finally {
683
- wasm.__wbindgen_add_to_stack_pointer(16);
684
678
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
685
679
  }
686
680
  }
687
681
  /**
688
- * Returns the [`Chord`]'s precise name.
689
- * @returns {string}
690
- */
682
+ * Returns the [`Chord`]'s precise name.
683
+ * @returns {string}
684
+ */
691
685
  preciseName() {
692
686
  let deferred1_0;
693
687
  let deferred1_1;
694
688
  try {
695
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
696
- wasm.kordchord_preciseName(retptr, this.__wbg_ptr);
697
- var r0 = getInt32Memory0()[retptr / 4 + 0];
698
- var r1 = getInt32Memory0()[retptr / 4 + 1];
699
- deferred1_0 = r0;
700
- deferred1_1 = r1;
701
- return getStringFromWasm0(r0, r1);
689
+ const ret = wasm.kordchord_preciseName(this.__wbg_ptr);
690
+ deferred1_0 = ret[0];
691
+ deferred1_1 = ret[1];
692
+ return getStringFromWasm0(ret[0], ret[1]);
702
693
  } finally {
703
- wasm.__wbindgen_add_to_stack_pointer(16);
704
694
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
705
695
  }
706
696
  }
707
697
  /**
708
- * Returns the [`Chord`] as a string (same as `precise_name`).
709
- * @returns {string}
710
- */
711
- toString() {
698
+ * Returns the [`Chord`]'s scale tones as a string.
699
+ * @returns {string}
700
+ */
701
+ scaleString() {
712
702
  let deferred1_0;
713
703
  let deferred1_1;
714
704
  try {
715
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
716
- wasm.kordchord_preciseName(retptr, this.__wbg_ptr);
717
- var r0 = getInt32Memory0()[retptr / 4 + 0];
718
- var r1 = getInt32Memory0()[retptr / 4 + 1];
719
- deferred1_0 = r0;
720
- deferred1_1 = r1;
721
- return getStringFromWasm0(r0, r1);
705
+ const ret = wasm.kordchord_scaleString(this.__wbg_ptr);
706
+ deferred1_0 = ret[0];
707
+ deferred1_1 = ret[1];
708
+ return getStringFromWasm0(ret[0], ret[1]);
722
709
  } finally {
723
- wasm.__wbindgen_add_to_stack_pointer(16);
724
710
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
725
711
  }
726
712
  }
727
713
  /**
728
- * Returns the [`Chord`]'s description.
729
- * @returns {string}
730
- */
731
- description() {
714
+ * Returns a new [`Chord`] with the "crunchiness" set to the provided value.
715
+ * @param {boolean} is_crunchy
716
+ * @returns {KordChord}
717
+ */
718
+ withCrunchy(is_crunchy) {
719
+ const ret = wasm.kordchord_withCrunchy(this.__wbg_ptr, is_crunchy);
720
+ return KordChord.__wrap(ret);
721
+ }
722
+ /**
723
+ * Returns a new [`Chord`] with the inversion set to the provided value.
724
+ * @param {number} inversion
725
+ * @returns {KordChord}
726
+ */
727
+ withInversion(inversion) {
728
+ const ret = wasm.kordchord_withInversion(this.__wbg_ptr, inversion);
729
+ return KordChord.__wrap(ret);
730
+ }
731
+ /**
732
+ * Returns the recommended scale/mode candidates for this chord.
733
+ * The candidates are ranked by relevance (rank 1 = most relevant).
734
+ * @returns {Array<any>}
735
+ */
736
+ scaleCandidates() {
737
+ const ret = wasm.kordchord_scaleCandidates(this.__wbg_ptr);
738
+ return ret;
739
+ }
740
+ /**
741
+ * Creates a new [`Chord`] from a set of [`Note`]s.
742
+ *
743
+ * The [`Note`]s should be represented as a space-separated string.
744
+ * E.g., `C E G`.
745
+ * @param {string} notes
746
+ * @returns {Array<any>}
747
+ */
748
+ static fromNotesString(notes) {
749
+ const ptr0 = passStringToWasm0(notes, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
750
+ const len0 = WASM_VECTOR_LEN;
751
+ const ret = wasm.kordchord_fromNotesString(ptr0, len0);
752
+ if (ret[2]) {
753
+ throw takeFromExternrefTable0(ret[1]);
754
+ }
755
+ return takeFromExternrefTable0(ret[0]);
756
+ }
757
+ /**
758
+ * Returns the clone of the [`Chord`].
759
+ * @returns {KordChord}
760
+ */
761
+ copy() {
762
+ const ret = wasm.kordchord_copy(this.__wbg_ptr);
763
+ return KordChord.__wrap(ret);
764
+ }
765
+ /**
766
+ * Returns the [`Chord`]'s friendly name.
767
+ * @returns {string}
768
+ */
769
+ name() {
732
770
  let deferred1_0;
733
771
  let deferred1_1;
734
772
  try {
735
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
736
- wasm.kordchord_description(retptr, this.__wbg_ptr);
737
- var r0 = getInt32Memory0()[retptr / 4 + 0];
738
- var r1 = getInt32Memory0()[retptr / 4 + 1];
739
- deferred1_0 = r0;
740
- deferred1_1 = r1;
741
- return getStringFromWasm0(r0, r1);
773
+ const ret = wasm.kordchord_name(this.__wbg_ptr);
774
+ deferred1_0 = ret[0];
775
+ deferred1_1 = ret[1];
776
+ return getStringFromWasm0(ret[0], ret[1]);
742
777
  } finally {
743
- wasm.__wbindgen_add_to_stack_pointer(16);
744
778
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
745
779
  }
746
780
  }
747
781
  /**
748
- * Returns the [`Chord`]'s display text.
749
- * @returns {string}
750
- */
751
- display() {
782
+ * Returns the [`Chord`]'s root note.
783
+ * @returns {string}
784
+ */
785
+ root() {
752
786
  let deferred1_0;
753
787
  let deferred1_1;
754
788
  try {
755
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
756
- wasm.kordchord_display(retptr, this.__wbg_ptr);
757
- var r0 = getInt32Memory0()[retptr / 4 + 0];
758
- var r1 = getInt32Memory0()[retptr / 4 + 1];
759
- deferred1_0 = r0;
760
- deferred1_1 = r1;
761
- return getStringFromWasm0(r0, r1);
789
+ const ret = wasm.kordchord_root(this.__wbg_ptr);
790
+ deferred1_0 = ret[0];
791
+ deferred1_1 = ret[1];
792
+ return getStringFromWasm0(ret[0], ret[1]);
762
793
  } finally {
763
- wasm.__wbindgen_add_to_stack_pointer(16);
764
794
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
765
795
  }
766
796
  }
767
797
  /**
768
- * Returns the [`Chord`]'s root note.
769
- * @returns {string}
770
- */
771
- root() {
798
+ * Returns the [`Chord`]'s chord tones.
799
+ * @returns {Array<any>}
800
+ */
801
+ chord() {
802
+ const ret = wasm.kordchord_chord(this.__wbg_ptr);
803
+ return ret;
804
+ }
805
+ /**
806
+ * Creates a new [`Chord`] from a frequency.
807
+ * @param {string} name
808
+ * @returns {KordChord}
809
+ */
810
+ static parse(name) {
811
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
812
+ const len0 = WASM_VECTOR_LEN;
813
+ const ret = wasm.kordchord_parse(ptr0, len0);
814
+ if (ret[2]) {
815
+ throw takeFromExternrefTable0(ret[1]);
816
+ }
817
+ return KordChord.__wrap(ret[0]);
818
+ }
819
+ /**
820
+ * Returns the [`Chord`]'s scale tones.
821
+ * @returns {Array<any>}
822
+ */
823
+ scale() {
824
+ const ret = wasm.kordchord_scale(this.__wbg_ptr);
825
+ return ret;
826
+ }
827
+ /**
828
+ * Returns the [`Chord`]'s slash note.
829
+ * @returns {string}
830
+ */
831
+ slash() {
772
832
  let deferred1_0;
773
833
  let deferred1_1;
774
834
  try {
775
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
776
- wasm.kordchord_root(retptr, this.__wbg_ptr);
777
- var r0 = getInt32Memory0()[retptr / 4 + 0];
778
- var r1 = getInt32Memory0()[retptr / 4 + 1];
779
- deferred1_0 = r0;
780
- deferred1_1 = r1;
781
- return getStringFromWasm0(r0, r1);
835
+ const ret = wasm.kordchord_slash(this.__wbg_ptr);
836
+ deferred1_0 = ret[0];
837
+ deferred1_1 = ret[1];
838
+ return getStringFromWasm0(ret[0], ret[1]);
782
839
  } finally {
783
- wasm.__wbindgen_add_to_stack_pointer(16);
784
840
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
785
841
  }
786
842
  }
787
843
  /**
788
- * Returns the [`Chord`]'s slash note.
789
- * @returns {string}
790
- */
791
- slash() {
844
+ * Returns the [`Chord`]'s display text.
845
+ * @returns {string}
846
+ */
847
+ display() {
792
848
  let deferred1_0;
793
849
  let deferred1_1;
794
850
  try {
795
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
796
- wasm.kordchord_slash(retptr, this.__wbg_ptr);
797
- var r0 = getInt32Memory0()[retptr / 4 + 0];
798
- var r1 = getInt32Memory0()[retptr / 4 + 1];
799
- deferred1_0 = r0;
800
- deferred1_1 = r1;
801
- return getStringFromWasm0(r0, r1);
851
+ const ret = wasm.kordchord_display(this.__wbg_ptr);
852
+ deferred1_0 = ret[0];
853
+ deferred1_1 = ret[1];
854
+ return getStringFromWasm0(ret[0], ret[1]);
802
855
  } finally {
803
- wasm.__wbindgen_add_to_stack_pointer(16);
804
856
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
805
857
  }
806
858
  }
807
859
  /**
808
- * Returns the [`Chord`]'s inversion.
809
- * @returns {number}
810
- */
860
+ * Returns the [`Chord`]'s inversion.
861
+ * @returns {number}
862
+ */
811
863
  inversion() {
812
864
  const ret = wasm.kordchord_inversion(this.__wbg_ptr);
813
865
  return ret;
814
866
  }
815
867
  /**
816
- * Returns whether or not the [`Chord`] is "crunchy".
817
- * @returns {boolean}
818
- */
819
- isCrunchy() {
820
- const ret = wasm.kordchord_isCrunchy(this.__wbg_ptr);
821
- return ret !== 0;
822
- }
823
- /**
824
- * Returns the [`Chord`]'s chord tones.
825
- * @returns {Array<any>}
826
- */
827
- chord() {
828
- const ret = wasm.kordchord_chord(this.__wbg_ptr);
829
- return takeObject(ret);
868
+ * Returns the [`Chord`]'s modifiers.
869
+ * @returns {Array<any>}
870
+ */
871
+ modifiers() {
872
+ const ret = wasm.kordchord_modifiers(this.__wbg_ptr);
873
+ return ret;
830
874
  }
831
875
  /**
832
- * Returns the [`Chord`]'s chord tones as a string.
833
- * @returns {string}
834
- */
835
- chordString() {
876
+ * Returns the [`Chord`] as a string (same as `precise_name`).
877
+ * @returns {string}
878
+ */
879
+ toString() {
836
880
  let deferred1_0;
837
881
  let deferred1_1;
838
882
  try {
839
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
840
- wasm.kordchord_chordString(retptr, this.__wbg_ptr);
841
- var r0 = getInt32Memory0()[retptr / 4 + 0];
842
- var r1 = getInt32Memory0()[retptr / 4 + 1];
843
- deferred1_0 = r0;
844
- deferred1_1 = r1;
845
- return getStringFromWasm0(r0, r1);
883
+ const ret = wasm.kordchord_toString(this.__wbg_ptr);
884
+ deferred1_0 = ret[0];
885
+ deferred1_1 = ret[1];
886
+ return getStringFromWasm0(ret[0], ret[1]);
846
887
  } finally {
847
- wasm.__wbindgen_add_to_stack_pointer(16);
848
888
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
849
889
  }
850
890
  }
851
891
  /**
852
- * Returns the [`Chord`]'s scale tones.
853
- * @returns {Array<any>}
854
- */
855
- scale() {
856
- const ret = wasm.kordchord_scale(this.__wbg_ptr);
857
- return takeObject(ret);
892
+ * Returns a new [`Chord`] with the `augmented` modifier.
893
+ * @returns {KordChord}
894
+ */
895
+ aug() {
896
+ const ret = wasm.kordchord_aug(this.__wbg_ptr);
897
+ return KordChord.__wrap(ret);
858
898
  }
859
899
  /**
860
- * Returns the [`Chord`]'s scale tones as a string.
861
- * @returns {string}
862
- */
863
- scaleString() {
864
- let deferred1_0;
865
- let deferred1_1;
866
- try {
867
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
868
- wasm.kordchord_scaleString(retptr, this.__wbg_ptr);
869
- var r0 = getInt32Memory0()[retptr / 4 + 0];
870
- var r1 = getInt32Memory0()[retptr / 4 + 1];
871
- deferred1_0 = r0;
872
- deferred1_1 = r1;
873
- return getStringFromWasm0(r0, r1);
874
- } finally {
875
- wasm.__wbindgen_add_to_stack_pointer(16);
876
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
877
- }
900
+ * Returns a new [`Chord`] with the `dim` modifier.
901
+ * @returns {KordChord}
902
+ */
903
+ dim() {
904
+ const ret = wasm.kordchord_dim(this.__wbg_ptr);
905
+ return KordChord.__wrap(ret);
878
906
  }
879
907
  /**
880
- * Returns the [`Chord`]'s modifiers.
881
- * @returns {Array<any>}
882
- */
883
- modifiers() {
884
- const ret = wasm.kordchord_modifiers(this.__wbg_ptr);
885
- return takeObject(ret);
908
+ * Returns a new [`Chord`] with the `add2` extension.
909
+ * @returns {KordChord}
910
+ */
911
+ add2() {
912
+ const ret = wasm.kordchord_add2(this.__wbg_ptr);
913
+ return KordChord.__wrap(ret);
886
914
  }
887
915
  /**
888
- * Returns the [`Chord`]'s extensions.
889
- * @returns {Array<any>}
890
- */
891
- extensions() {
892
- const ret = wasm.kordchord_extensions(this.__wbg_ptr);
893
- return takeObject(ret);
916
+ * Returns a new [`Chord`] with the `add4` extension.
917
+ * @returns {KordChord}
918
+ */
919
+ add4() {
920
+ const ret = wasm.kordchord_add4(this.__wbg_ptr);
921
+ return KordChord.__wrap(ret);
894
922
  }
895
923
  /**
896
- * Returns a new [`Chord`] with the inversion set to the provided value.
897
- * @param {number} inversion
898
- * @returns {KordChord}
899
- */
900
- withInversion(inversion) {
901
- const ret = wasm.kordchord_withInversion(this.__wbg_ptr, inversion);
924
+ * Returns a new [`Chord`] with the `add6` extension.
925
+ * @returns {KordChord}
926
+ */
927
+ add6() {
928
+ const ret = wasm.kordchord_add6(this.__wbg_ptr);
902
929
  return KordChord.__wrap(ret);
903
930
  }
904
931
  /**
905
- * Returns a new [`Chord`] with the slash set to the provided value.
906
- * @param {KordNote} slash
907
- * @returns {KordChord}
908
- */
909
- withSlash(slash) {
910
- _assertClass(slash, KordNote);
911
- const ret = wasm.kordchord_withSlash(this.__wbg_ptr, slash.__wbg_ptr);
932
+ * Returns a new [`Chord`] with the `add9` extension.
933
+ * @returns {KordChord}
934
+ */
935
+ add9() {
936
+ const ret = wasm.kordchord_add9(this.__wbg_ptr);
912
937
  return KordChord.__wrap(ret);
913
938
  }
914
939
  /**
915
- * Returns a new [`Chord`] with the octave of the root set to the provided value.
916
- * @param {number} octave
917
- * @returns {KordChord}
918
- */
919
- withOctave(octave) {
920
- try {
921
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
922
- wasm.kordchord_withOctave(retptr, this.__wbg_ptr, octave);
923
- var r0 = getInt32Memory0()[retptr / 4 + 0];
924
- var r1 = getInt32Memory0()[retptr / 4 + 1];
925
- var r2 = getInt32Memory0()[retptr / 4 + 2];
926
- if (r2) {
927
- throw takeObject(r1);
928
- }
929
- return KordChord.__wrap(r0);
930
- } finally {
931
- wasm.__wbindgen_add_to_stack_pointer(16);
932
- }
940
+ * Returns a new [`Chord`] with the `maj7` modifier.
941
+ * @returns {KordChord}
942
+ */
943
+ maj7() {
944
+ const ret = wasm.kordchord_maj7(this.__wbg_ptr);
945
+ return KordChord.__wrap(ret);
933
946
  }
934
947
  /**
935
- * Returns a new [`Chord`] with the "crunchiness" set to the provided value.
936
- * @param {boolean} is_crunchy
937
- * @returns {KordChord}
938
- */
939
- withCrunchy(is_crunchy) {
940
- const ret = wasm.kordchord_withCrunchy(this.__wbg_ptr, is_crunchy);
948
+ * Returns a new [`Chord`] with the `dom9` modifier.
949
+ * @returns {KordChord}
950
+ */
951
+ nine() {
952
+ const ret = wasm.kordchord_nine(this.__wbg_ptr);
941
953
  return KordChord.__wrap(ret);
942
954
  }
943
955
  /**
944
- * Plays the [`Chord`].
945
- * @param {number} delay
946
- * @param {number} length
947
- * @param {number} fade_in
948
- * @returns {Promise<void>}
949
- */
950
- play(delay, length, fade_in) {
951
- const ret = wasm.kordchord_play(this.__wbg_ptr, delay, length, fade_in);
952
- return takeObject(ret);
956
+ * Returns a new [`Chord`] with the `sus2` extension.
957
+ * @returns {KordChord}
958
+ */
959
+ sus2() {
960
+ const ret = wasm.kordchord_sus2(this.__wbg_ptr);
961
+ return KordChord.__wrap(ret);
953
962
  }
954
963
  /**
955
- * Returns the clone of the [`Chord`].
956
- * @returns {KordChord}
957
- */
958
- copy() {
959
- const ret = wasm.kordchord_copy(this.__wbg_ptr);
964
+ * Returns a new [`Chord`] with the `sus4` extension.
965
+ * @returns {KordChord}
966
+ */
967
+ sus4() {
968
+ const ret = wasm.kordchord_sus4(this.__wbg_ptr);
960
969
  return KordChord.__wrap(ret);
961
970
  }
962
971
  /**
963
- * Returns a new [`Chord`] with the `minor` modifier.
964
- * @returns {KordChord}
965
- */
966
- minor() {
967
- const ret = wasm.kordchord_minor(this.__wbg_ptr);
972
+ * Returns a new [`Chord`] with the `add11` extension.
973
+ * @returns {KordChord}
974
+ */
975
+ add11() {
976
+ const ret = wasm.kordchord_add11(this.__wbg_ptr);
977
+ return KordChord.__wrap(ret);
978
+ }
979
+ /**
980
+ * Returns a new [`Chord`] with the `add13` extension.
981
+ * @returns {KordChord}
982
+ */
983
+ add13() {
984
+ const ret = wasm.kordchord_add13(this.__wbg_ptr);
968
985
  return KordChord.__wrap(ret);
969
986
  }
970
987
  /**
971
- * Returns a new [`Chord`] with the `flat5` modifier.
972
- * @returns {KordChord}
973
- */
988
+ * Returns a new [`Chord`] with the `flat5` modifier.
989
+ * @returns {KordChord}
990
+ */
974
991
  flat5() {
975
992
  const ret = wasm.kordchord_flat5(this.__wbg_ptr);
976
993
  return KordChord.__wrap(ret);
977
994
  }
978
995
  /**
979
- * Returns a new [`Chord`] with the `augmented` modifier.
980
- * @returns {KordChord}
981
- */
982
- aug() {
983
- const ret = wasm.kordchord_aug(this.__wbg_ptr);
996
+ * Returns a new [`Chord`] with the `flat9` modifier.
997
+ * @returns {KordChord}
998
+ */
999
+ flat9() {
1000
+ const ret = wasm.kordchord_flat9(this.__wbg_ptr);
984
1001
  return KordChord.__wrap(ret);
985
1002
  }
986
1003
  /**
987
- * Returns a new [`Chord`] with the `maj7` modifier.
988
- * @returns {KordChord}
989
- */
990
- maj7() {
991
- const ret = wasm.kordchord_maj7(this.__wbg_ptr);
1004
+ * Returns a new [`Chord`] with the `minor` modifier.
1005
+ * @returns {KordChord}
1006
+ */
1007
+ minor() {
1008
+ const ret = wasm.kordchord_minor(this.__wbg_ptr);
992
1009
  return KordChord.__wrap(ret);
993
1010
  }
994
1011
  /**
995
- * Returns a new [`Chord`] with the `dom7` modifier.
996
- * @returns {KordChord}
997
- */
1012
+ * Returns a new [`Chord`] with the `dom7` modifier.
1013
+ * @returns {KordChord}
1014
+ */
998
1015
  seven() {
999
1016
  const ret = wasm.kordchord_seven(this.__wbg_ptr);
1000
1017
  return KordChord.__wrap(ret);
1001
1018
  }
1002
1019
  /**
1003
- * Returns a new [`Chord`] with the `dom9` modifier.
1004
- * @returns {KordChord}
1005
- */
1006
- nine() {
1007
- const ret = wasm.kordchord_nine(this.__wbg_ptr);
1008
- return KordChord.__wrap(ret);
1009
- }
1010
- /**
1011
- * Returns a new [`Chord`] with the `dom11` modifier.
1012
- * @returns {KordChord}
1013
- */
1020
+ * Returns a new [`Chord`] with the `dom11` modifier.
1021
+ * @returns {KordChord}
1022
+ */
1014
1023
  eleven() {
1015
1024
  const ret = wasm.kordchord_eleven(this.__wbg_ptr);
1016
1025
  return KordChord.__wrap(ret);
1017
1026
  }
1018
1027
  /**
1019
- * Returns a new [`Chord`] with the `dom13` modifier.
1020
- * @returns {KordChord}
1021
- */
1022
- thirteen() {
1023
- const ret = wasm.kordchord_thirteen(this.__wbg_ptr);
1028
+ * Returns a new [`Chord`] with the `flat11` extension.
1029
+ * @returns {KordChord}
1030
+ */
1031
+ flat11() {
1032
+ const ret = wasm.kordchord_flat11(this.__wbg_ptr);
1024
1033
  return KordChord.__wrap(ret);
1025
1034
  }
1026
1035
  /**
1027
- * Returns a new [`Chord`] with the `flat9` modifier.
1028
- * @returns {KordChord}
1029
- */
1030
- flat9() {
1031
- const ret = wasm.kordchord_flat9(this.__wbg_ptr);
1036
+ * Returns a new [`Chord`] with the `flat13` extension.
1037
+ * @returns {KordChord}
1038
+ */
1039
+ flat13() {
1040
+ const ret = wasm.kordchord_flat13(this.__wbg_ptr);
1032
1041
  return KordChord.__wrap(ret);
1033
1042
  }
1034
1043
  /**
1035
- * Returns a new [`Chord`] with the `sharp9` modifier.
1036
- * @returns {KordChord}
1037
- */
1044
+ * Returns a new [`Chord`] with the `sharp9` modifier.
1045
+ * @returns {KordChord}
1046
+ */
1038
1047
  sharp9() {
1039
1048
  const ret = wasm.kordchord_sharp9(this.__wbg_ptr);
1040
1049
  return KordChord.__wrap(ret);
1041
1050
  }
1042
1051
  /**
1043
- * Returns a new [`Chord`] with the `sharp11` modifier.
1044
- * @returns {KordChord}
1045
- */
1052
+ * Returns a new [`Chord`] with the `sharp11` modifier.
1053
+ * @returns {KordChord}
1054
+ */
1046
1055
  sharp11() {
1047
1056
  const ret = wasm.kordchord_sharp11(this.__wbg_ptr);
1048
1057
  return KordChord.__wrap(ret);
1049
1058
  }
1050
1059
  /**
1051
- * Returns a new [`Chord`] with the `dim` modifier.
1052
- * @returns {KordChord}
1053
- */
1054
- dim() {
1055
- const ret = wasm.kordchord_dim(this.__wbg_ptr);
1060
+ * Returns a new [`Chord`] with the `sharp13` extension.
1061
+ * @returns {KordChord}
1062
+ */
1063
+ sharp13() {
1064
+ const ret = wasm.kordchord_sharp13(this.__wbg_ptr);
1056
1065
  return KordChord.__wrap(ret);
1057
1066
  }
1058
1067
  /**
1059
- * Returns a new [`Chord`] with the `halfDim` modifier.
1060
- * @returns {KordChord}
1061
- */
1068
+ * Returns a new [`Chord`] with the `halfDim` modifier.
1069
+ * @returns {KordChord}
1070
+ */
1062
1071
  halfDim() {
1063
1072
  const ret = wasm.kordchord_halfDim(this.__wbg_ptr);
1064
1073
  return KordChord.__wrap(ret);
1065
1074
  }
1066
1075
  /**
1067
- * Returns a new [`Chord`] with the `sus2` extension.
1068
- * @returns {KordChord}
1069
- */
1070
- sus2() {
1071
- const ret = wasm.kordchord_sus2(this.__wbg_ptr);
1076
+ * Returns a new [`Chord`] with the `dom13` modifier.
1077
+ * @returns {KordChord}
1078
+ */
1079
+ thirteen() {
1080
+ const ret = wasm.kordchord_thirteen(this.__wbg_ptr);
1072
1081
  return KordChord.__wrap(ret);
1073
1082
  }
1083
+ }
1084
+
1085
+ const KordModeFinalization = (typeof FinalizationRegistry === 'undefined')
1086
+ ? { register: () => {}, unregister: () => {} }
1087
+ : new FinalizationRegistry(ptr => wasm.__wbg_kordmode_free(ptr >>> 0, 1));
1088
+ /**
1089
+ * The [`Mode`] wrapper.
1090
+ */
1091
+ export class KordMode {
1092
+
1093
+ static __wrap(ptr) {
1094
+ ptr = ptr >>> 0;
1095
+ const obj = Object.create(KordMode.prototype);
1096
+ obj.__wbg_ptr = ptr;
1097
+ KordModeFinalization.register(obj, obj.__wbg_ptr, obj);
1098
+ return obj;
1099
+ }
1100
+
1101
+ __destroy_into_raw() {
1102
+ const ptr = this.__wbg_ptr;
1103
+ this.__wbg_ptr = 0;
1104
+ KordModeFinalization.unregister(this);
1105
+ return ptr;
1106
+ }
1107
+
1108
+ free() {
1109
+ const ptr = this.__destroy_into_raw();
1110
+ wasm.__wbg_kordmode_free(ptr, 0);
1111
+ }
1074
1112
  /**
1075
- * Returns a new [`Chord`] with the `sus4` extension.
1076
- * @returns {KordChord}
1077
- */
1078
- sus4() {
1079
- const ret = wasm.kordchord_sus4(this.__wbg_ptr);
1080
- return KordChord.__wrap(ret);
1113
+ * Returns the [`Mode`]'s description.
1114
+ * @returns {string}
1115
+ */
1116
+ description() {
1117
+ let deferred1_0;
1118
+ let deferred1_1;
1119
+ try {
1120
+ const ret = wasm.kordmode_description(this.__wbg_ptr);
1121
+ deferred1_0 = ret[0];
1122
+ deferred1_1 = ret[1];
1123
+ return getStringFromWasm0(ret[0], ret[1]);
1124
+ } finally {
1125
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1126
+ }
1081
1127
  }
1082
1128
  /**
1083
- * Returns a new [`Chord`] with the `flat11` extension.
1084
- * @returns {KordChord}
1085
- */
1086
- flat11() {
1087
- const ret = wasm.kordchord_flat11(this.__wbg_ptr);
1088
- return KordChord.__wrap(ret);
1129
+ * Returns the [`Mode`]'s notes as a string.
1130
+ * @returns {string}
1131
+ */
1132
+ notesString() {
1133
+ let deferred1_0;
1134
+ let deferred1_1;
1135
+ try {
1136
+ const ret = wasm.kordmode_notesString(this.__wbg_ptr);
1137
+ deferred1_0 = ret[0];
1138
+ deferred1_1 = ret[1];
1139
+ return getStringFromWasm0(ret[0], ret[1]);
1140
+ } finally {
1141
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1142
+ }
1089
1143
  }
1090
1144
  /**
1091
- * Returns a new [`Chord`] with the `flat13` extension.
1092
- * @returns {KordChord}
1093
- */
1094
- flat13() {
1095
- const ret = wasm.kordchord_flat13(this.__wbg_ptr);
1096
- return KordChord.__wrap(ret);
1145
+ * Returns the [`Mode`]'s precise name.
1146
+ * @returns {string}
1147
+ */
1148
+ preciseName() {
1149
+ let deferred1_0;
1150
+ let deferred1_1;
1151
+ try {
1152
+ const ret = wasm.kordmode_preciseName(this.__wbg_ptr);
1153
+ deferred1_0 = ret[0];
1154
+ deferred1_1 = ret[1];
1155
+ return getStringFromWasm0(ret[0], ret[1]);
1156
+ } finally {
1157
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1158
+ }
1097
1159
  }
1098
1160
  /**
1099
- * Returns a new [`Chord`] with the `sharp13` extension.
1100
- * @returns {KordChord}
1101
- */
1102
- sharp13() {
1103
- const ret = wasm.kordchord_sharp13(this.__wbg_ptr);
1104
- return KordChord.__wrap(ret);
1161
+ * Returns the clone of the [`Mode`].
1162
+ * @returns {KordMode}
1163
+ */
1164
+ copy() {
1165
+ const ret = wasm.kordmode_copy(this.__wbg_ptr);
1166
+ return KordMode.__wrap(ret);
1105
1167
  }
1106
1168
  /**
1107
- * Returns a new [`Chord`] with the `add2` extension.
1108
- * @returns {KordChord}
1109
- */
1110
- add2() {
1111
- const ret = wasm.kordchord_add2(this.__wbg_ptr);
1112
- return KordChord.__wrap(ret);
1169
+ * Returns the [`Mode`]'s friendly name.
1170
+ * @returns {string}
1171
+ */
1172
+ name() {
1173
+ let deferred1_0;
1174
+ let deferred1_1;
1175
+ try {
1176
+ const ret = wasm.kordmode_name(this.__wbg_ptr);
1177
+ deferred1_0 = ret[0];
1178
+ deferred1_1 = ret[1];
1179
+ return getStringFromWasm0(ret[0], ret[1]);
1180
+ } finally {
1181
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1182
+ }
1113
1183
  }
1114
1184
  /**
1115
- * Returns a new [`Chord`] with the `add4` extension.
1116
- * @returns {KordChord}
1117
- */
1118
- add4() {
1119
- const ret = wasm.kordchord_add4(this.__wbg_ptr);
1120
- return KordChord.__wrap(ret);
1185
+ * Returns the [`Mode`]'s root note.
1186
+ * @returns {string}
1187
+ */
1188
+ root() {
1189
+ let deferred1_0;
1190
+ let deferred1_1;
1191
+ try {
1192
+ const ret = wasm.kordmode_root(this.__wbg_ptr);
1193
+ deferred1_0 = ret[0];
1194
+ deferred1_1 = ret[1];
1195
+ return getStringFromWasm0(ret[0], ret[1]);
1196
+ } finally {
1197
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1198
+ }
1121
1199
  }
1122
1200
  /**
1123
- * Returns a new [`Chord`] with the `add6` extension.
1124
- * @returns {KordChord}
1125
- */
1126
- add6() {
1127
- const ret = wasm.kordchord_add6(this.__wbg_ptr);
1128
- return KordChord.__wrap(ret);
1201
+ * Returns the [`Mode`]'s notes.
1202
+ * @returns {Array<any>}
1203
+ */
1204
+ notes() {
1205
+ const ret = wasm.kordmode_notes(this.__wbg_ptr);
1206
+ return ret;
1129
1207
  }
1130
1208
  /**
1131
- * Returns a new [`Chord`] with the `add9` extension.
1132
- * @returns {KordChord}
1133
- */
1134
- add9() {
1135
- const ret = wasm.kordchord_add9(this.__wbg_ptr);
1136
- return KordChord.__wrap(ret);
1209
+ * Creates a new [`Mode`] by parsing a string (e.g., "C dorian", "D lydian dominant").
1210
+ * @param {string} name
1211
+ * @returns {KordMode}
1212
+ */
1213
+ static parse(name) {
1214
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1215
+ const len0 = WASM_VECTOR_LEN;
1216
+ const ret = wasm.kordmode_parse(ptr0, len0);
1217
+ if (ret[2]) {
1218
+ throw takeFromExternrefTable0(ret[1]);
1219
+ }
1220
+ return KordMode.__wrap(ret[0]);
1137
1221
  }
1138
1222
  /**
1139
- * Returns a new [`Chord`] with the `add11` extension.
1140
- * @returns {KordChord}
1141
- */
1142
- add11() {
1143
- const ret = wasm.kordchord_add11(this.__wbg_ptr);
1144
- return KordChord.__wrap(ret);
1223
+ * Returns the [`Mode`] as a string (same as `precise_name`).
1224
+ * @returns {string}
1225
+ */
1226
+ toString() {
1227
+ let deferred1_0;
1228
+ let deferred1_1;
1229
+ try {
1230
+ const ret = wasm.kordmode_toString(this.__wbg_ptr);
1231
+ deferred1_0 = ret[0];
1232
+ deferred1_1 = ret[1];
1233
+ return getStringFromWasm0(ret[0], ret[1]);
1234
+ } finally {
1235
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1236
+ }
1237
+ }
1238
+ }
1239
+
1240
+ const KordNoteFinalization = (typeof FinalizationRegistry === 'undefined')
1241
+ ? { register: () => {}, unregister: () => {} }
1242
+ : new FinalizationRegistry(ptr => wasm.__wbg_kordnote_free(ptr >>> 0, 1));
1243
+ /**
1244
+ * The [`Note`] wrapper.
1245
+ */
1246
+ export class KordNote {
1247
+
1248
+ static __wrap(ptr) {
1249
+ ptr = ptr >>> 0;
1250
+ const obj = Object.create(KordNote.prototype);
1251
+ obj.__wbg_ptr = ptr;
1252
+ KordNoteFinalization.register(obj, obj.__wbg_ptr, obj);
1253
+ return obj;
1254
+ }
1255
+
1256
+ __destroy_into_raw() {
1257
+ const ptr = this.__wbg_ptr;
1258
+ this.__wbg_ptr = 0;
1259
+ KordNoteFinalization.unregister(this);
1260
+ return ptr;
1261
+ }
1262
+
1263
+ free() {
1264
+ const ptr = this.__destroy_into_raw();
1265
+ wasm.__wbg_kordnote_free(ptr, 0);
1145
1266
  }
1146
1267
  /**
1147
- * Returns a new [`Chord`] with the `add13` extension.
1148
- * @returns {KordChord}
1149
- */
1150
- add13() {
1151
- const ret = wasm.kordchord_add13(this.__wbg_ptr);
1152
- return KordChord.__wrap(ret);
1268
+ * Returns [`Note`]s from audio data.
1269
+ * @param {Float32Array} data
1270
+ * @param {number} length_in_seconds
1271
+ * @returns {Array<any>}
1272
+ */
1273
+ static fromAudio(data, length_in_seconds) {
1274
+ const ptr0 = passArrayF32ToWasm0(data, wasm.__wbindgen_malloc);
1275
+ const len0 = WASM_VECTOR_LEN;
1276
+ const ret = wasm.kordnote_fromAudio(ptr0, len0, length_in_seconds);
1277
+ if (ret[2]) {
1278
+ throw takeFromExternrefTable0(ret[1]);
1279
+ }
1280
+ return takeFromExternrefTable0(ret[0]);
1281
+ }
1282
+ /**
1283
+ * Computes the [`Interval`] distance between the [`Note`] and the given [`Note`].
1284
+ * @param {KordNote} other
1285
+ * @returns {KordInterval}
1286
+ */
1287
+ distanceTo(other) {
1288
+ _assertClass(other, KordNote);
1289
+ var ptr0 = other.__destroy_into_raw();
1290
+ const ret = wasm.kordnote_distanceTo(this.__wbg_ptr, ptr0);
1291
+ return ret;
1292
+ }
1293
+ /**
1294
+ * Adds the given interval to the [`Note`], producing a new [`Note`] instance.
1295
+ * @param {KordInterval} interval
1296
+ * @returns {KordNote}
1297
+ */
1298
+ addInterval(interval) {
1299
+ const ret = wasm.kordnote_addInterval(this.__wbg_ptr, interval);
1300
+ return KordNote.__wrap(ret);
1301
+ }
1302
+ /**
1303
+ * Returns [`Note`]s from audio data using the ML inference algorithm.
1304
+ * @param {Float32Array} data
1305
+ * @param {number} length_in_seconds
1306
+ * @returns {Array<any>}
1307
+ */
1308
+ static fromAudioMl(data, length_in_seconds) {
1309
+ const ptr0 = passArrayF32ToWasm0(data, wasm.__wbindgen_malloc);
1310
+ const len0 = WASM_VECTOR_LEN;
1311
+ const ret = wasm.kordnote_fromAudioMl(ptr0, len0, length_in_seconds);
1312
+ if (ret[2]) {
1313
+ throw takeFromExternrefTable0(ret[1]);
1314
+ }
1315
+ return takeFromExternrefTable0(ret[0]);
1316
+ }
1317
+ /**
1318
+ * Returns the primary (first 13) harmonic series of the [`Note`].
1319
+ * @returns {Array<any>}
1320
+ */
1321
+ harmonicSeries() {
1322
+ const ret = wasm.kordnote_harmonicSeries(this.__wbg_ptr);
1323
+ return ret;
1324
+ }
1325
+ /**
1326
+ * Subtracts the given interval from the [`Note`], producing a new [`Note`] instance.
1327
+ * @param {KordInterval} interval
1328
+ * @returns {KordNote}
1329
+ */
1330
+ subInterval(interval) {
1331
+ const ret = wasm.kordnote_subInterval(this.__wbg_ptr, interval);
1332
+ return KordNote.__wrap(ret);
1333
+ }
1334
+ /**
1335
+ * Returns the clone of the [`Note`].
1336
+ * @returns {KordNote}
1337
+ */
1338
+ copy() {
1339
+ const ret = wasm.kordnote_copy(this.__wbg_ptr);
1340
+ return KordNote.__wrap(ret);
1341
+ }
1342
+ /**
1343
+ * Returns the [`Note`]'s friendly name.
1344
+ * @returns {string}
1345
+ */
1346
+ name() {
1347
+ let deferred1_0;
1348
+ let deferred1_1;
1349
+ try {
1350
+ const ret = wasm.kordnote_name(this.__wbg_ptr);
1351
+ deferred1_0 = ret[0];
1352
+ deferred1_1 = ret[1];
1353
+ return getStringFromWasm0(ret[0], ret[1]);
1354
+ } finally {
1355
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1356
+ }
1357
+ }
1358
+ /**
1359
+ * Creates a new [`Note`] from a frequency.
1360
+ * @param {string} name
1361
+ * @returns {KordNote}
1362
+ */
1363
+ static parse(name) {
1364
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1365
+ const len0 = WASM_VECTOR_LEN;
1366
+ const ret = wasm.kordnote_parse(ptr0, len0);
1367
+ if (ret[2]) {
1368
+ throw takeFromExternrefTable0(ret[1]);
1369
+ }
1370
+ return KordNote.__wrap(ret[0]);
1371
+ }
1372
+ /**
1373
+ * Returns the [`Note`]'s [`NamedPitch`].
1374
+ * @returns {string}
1375
+ */
1376
+ pitch() {
1377
+ let deferred1_0;
1378
+ let deferred1_1;
1379
+ try {
1380
+ const ret = wasm.kordnote_pitch(this.__wbg_ptr);
1381
+ deferred1_0 = ret[0];
1382
+ deferred1_1 = ret[1];
1383
+ return getStringFromWasm0(ret[0], ret[1]);
1384
+ } finally {
1385
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1386
+ }
1387
+ }
1388
+ /**
1389
+ * Returns the [`Note`]'s [`Octave`].
1390
+ * @returns {number}
1391
+ */
1392
+ octave() {
1393
+ const ret = wasm.kordnote_octave(this.__wbg_ptr);
1394
+ return ret;
1395
+ }
1396
+ /**
1397
+ * Returns the [`Note`]'s frequency.
1398
+ * @returns {number}
1399
+ */
1400
+ frequency() {
1401
+ const ret = wasm.kordnote_frequency(this.__wbg_ptr);
1402
+ return ret;
1403
+ }
1404
+ /**
1405
+ * Returns the [`Note`] represented as a string (same as `name`).
1406
+ * @returns {string}
1407
+ */
1408
+ toString() {
1409
+ let deferred1_0;
1410
+ let deferred1_1;
1411
+ try {
1412
+ const ret = wasm.kordnote_toString(this.__wbg_ptr);
1413
+ deferred1_0 = ret[0];
1414
+ deferred1_1 = ret[1];
1415
+ return getStringFromWasm0(ret[0], ret[1]);
1416
+ } finally {
1417
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1418
+ }
1419
+ }
1420
+ }
1421
+
1422
+ const KordPlaybackHandleFinalization = (typeof FinalizationRegistry === 'undefined')
1423
+ ? { register: () => {}, unregister: () => {} }
1424
+ : new FinalizationRegistry(ptr => wasm.__wbg_kordplaybackhandle_free(ptr >>> 0, 1));
1425
+ /**
1426
+ * A handle to a [`Chord`] playback.
1427
+ *
1428
+ * Should be dropped to stop the playback, or after playback is finished.
1429
+ */
1430
+ export class KordPlaybackHandle {
1431
+
1432
+ __destroy_into_raw() {
1433
+ const ptr = this.__wbg_ptr;
1434
+ this.__wbg_ptr = 0;
1435
+ KordPlaybackHandleFinalization.unregister(this);
1436
+ return ptr;
1437
+ }
1438
+
1439
+ free() {
1440
+ const ptr = this.__destroy_into_raw();
1441
+ wasm.__wbg_kordplaybackhandle_free(ptr, 0);
1442
+ }
1443
+ }
1444
+
1445
+ const KordScaleFinalization = (typeof FinalizationRegistry === 'undefined')
1446
+ ? { register: () => {}, unregister: () => {} }
1447
+ : new FinalizationRegistry(ptr => wasm.__wbg_kordscale_free(ptr >>> 0, 1));
1448
+ /**
1449
+ * The [`Scale`] wrapper.
1450
+ */
1451
+ export class KordScale {
1452
+
1453
+ static __wrap(ptr) {
1454
+ ptr = ptr >>> 0;
1455
+ const obj = Object.create(KordScale.prototype);
1456
+ obj.__wbg_ptr = ptr;
1457
+ KordScaleFinalization.register(obj, obj.__wbg_ptr, obj);
1458
+ return obj;
1459
+ }
1460
+
1461
+ __destroy_into_raw() {
1462
+ const ptr = this.__wbg_ptr;
1463
+ this.__wbg_ptr = 0;
1464
+ KordScaleFinalization.unregister(this);
1465
+ return ptr;
1466
+ }
1467
+
1468
+ free() {
1469
+ const ptr = this.__destroy_into_raw();
1470
+ wasm.__wbg_kordscale_free(ptr, 0);
1471
+ }
1472
+ /**
1473
+ * Returns the [`Scale`]'s description.
1474
+ * @returns {string}
1475
+ */
1476
+ description() {
1477
+ let deferred1_0;
1478
+ let deferred1_1;
1479
+ try {
1480
+ const ret = wasm.kordscale_description(this.__wbg_ptr);
1481
+ deferred1_0 = ret[0];
1482
+ deferred1_1 = ret[1];
1483
+ return getStringFromWasm0(ret[0], ret[1]);
1484
+ } finally {
1485
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1486
+ }
1487
+ }
1488
+ /**
1489
+ * Returns the [`Scale`]'s notes as a string.
1490
+ * @returns {string}
1491
+ */
1492
+ notesString() {
1493
+ let deferred1_0;
1494
+ let deferred1_1;
1495
+ try {
1496
+ const ret = wasm.kordscale_notesString(this.__wbg_ptr);
1497
+ deferred1_0 = ret[0];
1498
+ deferred1_1 = ret[1];
1499
+ return getStringFromWasm0(ret[0], ret[1]);
1500
+ } finally {
1501
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1502
+ }
1503
+ }
1504
+ /**
1505
+ * Returns the [`Scale`]'s precise name.
1506
+ * @returns {string}
1507
+ */
1508
+ preciseName() {
1509
+ let deferred1_0;
1510
+ let deferred1_1;
1511
+ try {
1512
+ const ret = wasm.kordscale_preciseName(this.__wbg_ptr);
1513
+ deferred1_0 = ret[0];
1514
+ deferred1_1 = ret[1];
1515
+ return getStringFromWasm0(ret[0], ret[1]);
1516
+ } finally {
1517
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1518
+ }
1519
+ }
1520
+ /**
1521
+ * Returns the clone of the [`Scale`].
1522
+ * @returns {KordScale}
1523
+ */
1524
+ copy() {
1525
+ const ret = wasm.kordmode_copy(this.__wbg_ptr);
1526
+ return KordScale.__wrap(ret);
1527
+ }
1528
+ /**
1529
+ * Returns the [`Scale`]'s friendly name.
1530
+ * @returns {string}
1531
+ */
1532
+ name() {
1533
+ let deferred1_0;
1534
+ let deferred1_1;
1535
+ try {
1536
+ const ret = wasm.kordscale_name(this.__wbg_ptr);
1537
+ deferred1_0 = ret[0];
1538
+ deferred1_1 = ret[1];
1539
+ return getStringFromWasm0(ret[0], ret[1]);
1540
+ } finally {
1541
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1542
+ }
1543
+ }
1544
+ /**
1545
+ * Returns the [`Scale`]'s root note.
1546
+ * @returns {string}
1547
+ */
1548
+ root() {
1549
+ let deferred1_0;
1550
+ let deferred1_1;
1551
+ try {
1552
+ const ret = wasm.kordscale_root(this.__wbg_ptr);
1553
+ deferred1_0 = ret[0];
1554
+ deferred1_1 = ret[1];
1555
+ return getStringFromWasm0(ret[0], ret[1]);
1556
+ } finally {
1557
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1558
+ }
1559
+ }
1560
+ /**
1561
+ * Returns the [`Scale`]'s notes.
1562
+ * @returns {Array<any>}
1563
+ */
1564
+ notes() {
1565
+ const ret = wasm.kordscale_notes(this.__wbg_ptr);
1566
+ return ret;
1567
+ }
1568
+ /**
1569
+ * Creates a new [`Scale`] by parsing a string (e.g., "C major", "A harmonic minor", "E blues").
1570
+ * @param {string} name
1571
+ * @returns {KordScale}
1572
+ */
1573
+ static parse(name) {
1574
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1575
+ const len0 = WASM_VECTOR_LEN;
1576
+ const ret = wasm.kordscale_parse(ptr0, len0);
1577
+ if (ret[2]) {
1578
+ throw takeFromExternrefTable0(ret[1]);
1579
+ }
1580
+ return KordScale.__wrap(ret[0]);
1581
+ }
1582
+ /**
1583
+ * Returns the [`Scale`] as a string (same as `precise_name`).
1584
+ * @returns {string}
1585
+ */
1586
+ toString() {
1587
+ let deferred1_0;
1588
+ let deferred1_1;
1589
+ try {
1590
+ const ret = wasm.kordscale_toString(this.__wbg_ptr);
1591
+ deferred1_0 = ret[0];
1592
+ deferred1_1 = ret[1];
1593
+ return getStringFromWasm0(ret[0], ret[1]);
1594
+ } finally {
1595
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1596
+ }
1153
1597
  }
1154
1598
  }
1599
+
1600
+ const KordScaleCandidateFinalization = (typeof FinalizationRegistry === 'undefined')
1601
+ ? { register: () => {}, unregister: () => {} }
1602
+ : new FinalizationRegistry(ptr => wasm.__wbg_kordscalecandidate_free(ptr >>> 0, 1));
1155
1603
  /**
1156
- * The [`Note`] wrapper.
1157
- */
1158
- export class KordNote {
1604
+ * The [`ScaleCandidate`] wrapper for WASM.
1605
+ * Represents a recommended scale or mode for a chord.
1606
+ */
1607
+ export class KordScaleCandidate {
1159
1608
 
1160
1609
  static __wrap(ptr) {
1161
1610
  ptr = ptr >>> 0;
1162
- const obj = Object.create(KordNote.prototype);
1611
+ const obj = Object.create(KordScaleCandidate.prototype);
1163
1612
  obj.__wbg_ptr = ptr;
1164
-
1613
+ KordScaleCandidateFinalization.register(obj, obj.__wbg_ptr, obj);
1165
1614
  return obj;
1166
1615
  }
1167
1616
 
1168
1617
  __destroy_into_raw() {
1169
1618
  const ptr = this.__wbg_ptr;
1170
1619
  this.__wbg_ptr = 0;
1171
-
1620
+ KordScaleCandidateFinalization.unregister(this);
1172
1621
  return ptr;
1173
1622
  }
1174
1623
 
1175
1624
  free() {
1176
1625
  const ptr = this.__destroy_into_raw();
1177
- wasm.__wbg_kordnote_free(ptr);
1178
- }
1179
- /**
1180
- * Creates a new [`Note`] from a frequency.
1181
- * @param {string} name
1182
- * @returns {KordNote}
1183
- */
1184
- static parse(name) {
1185
- try {
1186
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1187
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1188
- const len0 = WASM_VECTOR_LEN;
1189
- wasm.kordnote_parse(retptr, ptr0, len0);
1190
- var r0 = getInt32Memory0()[retptr / 4 + 0];
1191
- var r1 = getInt32Memory0()[retptr / 4 + 1];
1192
- var r2 = getInt32Memory0()[retptr / 4 + 2];
1193
- if (r2) {
1194
- throw takeObject(r1);
1195
- }
1196
- return KordNote.__wrap(r0);
1197
- } finally {
1198
- wasm.__wbindgen_add_to_stack_pointer(16);
1199
- }
1200
- }
1201
- /**
1202
- * Returns [`Note`]s from audio data.
1203
- * @param {Float32Array} data
1204
- * @param {number} length_in_seconds
1205
- * @returns {Array<any>}
1206
- */
1207
- static fromAudio(data, length_in_seconds) {
1208
- try {
1209
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1210
- const ptr0 = passArrayF32ToWasm0(data, wasm.__wbindgen_malloc);
1211
- const len0 = WASM_VECTOR_LEN;
1212
- wasm.kordnote_fromAudio(retptr, ptr0, len0, length_in_seconds);
1213
- var r0 = getInt32Memory0()[retptr / 4 + 0];
1214
- var r1 = getInt32Memory0()[retptr / 4 + 1];
1215
- var r2 = getInt32Memory0()[retptr / 4 + 2];
1216
- if (r2) {
1217
- throw takeObject(r1);
1218
- }
1219
- return takeObject(r0);
1220
- } finally {
1221
- wasm.__wbindgen_add_to_stack_pointer(16);
1222
- }
1223
- }
1224
- /**
1225
- * Returns [`Note`]s from audio data using the ML inference algorithm.
1226
- * @param {Float32Array} data
1227
- * @param {number} length_in_seconds
1228
- * @returns {Array<any>}
1229
- */
1230
- static fromAudioMl(data, length_in_seconds) {
1231
- try {
1232
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1233
- const ptr0 = passArrayF32ToWasm0(data, wasm.__wbindgen_malloc);
1234
- const len0 = WASM_VECTOR_LEN;
1235
- wasm.kordnote_fromAudioMl(retptr, ptr0, len0, length_in_seconds);
1236
- var r0 = getInt32Memory0()[retptr / 4 + 0];
1237
- var r1 = getInt32Memory0()[retptr / 4 + 1];
1238
- var r2 = getInt32Memory0()[retptr / 4 + 2];
1239
- if (r2) {
1240
- throw takeObject(r1);
1241
- }
1242
- return takeObject(r0);
1243
- } finally {
1244
- wasm.__wbindgen_add_to_stack_pointer(16);
1245
- }
1626
+ wasm.__wbg_kordscalecandidate_free(ptr, 0);
1246
1627
  }
1247
1628
  /**
1248
- * Returns the [`Note`]'s friendly name.
1249
- * @returns {string}
1250
- */
1251
- name() {
1629
+ * Returns the description of the scale or mode.
1630
+ * @returns {string}
1631
+ */
1632
+ description() {
1252
1633
  let deferred1_0;
1253
1634
  let deferred1_1;
1254
1635
  try {
1255
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1256
- wasm.kordnote_name(retptr, this.__wbg_ptr);
1257
- var r0 = getInt32Memory0()[retptr / 4 + 0];
1258
- var r1 = getInt32Memory0()[retptr / 4 + 1];
1259
- deferred1_0 = r0;
1260
- deferred1_1 = r1;
1261
- return getStringFromWasm0(r0, r1);
1636
+ const ret = wasm.kordscalecandidate_description(this.__wbg_ptr);
1637
+ deferred1_0 = ret[0];
1638
+ deferred1_1 = ret[1];
1639
+ return getStringFromWasm0(ret[0], ret[1]);
1262
1640
  } finally {
1263
- wasm.__wbindgen_add_to_stack_pointer(16);
1264
1641
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1265
1642
  }
1266
1643
  }
1267
1644
  /**
1268
- * Returns the [`Note`] represented as a string (same as `name`).
1269
- * @returns {string}
1270
- */
1271
- toString() {
1645
+ * Returns the notes as a space-separated string.
1646
+ * @returns {string}
1647
+ */
1648
+ notesString() {
1272
1649
  let deferred1_0;
1273
1650
  let deferred1_1;
1274
1651
  try {
1275
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1276
- wasm.kordnote_toString(retptr, this.__wbg_ptr);
1277
- var r0 = getInt32Memory0()[retptr / 4 + 0];
1278
- var r1 = getInt32Memory0()[retptr / 4 + 1];
1279
- deferred1_0 = r0;
1280
- deferred1_1 = r1;
1281
- return getStringFromWasm0(r0, r1);
1652
+ const ret = wasm.kordscalecandidate_notesString(this.__wbg_ptr);
1653
+ deferred1_0 = ret[0];
1654
+ deferred1_1 = ret[1];
1655
+ return getStringFromWasm0(ret[0], ret[1]);
1282
1656
  } finally {
1283
- wasm.__wbindgen_add_to_stack_pointer(16);
1284
1657
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1285
1658
  }
1286
1659
  }
1287
1660
  /**
1288
- * Returns the [`Note`]'s [`NamedPitch`].
1289
- * @returns {string}
1290
- */
1291
- pitch() {
1661
+ * Returns the clone of the [`KordScaleCandidate`].
1662
+ * @returns {KordScaleCandidate}
1663
+ */
1664
+ copy() {
1665
+ const ret = wasm.kordscalecandidate_copy(this.__wbg_ptr);
1666
+ return KordScaleCandidate.__wrap(ret);
1667
+ }
1668
+ /**
1669
+ * Returns the name of the scale or mode.
1670
+ * @returns {string}
1671
+ */
1672
+ name() {
1292
1673
  let deferred1_0;
1293
1674
  let deferred1_1;
1294
1675
  try {
1295
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1296
- wasm.kordnote_pitch(retptr, this.__wbg_ptr);
1297
- var r0 = getInt32Memory0()[retptr / 4 + 0];
1298
- var r1 = getInt32Memory0()[retptr / 4 + 1];
1299
- deferred1_0 = r0;
1300
- deferred1_1 = r1;
1301
- return getStringFromWasm0(r0, r1);
1676
+ const ret = wasm.kordscalecandidate_name(this.__wbg_ptr);
1677
+ deferred1_0 = ret[0];
1678
+ deferred1_1 = ret[1];
1679
+ return getStringFromWasm0(ret[0], ret[1]);
1302
1680
  } finally {
1303
- wasm.__wbindgen_add_to_stack_pointer(16);
1304
1681
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1305
1682
  }
1306
1683
  }
1307
1684
  /**
1308
- * Returns the [`Note`]'s [`Octave`].
1309
- * @returns {number}
1310
- */
1311
- octave() {
1312
- const ret = wasm.kordnote_octave(this.__wbg_ptr);
1685
+ * Returns the candidate's rank (1 = most relevant).
1686
+ * @returns {number}
1687
+ */
1688
+ rank() {
1689
+ const ret = wasm.kordscalecandidate_rank(this.__wbg_ptr);
1313
1690
  return ret;
1314
1691
  }
1315
1692
  /**
1316
- * Returns the [`Note`]'s frequency.
1317
- * @returns {number}
1318
- */
1319
- frequency() {
1320
- const ret = wasm.kordnote_frequency(this.__wbg_ptr);
1693
+ * Returns the notes of this scale/mode rooted at the chord's root.
1694
+ * @returns {Array<any>}
1695
+ */
1696
+ notes() {
1697
+ const ret = wasm.kordscalecandidate_notes(this.__wbg_ptr);
1321
1698
  return ret;
1322
1699
  }
1323
1700
  /**
1324
- * Adds the given interval to the [`Note`], producing a new [`Note`] instance.
1325
- * @param {KordInterval} interval
1326
- * @returns {KordNote}
1327
- */
1328
- addInterval(interval) {
1329
- const ret = wasm.kordnote_addInterval(this.__wbg_ptr, interval);
1330
- return KordNote.__wrap(ret);
1331
- }
1332
- /**
1333
- * Subtracts the given interval from the [`Note`], producing a new [`Note`] instance.
1334
- * @param {KordInterval} interval
1335
- * @returns {KordNote}
1336
- */
1337
- subInterval(interval) {
1338
- const ret = wasm.kordnote_subInterval(this.__wbg_ptr, interval);
1339
- return KordNote.__wrap(ret);
1340
- }
1341
- /**
1342
- * Computes the [`Interval`] distance between the [`Note`] and the given [`Note`].
1343
- * @param {KordNote} other
1344
- * @returns {KordInterval}
1345
- */
1346
- distanceTo(other) {
1347
- _assertClass(other, KordNote);
1348
- var ptr0 = other.__destroy_into_raw();
1349
- const ret = wasm.kordnote_distanceTo(this.__wbg_ptr, ptr0);
1350
- return ret;
1701
+ * Returns the reason why this scale/mode fits the chord.
1702
+ * @returns {string}
1703
+ */
1704
+ reason() {
1705
+ let deferred1_0;
1706
+ let deferred1_1;
1707
+ try {
1708
+ const ret = wasm.kordscalecandidate_reason(this.__wbg_ptr);
1709
+ deferred1_0 = ret[0];
1710
+ deferred1_1 = ret[1];
1711
+ return getStringFromWasm0(ret[0], ret[1]);
1712
+ } finally {
1713
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1714
+ }
1351
1715
  }
1352
1716
  /**
1353
- * Returns the primary (first 13) harmonic series of the [`Note`].
1354
- * @returns {Array<any>}
1355
- */
1356
- harmonicSeries() {
1357
- const ret = wasm.kordnote_harmonicSeries(this.__wbg_ptr);
1358
- return takeObject(ret);
1717
+ * Returns whether this is a mode candidate (vs. scale candidate).
1718
+ * @returns {boolean}
1719
+ */
1720
+ isMode() {
1721
+ const ret = wasm.kordscalecandidate_isMode(this.__wbg_ptr);
1722
+ return ret !== 0;
1359
1723
  }
1360
1724
  /**
1361
- * Returns the clone of the [`Note`].
1362
- * @returns {KordNote}
1363
- */
1364
- copy() {
1365
- const ret = wasm.kordnote_copy(this.__wbg_ptr);
1366
- return KordNote.__wrap(ret);
1725
+ * Returns whether this is a scale candidate (vs. mode candidate).
1726
+ * @returns {boolean}
1727
+ */
1728
+ isScale() {
1729
+ const ret = wasm.kordscalecandidate_isScale(this.__wbg_ptr);
1730
+ return ret !== 0;
1367
1731
  }
1368
1732
  }
1369
- /**
1370
- * A handle to a [`Chord`] playback.
1371
- *
1372
- * Should be dropped to stop the playback, or after playback is finished.
1373
- */
1374
- export class KordPlaybackHandle {
1375
-
1376
- __destroy_into_raw() {
1377
- const ptr = this.__wbg_ptr;
1378
- this.__wbg_ptr = 0;
1379
1733
 
1380
- return ptr;
1381
- }
1734
+ export function __wbg_call_672a4d21634d4a24() { return handleError(function (arg0, arg1) {
1735
+ const ret = arg0.call(arg1);
1736
+ return ret;
1737
+ }, arguments) };
1382
1738
 
1383
- free() {
1384
- const ptr = this.__destroy_into_raw();
1385
- wasm.__wbg_kordplaybackhandle_free(ptr);
1386
- }
1387
- }
1739
+ export function __wbg_call_7cccdd69e0791ae2() { return handleError(function (arg0, arg1, arg2) {
1740
+ const ret = arg0.call(arg1, arg2);
1741
+ return ret;
1742
+ }, arguments) };
1388
1743
 
1389
- export function __wbindgen_cb_drop(arg0) {
1390
- const obj = takeObject(arg0).original;
1391
- if (obj.cnt-- == 1) {
1392
- obj.a = 0;
1393
- return true;
1394
- }
1395
- const ret = false;
1744
+ export function __wbg_clearTimeout_5a54f8841c30079a(arg0) {
1745
+ const ret = clearTimeout(arg0);
1396
1746
  return ret;
1397
1747
  };
1398
1748
 
1399
- export function __wbindgen_object_drop_ref(arg0) {
1400
- takeObject(arg0);
1401
- };
1749
+ export function __wbg_close_5a97ef05b337f8ce() { return handleError(function (arg0) {
1750
+ const ret = arg0.close();
1751
+ return ret;
1752
+ }, arguments) };
1402
1753
 
1403
- export function __wbindgen_number_get(arg0, arg1) {
1404
- const obj = getObject(arg1);
1405
- const ret = typeof(obj) === 'number' ? obj : undefined;
1406
- getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
1407
- getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
1408
- };
1754
+ export function __wbg_connect_b22945d106632a36() { return handleError(function (arg0, arg1) {
1755
+ const ret = arg0.connect(arg1);
1756
+ return ret;
1757
+ }, arguments) };
1409
1758
 
1410
- export function __wbindgen_string_new(arg0, arg1) {
1411
- const ret = getStringFromWasm0(arg0, arg1);
1412
- return addHeapObject(ret);
1759
+ export function __wbg_constructor_9fd96f589d65d4e5(arg0) {
1760
+ const ret = arg0.constructor;
1761
+ return ret;
1413
1762
  };
1414
1763
 
1415
- export function __wbindgen_number_new(arg0) {
1416
- const ret = arg0;
1417
- return addHeapObject(ret);
1418
- };
1764
+ export function __wbg_copyToChannel_b81ecf19fd54e146() { return handleError(function (arg0, arg1, arg2, arg3) {
1765
+ arg0.copyToChannel(getArrayF32FromWasm0(arg1, arg2), arg3);
1766
+ }, arguments) };
1419
1767
 
1420
- export function __wbg_kordnote_new(arg0) {
1421
- const ret = KordNote.__wrap(arg0);
1422
- return addHeapObject(ret);
1423
- };
1768
+ export function __wbg_createBufferSource_f7860a96f709acbd() { return handleError(function (arg0) {
1769
+ const ret = arg0.createBufferSource();
1770
+ return ret;
1771
+ }, arguments) };
1424
1772
 
1425
- export function __wbg_kordchord_new(arg0) {
1426
- const ret = KordChord.__wrap(arg0);
1427
- return addHeapObject(ret);
1773
+ export function __wbg_createBuffer_926beeec3ff39b5a() { return handleError(function (arg0, arg1, arg2, arg3) {
1774
+ const ret = arg0.createBuffer(arg1 >>> 0, arg2 >>> 0, arg3);
1775
+ return ret;
1776
+ }, arguments) };
1777
+
1778
+ export function __wbg_currentTime_adef4d803f58eb66(arg0) {
1779
+ const ret = arg0.currentTime;
1780
+ return ret;
1428
1781
  };
1429
1782
 
1430
- export function __wbg_clearTimeout_76877dbc010e786d(arg0) {
1431
- const ret = clearTimeout(takeObject(arg0));
1432
- return addHeapObject(ret);
1783
+ export function __wbg_destination_6400091abd6f01b3(arg0) {
1784
+ const ret = arg0.destination;
1785
+ return ret;
1433
1786
  };
1434
1787
 
1435
- export function __wbg_setTimeout_75cb9b6991a4031d() { return handleError(function (arg0, arg1) {
1436
- const ret = setTimeout(getObject(arg0), arg1);
1437
- return addHeapObject(ret);
1788
+ export function __wbg_get_67b2ba62fc30de12() { return handleError(function (arg0, arg1) {
1789
+ const ret = Reflect.get(arg0, arg1);
1790
+ return ret;
1438
1791
  }, arguments) };
1439
1792
 
1440
- export function __wbindgen_boolean_get(arg0) {
1441
- const v = getObject(arg0);
1442
- const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
1793
+ export function __wbg_get_b9b93047fe3cf45b(arg0, arg1) {
1794
+ const ret = arg0[arg1 >>> 0];
1443
1795
  return ret;
1444
1796
  };
1445
1797
 
1446
- export function __wbg_instanceof_Window_9029196b662bc42a(arg0) {
1798
+ export function __wbg_instanceof_Object_7f2dcef8f78644a4(arg0) {
1447
1799
  let result;
1448
1800
  try {
1449
- result = getObject(arg0) instanceof Window;
1801
+ result = arg0 instanceof Object;
1450
1802
  } catch (_) {
1451
1803
  result = false;
1452
1804
  }
@@ -1454,235 +1806,252 @@ export function __wbg_instanceof_Window_9029196b662bc42a(arg0) {
1454
1806
  return ret;
1455
1807
  };
1456
1808
 
1457
- export function __wbg_setTimeout_eb1a0d116c26d9f6() { return handleError(function (arg0, arg1, arg2) {
1458
- const ret = getObject(arg0).setTimeout(getObject(arg1), arg2);
1809
+ export function __wbg_instanceof_Window_def73ea0955fc569(arg0) {
1810
+ let result;
1811
+ try {
1812
+ result = arg0 instanceof Window;
1813
+ } catch (_) {
1814
+ result = false;
1815
+ }
1816
+ const ret = result;
1459
1817
  return ret;
1460
- }, arguments) };
1461
-
1462
- export function __wbg_destination_9e793cf556243084(arg0) {
1463
- const ret = getObject(arg0).destination;
1464
- return addHeapObject(ret);
1465
1818
  };
1466
1819
 
1467
- export function __wbg_currentTime_c6831b97750b898c(arg0) {
1468
- const ret = getObject(arg0).currentTime;
1820
+ export function __wbg_kordchord_new(arg0) {
1821
+ const ret = KordChord.__wrap(arg0);
1469
1822
  return ret;
1470
1823
  };
1471
1824
 
1472
- export function __wbg_newwithcontextoptions_3fb88aa326cd01e0() { return handleError(function (arg0) {
1473
- const ret = new lAudioContext(getObject(arg0));
1474
- return addHeapObject(ret);
1475
- }, arguments) };
1476
-
1477
- export function __wbg_close_51aa5539747ce076() { return handleError(function (arg0) {
1478
- const ret = getObject(arg0).close();
1479
- return addHeapObject(ret);
1480
- }, arguments) };
1481
-
1482
- export function __wbg_createBuffer_13cd030d2b48e8fa() { return handleError(function (arg0, arg1, arg2, arg3) {
1483
- const ret = getObject(arg0).createBuffer(arg1 >>> 0, arg2 >>> 0, arg3);
1484
- return addHeapObject(ret);
1485
- }, arguments) };
1486
-
1487
- export function __wbg_createBufferSource_58423f6345b5f559() { return handleError(function (arg0) {
1488
- const ret = getObject(arg0).createBufferSource();
1489
- return addHeapObject(ret);
1490
- }, arguments) };
1491
-
1492
- export function __wbg_resume_9dc64ed7c3a65255() { return handleError(function (arg0) {
1493
- const ret = getObject(arg0).resume();
1494
- return addHeapObject(ret);
1495
- }, arguments) };
1496
-
1497
- export function __wbindgen_string_get(arg0, arg1) {
1498
- const obj = getObject(arg1);
1499
- const ret = typeof(obj) === 'string' ? obj : undefined;
1500
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1501
- var len1 = WASM_VECTOR_LEN;
1502
- getInt32Memory0()[arg0 / 4 + 1] = len1;
1503
- getInt32Memory0()[arg0 / 4 + 0] = ptr1;
1825
+ export function __wbg_kordnote_new(arg0) {
1826
+ const ret = KordNote.__wrap(arg0);
1827
+ return ret;
1504
1828
  };
1505
1829
 
1506
- export function __wbg_copyToChannel_6e4bd2545a53db54() { return handleError(function (arg0, arg1, arg2, arg3) {
1507
- getObject(arg0).copyToChannel(getArrayF32FromWasm0(arg1, arg2), arg3);
1508
- }, arguments) };
1509
-
1510
- export function __wbg_setbuffer_beeece042e02534f(arg0, arg1) {
1511
- getObject(arg0).buffer = getObject(arg1);
1830
+ export function __wbg_kordscalecandidate_new(arg0) {
1831
+ const ret = KordScaleCandidate.__wrap(arg0);
1832
+ return ret;
1512
1833
  };
1513
1834
 
1514
- export function __wbg_setonended_83dd83b7f84cdef2(arg0, arg1) {
1515
- getObject(arg0).onended = getObject(arg1);
1835
+ export function __wbg_length_e2d2a49132c1b256(arg0) {
1836
+ const ret = arg0.length;
1837
+ return ret;
1516
1838
  };
1517
1839
 
1518
- export function __wbg_start_99ecc2647eb67ca6() { return handleError(function (arg0, arg1) {
1519
- getObject(arg0).start(arg1);
1520
- }, arguments) };
1840
+ export function __wbg_maxChannelCount_a06f8ca4190698ed(arg0) {
1841
+ const ret = arg0.maxChannelCount;
1842
+ return ret;
1843
+ };
1521
1844
 
1522
- export function __wbg_connect_3f8f5ba805800c62() { return handleError(function (arg0, arg1) {
1523
- const ret = getObject(arg0).connect(getObject(arg1));
1524
- return addHeapObject(ret);
1525
- }, arguments) };
1845
+ export function __wbg_name_16617c8e9d4188ac(arg0) {
1846
+ const ret = arg0.name;
1847
+ return ret;
1848
+ };
1526
1849
 
1527
- export function __wbg_get_f01601b5a68d10e3(arg0, arg1) {
1528
- const ret = getObject(arg0)[arg1 >>> 0];
1529
- return addHeapObject(ret);
1850
+ export function __wbg_new_23a2665fac83c611(arg0, arg1) {
1851
+ try {
1852
+ var state0 = {a: arg0, b: arg1};
1853
+ var cb0 = (arg0, arg1) => {
1854
+ const a = state0.a;
1855
+ state0.a = 0;
1856
+ try {
1857
+ return __wbg_adapter_186(a, state0.b, arg0, arg1);
1858
+ } finally {
1859
+ state0.a = a;
1860
+ }
1861
+ };
1862
+ const ret = new Promise(cb0);
1863
+ return ret;
1864
+ } finally {
1865
+ state0.a = state0.b = 0;
1866
+ }
1530
1867
  };
1531
1868
 
1532
- export function __wbg_length_1009b1af0c481d7b(arg0) {
1533
- const ret = getObject(arg0).length;
1869
+ export function __wbg_new_405e22f390576ce2() {
1870
+ const ret = new Object();
1534
1871
  return ret;
1535
1872
  };
1536
1873
 
1537
- export function __wbg_new_ffc6d4d085022169() {
1874
+ export function __wbg_new_78feb108b6472713() {
1538
1875
  const ret = new Array();
1539
- return addHeapObject(ret);
1876
+ return ret;
1540
1877
  };
1541
1878
 
1542
- export function __wbg_newnoargs_c62ea9419c21fbac(arg0, arg1) {
1879
+ export function __wbg_newnoargs_105ed471475aaf50(arg0, arg1) {
1543
1880
  const ret = new Function(getStringFromWasm0(arg0, arg1));
1544
- return addHeapObject(ret);
1881
+ return ret;
1545
1882
  };
1546
1883
 
1547
- export function __wbg_get_7b48513de5dc5ea4() { return handleError(function (arg0, arg1) {
1548
- const ret = Reflect.get(getObject(arg0), getObject(arg1));
1549
- return addHeapObject(ret);
1884
+ export function __wbg_newwithcontextoptions_b62c06fed7900366() { return handleError(function (arg0) {
1885
+ const ret = new lAudioContext(arg0);
1886
+ return ret;
1550
1887
  }, arguments) };
1551
1888
 
1552
- export function __wbg_call_90c26b09837aba1c() { return handleError(function (arg0, arg1) {
1553
- const ret = getObject(arg0).call(getObject(arg1));
1554
- return addHeapObject(ret);
1555
- }, arguments) };
1889
+ export function __wbg_push_737cfc8c1432c2c6(arg0, arg1) {
1890
+ const ret = arg0.push(arg1);
1891
+ return ret;
1892
+ };
1556
1893
 
1557
- export function __wbg_new_9fb8d994e1c0aaac() {
1558
- const ret = new Object();
1559
- return addHeapObject(ret);
1894
+ export function __wbg_queueMicrotask_97d92b4fcc8a61c5(arg0) {
1895
+ queueMicrotask(arg0);
1560
1896
  };
1561
1897
 
1562
- export function __wbindgen_object_clone_ref(arg0) {
1563
- const ret = getObject(arg0);
1564
- return addHeapObject(ret);
1898
+ export function __wbg_queueMicrotask_d3219def82552485(arg0) {
1899
+ const ret = arg0.queueMicrotask;
1900
+ return ret;
1565
1901
  };
1566
1902
 
1567
- export function __wbg_self_f0e34d89f33b99fd() { return handleError(function () {
1568
- const ret = self.self;
1569
- return addHeapObject(ret);
1570
- }, arguments) };
1903
+ export function __wbg_resolve_4851785c9c5f573d(arg0) {
1904
+ const ret = Promise.resolve(arg0);
1905
+ return ret;
1906
+ };
1571
1907
 
1572
- export function __wbg_window_d3b084224f4774d7() { return handleError(function () {
1573
- const ret = window.window;
1574
- return addHeapObject(ret);
1908
+ export function __wbg_resume_35efdc4ffe13bf18() { return handleError(function (arg0) {
1909
+ const ret = arg0.resume();
1910
+ return ret;
1575
1911
  }, arguments) };
1576
1912
 
1577
- export function __wbg_globalThis_9caa27ff917c6860() { return handleError(function () {
1578
- const ret = globalThis.globalThis;
1579
- return addHeapObject(ret);
1913
+ export function __wbg_setTimeout_db2dbaeefb6f39c7() { return handleError(function (arg0, arg1) {
1914
+ const ret = setTimeout(arg0, arg1);
1915
+ return ret;
1580
1916
  }, arguments) };
1581
1917
 
1582
- export function __wbg_global_35dfdd59a4da3e74() { return handleError(function () {
1583
- const ret = global.global;
1584
- return addHeapObject(ret);
1918
+ export function __wbg_setTimeout_f2fe5af8e3debeb3() { return handleError(function (arg0, arg1, arg2) {
1919
+ const ret = arg0.setTimeout(arg1, arg2);
1920
+ return ret;
1585
1921
  }, arguments) };
1586
1922
 
1587
- export function __wbindgen_is_undefined(arg0) {
1588
- const ret = getObject(arg0) === undefined;
1589
- return ret;
1923
+ export function __wbg_setbuffer_10a9ee2a05c73896(arg0, arg1) {
1924
+ arg0.buffer = arg1;
1590
1925
  };
1591
1926
 
1592
- export function __wbg_eval_0b93354704a20351() { return handleError(function (arg0, arg1) {
1593
- const ret = eval(getStringFromWasm0(arg0, arg1));
1594
- return addHeapObject(ret);
1595
- }, arguments) };
1927
+ export function __wbg_setchannelCount_876fcf5798895180(arg0, arg1) {
1928
+ arg0.channelCount = arg1 >>> 0;
1929
+ };
1596
1930
 
1597
- export function __wbg_push_901f3914205d44de(arg0, arg1) {
1598
- const ret = getObject(arg0).push(getObject(arg1));
1599
- return ret;
1931
+ export function __wbg_setonended_00ff85c70a4f819f(arg0, arg1) {
1932
+ arg0.onended = arg1;
1933
+ };
1934
+
1935
+ export function __wbg_setsamplerate_8bc3fd769a6db02b(arg0, arg1) {
1936
+ arg0.sampleRate = arg1;
1600
1937
  };
1601
1938
 
1602
- export function __wbg_call_5da1969d7cd31ccd() { return handleError(function (arg0, arg1, arg2) {
1603
- const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
1604
- return addHeapObject(ret);
1939
+ export function __wbg_start_e81f89e130c3c86e() { return handleError(function (arg0, arg1) {
1940
+ arg0.start(arg1);
1605
1941
  }, arguments) };
1606
1942
 
1607
- export function __wbg_name_0b0c238354bb6019(arg0) {
1608
- const ret = getObject(arg0).name;
1609
- return addHeapObject(ret);
1943
+ export function __wbg_static_accessor_GLOBAL_88a902d13a557d07() {
1944
+ const ret = typeof global === 'undefined' ? null : global;
1945
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1610
1946
  };
1611
1947
 
1612
- export function __wbg_instanceof_Object_702c4990f4c3db8d(arg0) {
1613
- let result;
1614
- try {
1615
- result = getObject(arg0) instanceof Object;
1616
- } catch (_) {
1617
- result = false;
1618
- }
1619
- const ret = result;
1948
+ export function __wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0() {
1949
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
1950
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1951
+ };
1952
+
1953
+ export function __wbg_static_accessor_SELF_37c5d418e4bf5819() {
1954
+ const ret = typeof self === 'undefined' ? null : self;
1955
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1956
+ };
1957
+
1958
+ export function __wbg_static_accessor_WINDOW_5de37043a91a9c40() {
1959
+ const ret = typeof window === 'undefined' ? null : window;
1960
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1961
+ };
1962
+
1963
+ export function __wbg_then_44b73946d2fb3e7d(arg0, arg1) {
1964
+ const ret = arg0.then(arg1);
1620
1965
  return ret;
1621
1966
  };
1622
1967
 
1623
- export function __wbg_constructor_2cc2b72dddc41594(arg0) {
1624
- const ret = getObject(arg0).constructor;
1625
- return addHeapObject(ret);
1968
+ export function __wbindgen_boolean_get(arg0) {
1969
+ const v = arg0;
1970
+ const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
1971
+ return ret;
1626
1972
  };
1627
1973
 
1628
- export function __wbg_new_60f57089c7563e81(arg0, arg1) {
1629
- try {
1630
- var state0 = {a: arg0, b: arg1};
1631
- var cb0 = (arg0, arg1) => {
1632
- const a = state0.a;
1633
- state0.a = 0;
1634
- try {
1635
- return __wbg_adapter_152(a, state0.b, arg0, arg1);
1636
- } finally {
1637
- state0.a = a;
1638
- }
1639
- };
1640
- const ret = new Promise(cb0);
1641
- return addHeapObject(ret);
1642
- } finally {
1643
- state0.a = state0.b = 0;
1974
+ export function __wbindgen_cb_drop(arg0) {
1975
+ const obj = arg0.original;
1976
+ if (obj.cnt-- == 1) {
1977
+ obj.a = 0;
1978
+ return true;
1644
1979
  }
1980
+ const ret = false;
1981
+ return ret;
1645
1982
  };
1646
1983
 
1647
- export function __wbg_resolve_6e1c6553a82f85b7(arg0) {
1648
- const ret = Promise.resolve(getObject(arg0));
1649
- return addHeapObject(ret);
1984
+ export function __wbindgen_closure_wrapper2001(arg0, arg1, arg2) {
1985
+ const ret = makeMutClosure(arg0, arg1, 543, __wbg_adapter_28);
1986
+ return ret;
1650
1987
  };
1651
1988
 
1652
- export function __wbg_then_3ab08cd4fbb91ae9(arg0, arg1) {
1653
- const ret = getObject(arg0).then(getObject(arg1));
1654
- return addHeapObject(ret);
1989
+ export function __wbindgen_closure_wrapper2493(arg0, arg1, arg2) {
1990
+ const ret = makeMutClosure(arg0, arg1, 657, __wbg_adapter_31);
1991
+ return ret;
1655
1992
  };
1656
1993
 
1657
- export function __wbg_set_759f75cd92b612d2() { return handleError(function (arg0, arg1, arg2) {
1658
- const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
1994
+ export function __wbindgen_closure_wrapper2665(arg0, arg1, arg2) {
1995
+ const ret = makeMutClosure(arg0, arg1, 727, __wbg_adapter_34);
1659
1996
  return ret;
1660
- }, arguments) };
1997
+ };
1661
1998
 
1662
1999
  export function __wbindgen_debug_string(arg0, arg1) {
1663
- const ret = debugString(getObject(arg1));
2000
+ const ret = debugString(arg1);
1664
2001
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1665
2002
  const len1 = WASM_VECTOR_LEN;
1666
- getInt32Memory0()[arg0 / 4 + 1] = len1;
1667
- getInt32Memory0()[arg0 / 4 + 0] = ptr1;
2003
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
2004
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1668
2005
  };
1669
2006
 
1670
- export function __wbindgen_throw(arg0, arg1) {
1671
- throw new Error(getStringFromWasm0(arg0, arg1));
2007
+ export function __wbindgen_init_externref_table() {
2008
+ const table = wasm.__wbindgen_export_2;
2009
+ const offset = table.grow(4);
2010
+ table.set(0, undefined);
2011
+ table.set(offset + 0, undefined);
2012
+ table.set(offset + 1, null);
2013
+ table.set(offset + 2, true);
2014
+ table.set(offset + 3, false);
2015
+ ;
2016
+ };
2017
+
2018
+ export function __wbindgen_is_falsy(arg0) {
2019
+ const ret = !arg0;
2020
+ return ret;
2021
+ };
2022
+
2023
+ export function __wbindgen_is_function(arg0) {
2024
+ const ret = typeof(arg0) === 'function';
2025
+ return ret;
2026
+ };
2027
+
2028
+ export function __wbindgen_is_undefined(arg0) {
2029
+ const ret = arg0 === undefined;
2030
+ return ret;
2031
+ };
2032
+
2033
+ export function __wbindgen_number_get(arg0, arg1) {
2034
+ const obj = arg1;
2035
+ const ret = typeof(obj) === 'number' ? obj : undefined;
2036
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
2037
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1672
2038
  };
1673
2039
 
1674
- export function __wbindgen_closure_wrapper1156(arg0, arg1, arg2) {
1675
- const ret = makeMutClosure(arg0, arg1, 495, __wbg_adapter_24);
1676
- return addHeapObject(ret);
2040
+ export function __wbindgen_string_get(arg0, arg1) {
2041
+ const obj = arg1;
2042
+ const ret = typeof(obj) === 'string' ? obj : undefined;
2043
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2044
+ var len1 = WASM_VECTOR_LEN;
2045
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
2046
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1677
2047
  };
1678
2048
 
1679
- export function __wbindgen_closure_wrapper1182(arg0, arg1, arg2) {
1680
- const ret = makeMutClosure(arg0, arg1, 508, __wbg_adapter_27);
1681
- return addHeapObject(ret);
2049
+ export function __wbindgen_string_new(arg0, arg1) {
2050
+ const ret = getStringFromWasm0(arg0, arg1);
2051
+ return ret;
1682
2052
  };
1683
2053
 
1684
- export function __wbindgen_closure_wrapper1356(arg0, arg1, arg2) {
1685
- const ret = makeMutClosure(arg0, arg1, 554, __wbg_adapter_30);
1686
- return addHeapObject(ret);
2054
+ export function __wbindgen_throw(arg0, arg1) {
2055
+ throw new Error(getStringFromWasm0(arg0, arg1));
1687
2056
  };
1688
2057