kordweb 0.6.0 → 0.7.0

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
@@ -1,5 +1,1688 @@
1
+ const lAudioContext = (typeof AudioContext !== 'undefined' ? AudioContext : (typeof webkitAudioContext !== 'undefined' ? webkitAudioContext : undefined));
1
2
  let wasm;
2
3
  export function __wbg_set_wasm(val) {
3
4
  wasm = val;
4
5
  }
5
6
 
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;
26
+ }
27
+
28
+ function isLikeNone(x) {
29
+ return x === undefined || x === null;
30
+ }
31
+
32
+ let cachedFloat64Memory0 = null;
33
+
34
+ function getFloat64Memory0() {
35
+ if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
36
+ cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
37
+ }
38
+ return cachedFloat64Memory0;
39
+ }
40
+
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;
48
+ }
49
+
50
+ const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder;
51
+
52
+ let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true });
53
+
54
+ cachedTextDecoder.decode();
55
+
56
+ let cachedUint8Memory0 = null;
57
+
58
+ function getUint8Memory0() {
59
+ if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
60
+ cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
61
+ }
62
+ return cachedUint8Memory0;
63
+ }
64
+
65
+ function getStringFromWasm0(ptr, len) {
66
+ ptr = ptr >>> 0;
67
+ return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
68
+ }
69
+
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;
77
+ }
78
+
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
+ };
96
+ });
97
+
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);
124
+ }
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;
134
+ }
135
+
136
+ function debugString(val) {
137
+ // primitive types
138
+ const type = typeof val;
139
+ if (type == 'number' || type == 'boolean' || val == null) {
140
+ return `${val}`;
141
+ }
142
+ if (type == 'string') {
143
+ return `"${val}"`;
144
+ }
145
+ if (type == 'symbol') {
146
+ const description = val.description;
147
+ if (description == null) {
148
+ return 'Symbol';
149
+ } else {
150
+ return `Symbol(${description})`;
151
+ }
152
+ }
153
+ if (type == 'function') {
154
+ const name = val.name;
155
+ if (typeof name == 'string' && name.length > 0) {
156
+ return `Function(${name})`;
157
+ } else {
158
+ return 'Function';
159
+ }
160
+ }
161
+ // objects
162
+ if (Array.isArray(val)) {
163
+ const length = val.length;
164
+ let debug = '[';
165
+ if (length > 0) {
166
+ debug += debugString(val[0]);
167
+ }
168
+ for(let i = 1; i < length; i++) {
169
+ debug += ', ' + debugString(val[i]);
170
+ }
171
+ debug += ']';
172
+ return debug;
173
+ }
174
+ // Test for built-in
175
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
176
+ let className;
177
+ if (builtInMatches.length > 1) {
178
+ className = builtInMatches[1];
179
+ } else {
180
+ // Failed to match the standard '[object ClassName]'
181
+ return toString.call(val);
182
+ }
183
+ if (className == 'Object') {
184
+ // we're a user defined class or Object
185
+ // JSON.stringify avoids problems with cycles, and is generally much
186
+ // easier than looping through ownProperties of `val`.
187
+ try {
188
+ return 'Object(' + JSON.stringify(val) + ')';
189
+ } catch (_) {
190
+ return 'Object';
191
+ }
192
+ }
193
+ // errors
194
+ if (val instanceof Error) {
195
+ return `${val.name}: ${val.message}\n${val.stack}`;
196
+ }
197
+ // TODO we could test for more things here, like `Set`s and `Map`s.
198
+ return className;
199
+ }
200
+
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);
215
+
216
+ } else {
217
+ state.a = a;
218
+ }
219
+ }
220
+ };
221
+ real.original = state;
222
+
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
+ }
228
+
229
+ function __wbg_adapter_27(arg0, arg1) {
230
+ wasm.wasm_bindgen__convert__closures__invoke0_mut__h9a3cc0c6ffc8f26a(arg0, arg1);
231
+ }
232
+
233
+ function __wbg_adapter_30(arg0, arg1) {
234
+ wasm.wasm_bindgen__convert__closures__invoke0_mut__hddbc9bcc7c6455be(arg0, arg1);
235
+ }
236
+
237
+ let cachedFloat32Memory0 = null;
238
+
239
+ function getFloat32Memory0() {
240
+ if (cachedFloat32Memory0 === null || cachedFloat32Memory0.byteLength === 0) {
241
+ cachedFloat32Memory0 = new Float32Array(wasm.memory.buffer);
242
+ }
243
+ return cachedFloat32Memory0;
244
+ }
245
+
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;
251
+ }
252
+
253
+ function _assertClass(instance, klass) {
254
+ if (!(instance instanceof klass)) {
255
+ throw new Error(`expected instance of ${klass.name}`);
256
+ }
257
+ return instance.ptr;
258
+ }
259
+
260
+ function handleError(f, args) {
261
+ try {
262
+ return f.apply(this, args);
263
+ } catch (e) {
264
+ wasm.__wbindgen_exn_store(addHeapObject(e));
265
+ }
266
+ }
267
+
268
+ function getArrayF32FromWasm0(ptr, len) {
269
+ ptr = ptr >>> 0;
270
+ return getFloat32Memory0().subarray(ptr / 4, ptr / 4 + len);
271
+ }
272
+ function __wbg_adapter_152(arg0, arg1, arg2, arg3) {
273
+ wasm.wasm_bindgen__convert__closures__invoke2_mut__h1c849f10298b6e57(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
274
+ }
275
+
276
+ /**
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
+ */
335
+ export const KordExtension = Object.freeze({
336
+ /**
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
+ */
383
+ export const KordInterval = Object.freeze({
384
+ /**
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", });
576
+ /**
577
+ * The [`Chord`] wrapper.
578
+ */
579
+ export class KordChord {
580
+
581
+ static __wrap(ptr) {
582
+ ptr = ptr >>> 0;
583
+ const obj = Object.create(KordChord.prototype);
584
+ obj.__wbg_ptr = ptr;
585
+
586
+ return obj;
587
+ }
588
+
589
+ __destroy_into_raw() {
590
+ const ptr = this.__wbg_ptr;
591
+ this.__wbg_ptr = 0;
592
+
593
+ return ptr;
594
+ }
595
+
596
+ free() {
597
+ const ptr = this.__destroy_into_raw();
598
+ wasm.__wbg_kordchord_free(ptr);
599
+ }
600
+ /**
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);
620
+ }
621
+ }
622
+ /**
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) {
631
+ 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);
643
+ } finally {
644
+ wasm.__wbindgen_add_to_stack_pointer(16);
645
+ }
646
+ }
647
+ /**
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);
665
+ }
666
+ }
667
+ /**
668
+ * Returns the [`Chord`]'s friendly name.
669
+ * @returns {string}
670
+ */
671
+ name() {
672
+ let deferred1_0;
673
+ let deferred1_1;
674
+ 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);
682
+ } finally {
683
+ wasm.__wbindgen_add_to_stack_pointer(16);
684
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
685
+ }
686
+ }
687
+ /**
688
+ * Returns the [`Chord`]'s precise name.
689
+ * @returns {string}
690
+ */
691
+ preciseName() {
692
+ let deferred1_0;
693
+ let deferred1_1;
694
+ 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);
702
+ } finally {
703
+ wasm.__wbindgen_add_to_stack_pointer(16);
704
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
705
+ }
706
+ }
707
+ /**
708
+ * Returns the [`Chord`] as a string (same as `precise_name`).
709
+ * @returns {string}
710
+ */
711
+ toString() {
712
+ let deferred1_0;
713
+ let deferred1_1;
714
+ 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);
722
+ } finally {
723
+ wasm.__wbindgen_add_to_stack_pointer(16);
724
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
725
+ }
726
+ }
727
+ /**
728
+ * Returns the [`Chord`]'s description.
729
+ * @returns {string}
730
+ */
731
+ description() {
732
+ let deferred1_0;
733
+ let deferred1_1;
734
+ 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);
742
+ } finally {
743
+ wasm.__wbindgen_add_to_stack_pointer(16);
744
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
745
+ }
746
+ }
747
+ /**
748
+ * Returns the [`Chord`]'s display text.
749
+ * @returns {string}
750
+ */
751
+ display() {
752
+ let deferred1_0;
753
+ let deferred1_1;
754
+ 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);
762
+ } finally {
763
+ wasm.__wbindgen_add_to_stack_pointer(16);
764
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
765
+ }
766
+ }
767
+ /**
768
+ * Returns the [`Chord`]'s root note.
769
+ * @returns {string}
770
+ */
771
+ root() {
772
+ let deferred1_0;
773
+ let deferred1_1;
774
+ 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);
782
+ } finally {
783
+ wasm.__wbindgen_add_to_stack_pointer(16);
784
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
785
+ }
786
+ }
787
+ /**
788
+ * Returns the [`Chord`]'s slash note.
789
+ * @returns {string}
790
+ */
791
+ slash() {
792
+ let deferred1_0;
793
+ let deferred1_1;
794
+ 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);
802
+ } finally {
803
+ wasm.__wbindgen_add_to_stack_pointer(16);
804
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
805
+ }
806
+ }
807
+ /**
808
+ * Returns the [`Chord`]'s inversion.
809
+ * @returns {number}
810
+ */
811
+ inversion() {
812
+ const ret = wasm.kordchord_inversion(this.__wbg_ptr);
813
+ return ret;
814
+ }
815
+ /**
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);
830
+ }
831
+ /**
832
+ * Returns the [`Chord`]'s chord tones as a string.
833
+ * @returns {string}
834
+ */
835
+ chordString() {
836
+ let deferred1_0;
837
+ let deferred1_1;
838
+ 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);
846
+ } finally {
847
+ wasm.__wbindgen_add_to_stack_pointer(16);
848
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
849
+ }
850
+ }
851
+ /**
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);
858
+ }
859
+ /**
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
+ }
878
+ }
879
+ /**
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);
886
+ }
887
+ /**
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);
894
+ }
895
+ /**
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);
902
+ return KordChord.__wrap(ret);
903
+ }
904
+ /**
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);
912
+ return KordChord.__wrap(ret);
913
+ }
914
+ /**
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
+ }
933
+ }
934
+ /**
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);
941
+ return KordChord.__wrap(ret);
942
+ }
943
+ /**
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);
953
+ }
954
+ /**
955
+ * Returns the clone of the [`Chord`].
956
+ * @returns {KordChord}
957
+ */
958
+ copy() {
959
+ const ret = wasm.kordchord_copy(this.__wbg_ptr);
960
+ return KordChord.__wrap(ret);
961
+ }
962
+ /**
963
+ * Returns a new [`Chord`] with the `minor` modifier.
964
+ * @returns {KordChord}
965
+ */
966
+ minor() {
967
+ const ret = wasm.kordchord_minor(this.__wbg_ptr);
968
+ return KordChord.__wrap(ret);
969
+ }
970
+ /**
971
+ * Returns a new [`Chord`] with the `flat5` modifier.
972
+ * @returns {KordChord}
973
+ */
974
+ flat5() {
975
+ const ret = wasm.kordchord_flat5(this.__wbg_ptr);
976
+ return KordChord.__wrap(ret);
977
+ }
978
+ /**
979
+ * Returns a new [`Chord`] with the `augmented` modifier.
980
+ * @returns {KordChord}
981
+ */
982
+ aug() {
983
+ const ret = wasm.kordchord_aug(this.__wbg_ptr);
984
+ return KordChord.__wrap(ret);
985
+ }
986
+ /**
987
+ * Returns a new [`Chord`] with the `maj7` modifier.
988
+ * @returns {KordChord}
989
+ */
990
+ maj7() {
991
+ const ret = wasm.kordchord_maj7(this.__wbg_ptr);
992
+ return KordChord.__wrap(ret);
993
+ }
994
+ /**
995
+ * Returns a new [`Chord`] with the `dom7` modifier.
996
+ * @returns {KordChord}
997
+ */
998
+ seven() {
999
+ const ret = wasm.kordchord_seven(this.__wbg_ptr);
1000
+ return KordChord.__wrap(ret);
1001
+ }
1002
+ /**
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
+ */
1014
+ eleven() {
1015
+ const ret = wasm.kordchord_eleven(this.__wbg_ptr);
1016
+ return KordChord.__wrap(ret);
1017
+ }
1018
+ /**
1019
+ * Returns a new [`Chord`] with the `dom13` modifier.
1020
+ * @returns {KordChord}
1021
+ */
1022
+ thirteen() {
1023
+ const ret = wasm.kordchord_thirteen(this.__wbg_ptr);
1024
+ return KordChord.__wrap(ret);
1025
+ }
1026
+ /**
1027
+ * Returns a new [`Chord`] with the `flat9` modifier.
1028
+ * @returns {KordChord}
1029
+ */
1030
+ flat9() {
1031
+ const ret = wasm.kordchord_flat9(this.__wbg_ptr);
1032
+ return KordChord.__wrap(ret);
1033
+ }
1034
+ /**
1035
+ * Returns a new [`Chord`] with the `sharp9` modifier.
1036
+ * @returns {KordChord}
1037
+ */
1038
+ sharp9() {
1039
+ const ret = wasm.kordchord_sharp9(this.__wbg_ptr);
1040
+ return KordChord.__wrap(ret);
1041
+ }
1042
+ /**
1043
+ * Returns a new [`Chord`] with the `sharp11` modifier.
1044
+ * @returns {KordChord}
1045
+ */
1046
+ sharp11() {
1047
+ const ret = wasm.kordchord_sharp11(this.__wbg_ptr);
1048
+ return KordChord.__wrap(ret);
1049
+ }
1050
+ /**
1051
+ * Returns a new [`Chord`] with the `dim` modifier.
1052
+ * @returns {KordChord}
1053
+ */
1054
+ dim() {
1055
+ const ret = wasm.kordchord_dim(this.__wbg_ptr);
1056
+ return KordChord.__wrap(ret);
1057
+ }
1058
+ /**
1059
+ * Returns a new [`Chord`] with the `halfDim` modifier.
1060
+ * @returns {KordChord}
1061
+ */
1062
+ halfDim() {
1063
+ const ret = wasm.kordchord_halfDim(this.__wbg_ptr);
1064
+ return KordChord.__wrap(ret);
1065
+ }
1066
+ /**
1067
+ * Returns a new [`Chord`] with the `sus2` extension.
1068
+ * @returns {KordChord}
1069
+ */
1070
+ sus2() {
1071
+ const ret = wasm.kordchord_sus2(this.__wbg_ptr);
1072
+ return KordChord.__wrap(ret);
1073
+ }
1074
+ /**
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);
1081
+ }
1082
+ /**
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);
1089
+ }
1090
+ /**
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);
1097
+ }
1098
+ /**
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);
1105
+ }
1106
+ /**
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);
1113
+ }
1114
+ /**
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);
1121
+ }
1122
+ /**
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);
1129
+ }
1130
+ /**
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);
1137
+ }
1138
+ /**
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);
1145
+ }
1146
+ /**
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);
1153
+ }
1154
+ }
1155
+ /**
1156
+ * The [`Note`] wrapper.
1157
+ */
1158
+ export class KordNote {
1159
+
1160
+ static __wrap(ptr) {
1161
+ ptr = ptr >>> 0;
1162
+ const obj = Object.create(KordNote.prototype);
1163
+ obj.__wbg_ptr = ptr;
1164
+
1165
+ return obj;
1166
+ }
1167
+
1168
+ __destroy_into_raw() {
1169
+ const ptr = this.__wbg_ptr;
1170
+ this.__wbg_ptr = 0;
1171
+
1172
+ return ptr;
1173
+ }
1174
+
1175
+ free() {
1176
+ 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
+ }
1246
+ }
1247
+ /**
1248
+ * Returns the [`Note`]'s friendly name.
1249
+ * @returns {string}
1250
+ */
1251
+ name() {
1252
+ let deferred1_0;
1253
+ let deferred1_1;
1254
+ 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);
1262
+ } finally {
1263
+ wasm.__wbindgen_add_to_stack_pointer(16);
1264
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1265
+ }
1266
+ }
1267
+ /**
1268
+ * Returns the [`Note`] represented as a string (same as `name`).
1269
+ * @returns {string}
1270
+ */
1271
+ toString() {
1272
+ let deferred1_0;
1273
+ let deferred1_1;
1274
+ 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);
1282
+ } finally {
1283
+ wasm.__wbindgen_add_to_stack_pointer(16);
1284
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1285
+ }
1286
+ }
1287
+ /**
1288
+ * Returns the [`Note`]'s [`NamedPitch`].
1289
+ * @returns {string}
1290
+ */
1291
+ pitch() {
1292
+ let deferred1_0;
1293
+ let deferred1_1;
1294
+ 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);
1302
+ } finally {
1303
+ wasm.__wbindgen_add_to_stack_pointer(16);
1304
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1305
+ }
1306
+ }
1307
+ /**
1308
+ * Returns the [`Note`]'s [`Octave`].
1309
+ * @returns {number}
1310
+ */
1311
+ octave() {
1312
+ const ret = wasm.kordnote_octave(this.__wbg_ptr);
1313
+ return ret;
1314
+ }
1315
+ /**
1316
+ * Returns the [`Note`]'s frequency.
1317
+ * @returns {number}
1318
+ */
1319
+ frequency() {
1320
+ const ret = wasm.kordnote_frequency(this.__wbg_ptr);
1321
+ return ret;
1322
+ }
1323
+ /**
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;
1351
+ }
1352
+ /**
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);
1359
+ }
1360
+ /**
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);
1367
+ }
1368
+ }
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
+
1380
+ return ptr;
1381
+ }
1382
+
1383
+ free() {
1384
+ const ptr = this.__destroy_into_raw();
1385
+ wasm.__wbg_kordplaybackhandle_free(ptr);
1386
+ }
1387
+ }
1388
+
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;
1396
+ return ret;
1397
+ };
1398
+
1399
+ export function __wbindgen_object_drop_ref(arg0) {
1400
+ takeObject(arg0);
1401
+ };
1402
+
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
+ };
1409
+
1410
+ export function __wbindgen_string_new(arg0, arg1) {
1411
+ const ret = getStringFromWasm0(arg0, arg1);
1412
+ return addHeapObject(ret);
1413
+ };
1414
+
1415
+ export function __wbindgen_number_new(arg0) {
1416
+ const ret = arg0;
1417
+ return addHeapObject(ret);
1418
+ };
1419
+
1420
+ export function __wbg_kordnote_new(arg0) {
1421
+ const ret = KordNote.__wrap(arg0);
1422
+ return addHeapObject(ret);
1423
+ };
1424
+
1425
+ export function __wbg_kordchord_new(arg0) {
1426
+ const ret = KordChord.__wrap(arg0);
1427
+ return addHeapObject(ret);
1428
+ };
1429
+
1430
+ export function __wbg_clearTimeout_76877dbc010e786d(arg0) {
1431
+ const ret = clearTimeout(takeObject(arg0));
1432
+ return addHeapObject(ret);
1433
+ };
1434
+
1435
+ export function __wbg_setTimeout_75cb9b6991a4031d() { return handleError(function (arg0, arg1) {
1436
+ const ret = setTimeout(getObject(arg0), arg1);
1437
+ return addHeapObject(ret);
1438
+ }, arguments) };
1439
+
1440
+ export function __wbindgen_boolean_get(arg0) {
1441
+ const v = getObject(arg0);
1442
+ const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
1443
+ return ret;
1444
+ };
1445
+
1446
+ export function __wbg_instanceof_Window_9029196b662bc42a(arg0) {
1447
+ let result;
1448
+ try {
1449
+ result = getObject(arg0) instanceof Window;
1450
+ } catch (_) {
1451
+ result = false;
1452
+ }
1453
+ const ret = result;
1454
+ return ret;
1455
+ };
1456
+
1457
+ export function __wbg_setTimeout_eb1a0d116c26d9f6() { return handleError(function (arg0, arg1, arg2) {
1458
+ const ret = getObject(arg0).setTimeout(getObject(arg1), arg2);
1459
+ return ret;
1460
+ }, arguments) };
1461
+
1462
+ export function __wbg_destination_9e793cf556243084(arg0) {
1463
+ const ret = getObject(arg0).destination;
1464
+ return addHeapObject(ret);
1465
+ };
1466
+
1467
+ export function __wbg_currentTime_c6831b97750b898c(arg0) {
1468
+ const ret = getObject(arg0).currentTime;
1469
+ return ret;
1470
+ };
1471
+
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;
1504
+ };
1505
+
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);
1512
+ };
1513
+
1514
+ export function __wbg_setonended_83dd83b7f84cdef2(arg0, arg1) {
1515
+ getObject(arg0).onended = getObject(arg1);
1516
+ };
1517
+
1518
+ export function __wbg_start_99ecc2647eb67ca6() { return handleError(function (arg0, arg1) {
1519
+ getObject(arg0).start(arg1);
1520
+ }, arguments) };
1521
+
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) };
1526
+
1527
+ export function __wbg_get_f01601b5a68d10e3(arg0, arg1) {
1528
+ const ret = getObject(arg0)[arg1 >>> 0];
1529
+ return addHeapObject(ret);
1530
+ };
1531
+
1532
+ export function __wbg_length_1009b1af0c481d7b(arg0) {
1533
+ const ret = getObject(arg0).length;
1534
+ return ret;
1535
+ };
1536
+
1537
+ export function __wbg_new_ffc6d4d085022169() {
1538
+ const ret = new Array();
1539
+ return addHeapObject(ret);
1540
+ };
1541
+
1542
+ export function __wbg_newnoargs_c62ea9419c21fbac(arg0, arg1) {
1543
+ const ret = new Function(getStringFromWasm0(arg0, arg1));
1544
+ return addHeapObject(ret);
1545
+ };
1546
+
1547
+ export function __wbg_get_7b48513de5dc5ea4() { return handleError(function (arg0, arg1) {
1548
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
1549
+ return addHeapObject(ret);
1550
+ }, arguments) };
1551
+
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) };
1556
+
1557
+ export function __wbg_new_9fb8d994e1c0aaac() {
1558
+ const ret = new Object();
1559
+ return addHeapObject(ret);
1560
+ };
1561
+
1562
+ export function __wbindgen_object_clone_ref(arg0) {
1563
+ const ret = getObject(arg0);
1564
+ return addHeapObject(ret);
1565
+ };
1566
+
1567
+ export function __wbg_self_f0e34d89f33b99fd() { return handleError(function () {
1568
+ const ret = self.self;
1569
+ return addHeapObject(ret);
1570
+ }, arguments) };
1571
+
1572
+ export function __wbg_window_d3b084224f4774d7() { return handleError(function () {
1573
+ const ret = window.window;
1574
+ return addHeapObject(ret);
1575
+ }, arguments) };
1576
+
1577
+ export function __wbg_globalThis_9caa27ff917c6860() { return handleError(function () {
1578
+ const ret = globalThis.globalThis;
1579
+ return addHeapObject(ret);
1580
+ }, arguments) };
1581
+
1582
+ export function __wbg_global_35dfdd59a4da3e74() { return handleError(function () {
1583
+ const ret = global.global;
1584
+ return addHeapObject(ret);
1585
+ }, arguments) };
1586
+
1587
+ export function __wbindgen_is_undefined(arg0) {
1588
+ const ret = getObject(arg0) === undefined;
1589
+ return ret;
1590
+ };
1591
+
1592
+ export function __wbg_eval_0b93354704a20351() { return handleError(function (arg0, arg1) {
1593
+ const ret = eval(getStringFromWasm0(arg0, arg1));
1594
+ return addHeapObject(ret);
1595
+ }, arguments) };
1596
+
1597
+ export function __wbg_push_901f3914205d44de(arg0, arg1) {
1598
+ const ret = getObject(arg0).push(getObject(arg1));
1599
+ return ret;
1600
+ };
1601
+
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);
1605
+ }, arguments) };
1606
+
1607
+ export function __wbg_name_0b0c238354bb6019(arg0) {
1608
+ const ret = getObject(arg0).name;
1609
+ return addHeapObject(ret);
1610
+ };
1611
+
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;
1620
+ return ret;
1621
+ };
1622
+
1623
+ export function __wbg_constructor_2cc2b72dddc41594(arg0) {
1624
+ const ret = getObject(arg0).constructor;
1625
+ return addHeapObject(ret);
1626
+ };
1627
+
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;
1644
+ }
1645
+ };
1646
+
1647
+ export function __wbg_resolve_6e1c6553a82f85b7(arg0) {
1648
+ const ret = Promise.resolve(getObject(arg0));
1649
+ return addHeapObject(ret);
1650
+ };
1651
+
1652
+ export function __wbg_then_3ab08cd4fbb91ae9(arg0, arg1) {
1653
+ const ret = getObject(arg0).then(getObject(arg1));
1654
+ return addHeapObject(ret);
1655
+ };
1656
+
1657
+ export function __wbg_set_759f75cd92b612d2() { return handleError(function (arg0, arg1, arg2) {
1658
+ const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
1659
+ return ret;
1660
+ }, arguments) };
1661
+
1662
+ export function __wbindgen_debug_string(arg0, arg1) {
1663
+ const ret = debugString(getObject(arg1));
1664
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1665
+ const len1 = WASM_VECTOR_LEN;
1666
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
1667
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
1668
+ };
1669
+
1670
+ export function __wbindgen_throw(arg0, arg1) {
1671
+ throw new Error(getStringFromWasm0(arg0, arg1));
1672
+ };
1673
+
1674
+ export function __wbindgen_closure_wrapper1156(arg0, arg1, arg2) {
1675
+ const ret = makeMutClosure(arg0, arg1, 495, __wbg_adapter_24);
1676
+ return addHeapObject(ret);
1677
+ };
1678
+
1679
+ export function __wbindgen_closure_wrapper1182(arg0, arg1, arg2) {
1680
+ const ret = makeMutClosure(arg0, arg1, 508, __wbg_adapter_27);
1681
+ return addHeapObject(ret);
1682
+ };
1683
+
1684
+ export function __wbindgen_closure_wrapper1356(arg0, arg1, arg2) {
1685
+ const ret = makeMutClosure(arg0, arg1, 554, __wbg_adapter_30);
1686
+ return addHeapObject(ret);
1687
+ };
1688
+