kordweb 0.5.4 → 0.5.6

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.js CHANGED
@@ -47,6 +47,83 @@ function addHeapObject(obj) {
47
47
  return idx;
48
48
  }
49
49
 
50
+ function isLikeNone(x) {
51
+ return x === undefined || x === null;
52
+ }
53
+
54
+ let cachedFloat64Memory0 = null;
55
+
56
+ function getFloat64Memory0() {
57
+ if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
58
+ cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
59
+ }
60
+ return cachedFloat64Memory0;
61
+ }
62
+
63
+ let cachedInt32Memory0 = null;
64
+
65
+ function getInt32Memory0() {
66
+ if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
67
+ cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
68
+ }
69
+ return cachedInt32Memory0;
70
+ }
71
+
72
+ let WASM_VECTOR_LEN = 0;
73
+
74
+ const cachedTextEncoder = new TextEncoder('utf-8');
75
+
76
+ const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
77
+ ? function (arg, view) {
78
+ return cachedTextEncoder.encodeInto(arg, view);
79
+ }
80
+ : function (arg, view) {
81
+ const buf = cachedTextEncoder.encode(arg);
82
+ view.set(buf);
83
+ return {
84
+ read: arg.length,
85
+ written: buf.length
86
+ };
87
+ });
88
+
89
+ function passStringToWasm0(arg, malloc, realloc) {
90
+
91
+ if (realloc === undefined) {
92
+ const buf = cachedTextEncoder.encode(arg);
93
+ const ptr = malloc(buf.length);
94
+ getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
95
+ WASM_VECTOR_LEN = buf.length;
96
+ return ptr;
97
+ }
98
+
99
+ let len = arg.length;
100
+ let ptr = malloc(len);
101
+
102
+ const mem = getUint8Memory0();
103
+
104
+ let offset = 0;
105
+
106
+ for (; offset < len; offset++) {
107
+ const code = arg.charCodeAt(offset);
108
+ if (code > 0x7F) break;
109
+ mem[ptr + offset] = code;
110
+ }
111
+
112
+ if (offset !== len) {
113
+ if (offset !== 0) {
114
+ arg = arg.slice(offset);
115
+ }
116
+ ptr = realloc(ptr, len, len = offset + arg.length * 3);
117
+ const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
118
+ const ret = encodeString(arg, view);
119
+
120
+ offset += ret.written;
121
+ }
122
+
123
+ WASM_VECTOR_LEN = offset;
124
+ return ptr;
125
+ }
126
+
50
127
  function debugString(val) {
51
128
  // primitive types
52
129
  const type = typeof val;
@@ -112,70 +189,6 @@ function debugString(val) {
112
189
  return className;
113
190
  }
114
191
 
115
- let WASM_VECTOR_LEN = 0;
116
-
117
- const cachedTextEncoder = new TextEncoder('utf-8');
118
-
119
- const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
120
- ? function (arg, view) {
121
- return cachedTextEncoder.encodeInto(arg, view);
122
- }
123
- : function (arg, view) {
124
- const buf = cachedTextEncoder.encode(arg);
125
- view.set(buf);
126
- return {
127
- read: arg.length,
128
- written: buf.length
129
- };
130
- });
131
-
132
- function passStringToWasm0(arg, malloc, realloc) {
133
-
134
- if (realloc === undefined) {
135
- const buf = cachedTextEncoder.encode(arg);
136
- const ptr = malloc(buf.length);
137
- getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
138
- WASM_VECTOR_LEN = buf.length;
139
- return ptr;
140
- }
141
-
142
- let len = arg.length;
143
- let ptr = malloc(len);
144
-
145
- const mem = getUint8Memory0();
146
-
147
- let offset = 0;
148
-
149
- for (; offset < len; offset++) {
150
- const code = arg.charCodeAt(offset);
151
- if (code > 0x7F) break;
152
- mem[ptr + offset] = code;
153
- }
154
-
155
- if (offset !== len) {
156
- if (offset !== 0) {
157
- arg = arg.slice(offset);
158
- }
159
- ptr = realloc(ptr, len, len = offset + arg.length * 3);
160
- const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
161
- const ret = encodeString(arg, view);
162
-
163
- offset += ret.written;
164
- }
165
-
166
- WASM_VECTOR_LEN = offset;
167
- return ptr;
168
- }
169
-
170
- let cachedInt32Memory0 = null;
171
-
172
- function getInt32Memory0() {
173
- if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
174
- cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
175
- }
176
- return cachedInt32Memory0;
177
- }
178
-
179
192
  const CLOSURE_DTORS = new FinalizationRegistry(state => {
180
193
  wasm.__wbindgen_export_2.get(state.dtor)(state.a, state.b)
181
194
  });
@@ -204,14 +217,21 @@ function makeMutClosure(arg0, arg1, dtor, f) {
204
217
  CLOSURE_DTORS.register(real, state, state);
205
218
  return real;
206
219
  }
207
- function __wbg_adapter_20(arg0, arg1, arg2) {
220
+ function __wbg_adapter_24(arg0, arg1, arg2) {
208
221
  wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h747aa41a80ad2697(arg0, arg1, addHeapObject(arg2));
209
222
  }
210
223
 
211
- function __wbg_adapter_23(arg0, arg1) {
224
+ function __wbg_adapter_27(arg0, arg1) {
212
225
  wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__heeae151cfd26f044(arg0, arg1);
213
226
  }
214
227
 
228
+ /**
229
+ * The main entrypoint which sets up global state.
230
+ */
231
+ export function main() {
232
+ wasm.main();
233
+ }
234
+
215
235
  let cachedFloat32Memory0 = null;
216
236
 
217
237
  function getFloat32Memory0() {
@@ -246,10 +266,311 @@ function handleError(f, args) {
246
266
  function getArrayF32FromWasm0(ptr, len) {
247
267
  return getFloat32Memory0().subarray(ptr / 4, ptr / 4 + len);
248
268
  }
249
- function __wbg_adapter_91(arg0, arg1, arg2, arg3) {
269
+ function __wbg_adapter_125(arg0, arg1, arg2, arg3) {
250
270
  wasm.wasm_bindgen__convert__closures__invoke2_mut__h768f6593dd414d73(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
251
271
  }
252
272
 
273
+ /**
274
+ * An enum representing the interval between two notes.
275
+ */
276
+ export const KordInterval = Object.freeze({
277
+ /**
278
+ * A perfect unison interval.
279
+ */
280
+ PerfectUnison:0,"0":"PerfectUnison",
281
+ /**
282
+ * A diminished second interval.
283
+ */
284
+ DiminishedSecond:1,"1":"DiminishedSecond",
285
+ /**
286
+ * An augmented unison interval.
287
+ */
288
+ AugmentedUnison:2,"2":"AugmentedUnison",
289
+ /**
290
+ * A minor second interval.
291
+ */
292
+ MinorSecond:3,"3":"MinorSecond",
293
+ /**
294
+ * A major second interval.
295
+ */
296
+ MajorSecond:4,"4":"MajorSecond",
297
+ /**
298
+ * A diminished third interval.
299
+ */
300
+ DiminishedThird:5,"5":"DiminishedThird",
301
+ /**
302
+ * An augmented second interval.
303
+ */
304
+ AugmentedSecond:6,"6":"AugmentedSecond",
305
+ /**
306
+ * A minor third interval.
307
+ */
308
+ MinorThird:7,"7":"MinorThird",
309
+ /**
310
+ * A major third interval.
311
+ */
312
+ MajorThird:8,"8":"MajorThird",
313
+ /**
314
+ * A diminished fourth interval.
315
+ */
316
+ DiminishedFourth:9,"9":"DiminishedFourth",
317
+ /**
318
+ * An augmented third interval.
319
+ */
320
+ AugmentedThird:10,"10":"AugmentedThird",
321
+ /**
322
+ * A perfect fourth interval.
323
+ */
324
+ PerfectFourth:11,"11":"PerfectFourth",
325
+ /**
326
+ * An augmented fourth interval.
327
+ */
328
+ AugmentedFourth:12,"12":"AugmentedFourth",
329
+ /**
330
+ * A diminished fifth interval.
331
+ */
332
+ DiminishedFifth:13,"13":"DiminishedFifth",
333
+ /**
334
+ * A perfect fifth interval.
335
+ */
336
+ PerfectFifth:14,"14":"PerfectFifth",
337
+ /**
338
+ * A diminished sixth interval.
339
+ */
340
+ DiminishedSixth:15,"15":"DiminishedSixth",
341
+ /**
342
+ * An augmented fifth interval.
343
+ */
344
+ AugmentedFifth:16,"16":"AugmentedFifth",
345
+ /**
346
+ * A minor sixth interval.
347
+ */
348
+ MinorSixth:17,"17":"MinorSixth",
349
+ /**
350
+ * A major sixth interval.
351
+ */
352
+ MajorSixth:18,"18":"MajorSixth",
353
+ /**
354
+ * A diminished seventh interval.
355
+ */
356
+ DiminishedSeventh:19,"19":"DiminishedSeventh",
357
+ /**
358
+ * An augmented sixth interval.
359
+ */
360
+ AugmentedSixth:20,"20":"AugmentedSixth",
361
+ /**
362
+ * A minor seventh interval.
363
+ */
364
+ MinorSeventh:21,"21":"MinorSeventh",
365
+ /**
366
+ * A major seventh interval.
367
+ */
368
+ MajorSeventh:22,"22":"MajorSeventh",
369
+ /**
370
+ * A diminished octave interval.
371
+ */
372
+ DiminishedOctave:23,"23":"DiminishedOctave",
373
+ /**
374
+ * An augmented seventh interval.
375
+ */
376
+ AugmentedSeventh:24,"24":"AugmentedSeventh",
377
+ /**
378
+ * A perfect octave interval.
379
+ */
380
+ PerfectOctave:25,"25":"PerfectOctave",
381
+ /**
382
+ * An minor ninth interval.
383
+ */
384
+ MinorNinth:26,"26":"MinorNinth",
385
+ /**
386
+ * A major ninth interval.
387
+ */
388
+ MajorNinth:27,"27":"MajorNinth",
389
+ /**
390
+ * An augmented ninth interval.
391
+ */
392
+ AugmentedNinth:28,"28":"AugmentedNinth",
393
+ /**
394
+ * A diminished eleventh interval.
395
+ */
396
+ DiminishedEleventh:29,"29":"DiminishedEleventh",
397
+ /**
398
+ * A perfect eleventh interval.
399
+ */
400
+ PerfectEleventh:30,"30":"PerfectEleventh",
401
+ /**
402
+ * An augmented eleventh interval.
403
+ */
404
+ AugmentedEleventh:31,"31":"AugmentedEleventh",
405
+ /**
406
+ * A minor thirteenth interval.
407
+ */
408
+ MinorThirteenth:32,"32":"MinorThirteenth",
409
+ /**
410
+ * A major thirteenth interval.
411
+ */
412
+ MajorThirteenth:33,"33":"MajorThirteenth",
413
+ /**
414
+ * An augmented thirteenth interval.
415
+ */
416
+ AugmentedThirteenth:34,"34":"AugmentedThirteenth",
417
+ /**
418
+ * A perfect octave and perfect fifth interval.
419
+ */
420
+ PerfectOctaveAndPerfectFifth:35,"35":"PerfectOctaveAndPerfectFifth",
421
+ /**
422
+ * Two perfect octaves.
423
+ */
424
+ TwoPerfectOctaves:36,"36":"TwoPerfectOctaves",
425
+ /**
426
+ * Two perfect octaves and a major third.
427
+ */
428
+ TwoPerfectOctavesAndMajorThird:37,"37":"TwoPerfectOctavesAndMajorThird",
429
+ /**
430
+ * Two perfect octaves and a perfect fifth.
431
+ */
432
+ TwoPerfectOctavesAndPerfectFifth:38,"38":"TwoPerfectOctavesAndPerfectFifth",
433
+ /**
434
+ * Two perfect octaves and a minor sixth.
435
+ */
436
+ TwoPerfectOctavesAndMinorSeventh:39,"39":"TwoPerfectOctavesAndMinorSeventh",
437
+ /**
438
+ * Three perfect octaves.
439
+ */
440
+ ThreePerfectOctaves:40,"40":"ThreePerfectOctaves",
441
+ /**
442
+ * Three perfect octaves and a major second.
443
+ */
444
+ ThreePerfectOctavesAndMajorSecond:41,"41":"ThreePerfectOctavesAndMajorSecond",
445
+ /**
446
+ * Three perfect octaves and a major third.
447
+ */
448
+ ThreePerfectOctavesAndMajorThird:42,"42":"ThreePerfectOctavesAndMajorThird",
449
+ /**
450
+ * Three perfect octaves and an augmented fourth.
451
+ */
452
+ ThreePerfectOctavesAndAugmentedFourth:43,"43":"ThreePerfectOctavesAndAugmentedFourth",
453
+ /**
454
+ * Three perfect octaves and a perfect fifth.
455
+ */
456
+ ThreePerfectOctavesAndPerfectFifth:44,"44":"ThreePerfectOctavesAndPerfectFifth",
457
+ /**
458
+ * Three perfect octaves and a minor sixth.
459
+ */
460
+ ThreePerfectOctavesAndMinorSixth:45,"45":"ThreePerfectOctavesAndMinorSixth",
461
+ /**
462
+ * Three perfect octaves and a minor seventh.
463
+ */
464
+ ThreePerfectOctavesAndMinorSeventh:46,"46":"ThreePerfectOctavesAndMinorSeventh",
465
+ /**
466
+ * Three perfect octaves and a major seventh.
467
+ */
468
+ ThreePerfectOctavesAndMajorSeventh:47,"47":"ThreePerfectOctavesAndMajorSeventh", });
469
+ /**
470
+ * The chord modifiers.
471
+ */
472
+ export const KordModifier = Object.freeze({
473
+ /**
474
+ * Minor modifier.
475
+ */
476
+ Minor:0,"0":"Minor",
477
+ /**
478
+ * Flat 5 modifier.
479
+ */
480
+ Flat5:1,"1":"Flat5",
481
+ /**
482
+ * Sharp 5 modifier.
483
+ */
484
+ Augmented5:2,"2":"Augmented5",
485
+ /**
486
+ * Major 7 modifier.
487
+ */
488
+ Major7:3,"3":"Major7",
489
+ /**
490
+ * Dominant 7 modifier.
491
+ */
492
+ Dominant7:4,"4":"Dominant7",
493
+ /**
494
+ * Dominant 9 modifier.
495
+ */
496
+ Dominant9:5,"5":"Dominant9",
497
+ /**
498
+ * Dominant 11 modifier.
499
+ */
500
+ Dominant11:6,"6":"Dominant11",
501
+ /**
502
+ * Dominant 13 modifier.
503
+ */
504
+ Dominant13:7,"7":"Dominant13",
505
+ /**
506
+ * Flat 9 modifier.
507
+ */
508
+ Flat9:8,"8":"Flat9",
509
+ /**
510
+ * Sharp 9 modifier.
511
+ */
512
+ Sharp9:9,"9":"Sharp9",
513
+ /**
514
+ * Sharp 11 modifier.
515
+ */
516
+ Sharp11:10,"10":"Sharp11",
517
+ /**
518
+ * Diminished modifier.
519
+ */
520
+ Diminished:11,"11":"Diminished", });
521
+ /**
522
+ * An enum representing the extension of a chord.
523
+ *
524
+ * Extensions are not really "special" in the sense that they do not change how the
525
+ * chord is interpreted by the system. E.g., an `add2` just adds a 2 to the chord,
526
+ * and the chord is still interpreted as a major chord.
527
+ */
528
+ export const KordExtension = Object.freeze({
529
+ /**
530
+ * Sus2 extension.
531
+ */
532
+ Sus2:0,"0":"Sus2",
533
+ /**
534
+ * Sus4 extension.
535
+ */
536
+ Sus4:1,"1":"Sus4",
537
+ /**
538
+ * Flat 11 extension.
539
+ */
540
+ Flat11:2,"2":"Flat11",
541
+ /**
542
+ * Flat 13 extension.
543
+ */
544
+ Flat13:3,"3":"Flat13",
545
+ /**
546
+ * Sharp 13 extension.
547
+ */
548
+ Sharp13:4,"4":"Sharp13",
549
+ /**
550
+ * Add2 extension.
551
+ */
552
+ Add2:5,"5":"Add2",
553
+ /**
554
+ * Add4 extension.
555
+ */
556
+ Add4:6,"6":"Add4",
557
+ /**
558
+ * Add6 extension.
559
+ */
560
+ Add6:7,"7":"Add6",
561
+ /**
562
+ * Add9 extension.
563
+ */
564
+ Add9:8,"8":"Add9",
565
+ /**
566
+ * Add11 extension.
567
+ */
568
+ Add11:9,"9":"Add11",
569
+ /**
570
+ * Add13 extension.
571
+ */
572
+ Add13:10,"10":"Add13", });
573
+
253
574
  const KordChordFinalization = new FinalizationRegistry(ptr => wasm.__wbg_kordchord_free(ptr));
254
575
  /**
255
576
  * The [`Chord`] wrapper.
@@ -302,43 +623,41 @@ export class KordChord {
302
623
  * The [`Note`]s should be represented as a space-separated string.
303
624
  * E.g., `C E G`.
304
625
  * @param {string} notes
305
- * @returns {KordChords}
626
+ * @returns {Array<any>}
306
627
  */
307
- static from_notes_string(notes) {
628
+ static fromNotesString(notes) {
308
629
  try {
309
630
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
310
631
  const ptr0 = passStringToWasm0(notes, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
311
632
  const len0 = WASM_VECTOR_LEN;
312
- wasm.kordchord_from_notes_string(retptr, ptr0, len0);
633
+ wasm.kordchord_fromNotesString(retptr, ptr0, len0);
313
634
  var r0 = getInt32Memory0()[retptr / 4 + 0];
314
635
  var r1 = getInt32Memory0()[retptr / 4 + 1];
315
636
  var r2 = getInt32Memory0()[retptr / 4 + 2];
316
637
  if (r2) {
317
638
  throw takeObject(r1);
318
639
  }
319
- return KordChords.__wrap(r0);
640
+ return takeObject(r0);
320
641
  } finally {
321
642
  wasm.__wbindgen_add_to_stack_pointer(16);
322
643
  }
323
644
  }
324
645
  /**
325
646
  * Creates a new [`Chord`] from a set of [`Note`]s.
326
- * @param {KordNotes} notes
327
- * @returns {KordChords}
647
+ * @param {Array<any>} notes
648
+ * @returns {Array<any>}
328
649
  */
329
- static from_notes(notes) {
650
+ static fromNotes(notes) {
330
651
  try {
331
652
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
332
- _assertClass(notes, KordNotes);
333
- var ptr0 = notes.__destroy_into_raw();
334
- wasm.kordchord_from_notes(retptr, ptr0);
653
+ wasm.kordchord_fromNotes(retptr, addHeapObject(notes));
335
654
  var r0 = getInt32Memory0()[retptr / 4 + 0];
336
655
  var r1 = getInt32Memory0()[retptr / 4 + 1];
337
656
  var r2 = getInt32Memory0()[retptr / 4 + 2];
338
657
  if (r2) {
339
658
  throw takeObject(r1);
340
659
  }
341
- return KordChords.__wrap(r0);
660
+ return takeObject(r0);
342
661
  } finally {
343
662
  wasm.__wbindgen_add_to_stack_pointer(16);
344
663
  }
@@ -363,10 +682,26 @@ export class KordChord {
363
682
  * Returns the [`Chord`]'s precise name.
364
683
  * @returns {string}
365
684
  */
366
- precise_name() {
685
+ preciseName() {
367
686
  try {
368
687
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
369
- wasm.kordchord_precise_name(retptr, this.ptr);
688
+ wasm.kordchord_preciseName(retptr, this.ptr);
689
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
690
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
691
+ return getStringFromWasm0(r0, r1);
692
+ } finally {
693
+ wasm.__wbindgen_add_to_stack_pointer(16);
694
+ wasm.__wbindgen_free(r0, r1);
695
+ }
696
+ }
697
+ /**
698
+ * Returns the [`Chord`] as a string (same as `precise_name`).
699
+ * @returns {string}
700
+ */
701
+ toString() {
702
+ try {
703
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
704
+ wasm.kordchord_preciseName(retptr, this.ptr);
370
705
  var r0 = getInt32Memory0()[retptr / 4 + 0];
371
706
  var r1 = getInt32Memory0()[retptr / 4 + 1];
372
707
  return getStringFromWasm0(r0, r1);
@@ -451,26 +786,26 @@ export class KordChord {
451
786
  * Returns whether or not the [`Chord`] is "crunchy".
452
787
  * @returns {boolean}
453
788
  */
454
- is_crunchy() {
455
- const ret = wasm.kordchord_is_crunchy(this.ptr);
789
+ isCrunchy() {
790
+ const ret = wasm.kordchord_isCrunchy(this.ptr);
456
791
  return ret !== 0;
457
792
  }
458
793
  /**
459
794
  * Returns the [`Chord`]'s chord tones.
460
- * @returns {KordNotes}
795
+ * @returns {Array<any>}
461
796
  */
462
797
  chord() {
463
798
  const ret = wasm.kordchord_chord(this.ptr);
464
- return KordNotes.__wrap(ret);
799
+ return takeObject(ret);
465
800
  }
466
801
  /**
467
802
  * Returns the [`Chord`]'s chord tones as a string.
468
803
  * @returns {string}
469
804
  */
470
- chord_string() {
805
+ chordString() {
471
806
  try {
472
807
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
473
- wasm.kordchord_chord_string(retptr, this.ptr);
808
+ wasm.kordchord_chordString(retptr, this.ptr);
474
809
  var r0 = getInt32Memory0()[retptr / 4 + 0];
475
810
  var r1 = getInt32Memory0()[retptr / 4 + 1];
476
811
  return getStringFromWasm0(r0, r1);
@@ -481,20 +816,20 @@ export class KordChord {
481
816
  }
482
817
  /**
483
818
  * Returns the [`Chord`]'s scale tones.
484
- * @returns {KordNotes}
819
+ * @returns {Array<any>}
485
820
  */
486
821
  scale() {
487
822
  const ret = wasm.kordchord_scale(this.ptr);
488
- return KordNotes.__wrap(ret);
823
+ return takeObject(ret);
489
824
  }
490
825
  /**
491
826
  * Returns the [`Chord`]'s scale tones as a string.
492
827
  * @returns {string}
493
828
  */
494
- scale_string() {
829
+ scaleString() {
495
830
  try {
496
831
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
497
- wasm.kordchord_scale_string(retptr, this.ptr);
832
+ wasm.kordchord_scaleString(retptr, this.ptr);
498
833
  var r0 = getInt32Memory0()[retptr / 4 + 0];
499
834
  var r1 = getInt32Memory0()[retptr / 4 + 1];
500
835
  return getStringFromWasm0(r0, r1);
@@ -504,75 +839,88 @@ export class KordChord {
504
839
  }
505
840
  }
506
841
  /**
507
- * Plays the [`Chord`].
508
- * @param {number} delay
509
- * @param {number} length
510
- * @param {number} fade_in
511
- * @returns {Promise<void>}
842
+ * Returns the [`Chord`]'s modifiers.
843
+ * @returns {Array<any>}
512
844
  */
513
- play(delay, length, fade_in) {
514
- const ret = wasm.kordchord_play(this.ptr, delay, length, fade_in);
845
+ modifiers() {
846
+ const ret = wasm.kordchord_modifiers(this.ptr);
515
847
  return takeObject(ret);
516
848
  }
517
- }
518
-
519
- const KordChordsFinalization = new FinalizationRegistry(ptr => wasm.__wbg_kordchords_free(ptr));
520
- /**
521
- * The [`Chord`]s wrapper.
522
- */
523
- export class KordChords {
524
-
525
- static __wrap(ptr) {
526
- const obj = Object.create(KordChords.prototype);
527
- obj.ptr = ptr;
528
- KordChordsFinalization.register(obj, obj.ptr, obj);
529
- return obj;
530
- }
531
-
532
- __destroy_into_raw() {
533
- const ptr = this.ptr;
534
- this.ptr = 0;
535
- KordChordsFinalization.unregister(this);
536
- return ptr;
537
- }
538
-
539
- free() {
540
- const ptr = this.__destroy_into_raw();
541
- wasm.__wbg_kordchords_free(ptr);
849
+ /**
850
+ * Returns the [`Chord`]'s extensions.
851
+ * @returns {Array<any>}
852
+ */
853
+ extensions() {
854
+ const ret = wasm.kordchord_extensions(this.ptr);
855
+ return takeObject(ret);
542
856
  }
543
857
  /**
544
- * Gets an item from the collection.
545
- * @param {number} index
546
- * @returns {KordChord | undefined}
858
+ * Returns a new [`Chord`] with the inversion set to the provided value.
859
+ * @param {number} inversion
860
+ * @returns {KordChord}
547
861
  */
548
- get(index) {
549
- const ret = wasm.kordchords_get(this.ptr, index);
550
- return ret === 0 ? undefined : KordChord.__wrap(ret);
862
+ withInversion(inversion) {
863
+ const ret = wasm.kordchord_withInversion(this.ptr, inversion);
864
+ return KordChord.__wrap(ret);
551
865
  }
552
866
  /**
553
- * Returns the number of items in the collection.
554
- * @returns {number}
867
+ * Returns a new [`Chord`] with the slash set to the provided value.
868
+ * @param {KordNote} slash
869
+ * @returns {KordChord}
555
870
  */
556
- get length() {
557
- const ret = wasm.kordchords_length(this.ptr);
558
- return ret >>> 0;
871
+ withSlash(slash) {
872
+ _assertClass(slash, KordNote);
873
+ const ret = wasm.kordchord_withSlash(this.ptr, slash.ptr);
874
+ return KordChord.__wrap(ret);
559
875
  }
560
876
  /**
561
- * Returns the [`Chord`]s as a space-separated string.
562
- * @returns {string}
877
+ * Returns a new [`Chord`] with the octave of the root set to the provided value.
878
+ * @param {number} octave
879
+ * @returns {KordChord}
563
880
  */
564
- to_string() {
881
+ withOctave(octave) {
565
882
  try {
566
883
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
567
- wasm.kordchords_to_string(retptr, this.ptr);
884
+ wasm.kordchord_withOctave(retptr, this.ptr, octave);
568
885
  var r0 = getInt32Memory0()[retptr / 4 + 0];
569
886
  var r1 = getInt32Memory0()[retptr / 4 + 1];
570
- return getStringFromWasm0(r0, r1);
887
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
888
+ if (r2) {
889
+ throw takeObject(r1);
890
+ }
891
+ return KordChord.__wrap(r0);
571
892
  } finally {
572
893
  wasm.__wbindgen_add_to_stack_pointer(16);
573
- wasm.__wbindgen_free(r0, r1);
574
894
  }
575
895
  }
896
+ /**
897
+ * Returns a new [`Chord`] with the "crunchiness" to the provided value.
898
+ * @param {boolean} is_crunchy
899
+ * @returns {KordChord}
900
+ */
901
+ withCrunchy(is_crunchy) {
902
+ const ret = wasm.kordchord_withCrunchy(this.ptr, is_crunchy);
903
+ return KordChord.__wrap(ret);
904
+ }
905
+ /**
906
+ * Plays the [`Chord`].
907
+ * @param {number} delay
908
+ * @param {number} length
909
+ * @param {number} fade_in
910
+ * @returns {Promise<void>}
911
+ */
912
+ play(delay, length, fade_in) {
913
+ const ret = wasm.kordchord_play(this.ptr, delay, length, fade_in);
914
+ return takeObject(ret);
915
+ }
916
+ /**
917
+ * Returns the clone of the [`Chord`].
918
+ * @returns {KordChord}
919
+ */
920
+ copy() {
921
+ const ret = wasm.kordchord_copy(this.ptr);
922
+ return KordChord.__wrap(ret);
923
+ }
576
924
  }
577
925
 
578
926
  const KordNoteFinalization = new FinalizationRegistry(ptr => wasm.__wbg_kordnote_free(ptr));
@@ -625,21 +973,21 @@ export class KordNote {
625
973
  * Returns [`Note`]s from audio data.
626
974
  * @param {Float32Array} data
627
975
  * @param {number} length_in_seconds
628
- * @returns {KordNotes}
976
+ * @returns {Array<any>}
629
977
  */
630
- static from_audio(data, length_in_seconds) {
978
+ static fromAudio(data, length_in_seconds) {
631
979
  try {
632
980
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
633
981
  const ptr0 = passArrayF32ToWasm0(data, wasm.__wbindgen_malloc);
634
982
  const len0 = WASM_VECTOR_LEN;
635
- wasm.kordnote_from_audio(retptr, ptr0, len0, length_in_seconds);
983
+ wasm.kordnote_fromAudio(retptr, ptr0, len0, length_in_seconds);
636
984
  var r0 = getInt32Memory0()[retptr / 4 + 0];
637
985
  var r1 = getInt32Memory0()[retptr / 4 + 1];
638
986
  var r2 = getInt32Memory0()[retptr / 4 + 2];
639
987
  if (r2) {
640
988
  throw takeObject(r1);
641
989
  }
642
- return KordNotes.__wrap(r0);
990
+ return takeObject(r0);
643
991
  } finally {
644
992
  wasm.__wbindgen_add_to_stack_pointer(16);
645
993
  }
@@ -648,21 +996,21 @@ export class KordNote {
648
996
  * Returns [`Note`]s from audio data using the ML inference algorithm.
649
997
  * @param {Float32Array} data
650
998
  * @param {number} length_in_seconds
651
- * @returns {KordNotes}
999
+ * @returns {Array<any>}
652
1000
  */
653
- static from_audio_ml(data, length_in_seconds) {
1001
+ static fromAudioMl(data, length_in_seconds) {
654
1002
  try {
655
1003
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
656
1004
  const ptr0 = passArrayF32ToWasm0(data, wasm.__wbindgen_malloc);
657
1005
  const len0 = WASM_VECTOR_LEN;
658
- wasm.kordnote_from_audio_ml(retptr, ptr0, len0, length_in_seconds);
1006
+ wasm.kordnote_fromAudioMl(retptr, ptr0, len0, length_in_seconds);
659
1007
  var r0 = getInt32Memory0()[retptr / 4 + 0];
660
1008
  var r1 = getInt32Memory0()[retptr / 4 + 1];
661
1009
  var r2 = getInt32Memory0()[retptr / 4 + 2];
662
1010
  if (r2) {
663
1011
  throw takeObject(r1);
664
1012
  }
665
- return KordNotes.__wrap(r0);
1013
+ return takeObject(r0);
666
1014
  } finally {
667
1015
  wasm.__wbindgen_add_to_stack_pointer(16);
668
1016
  }
@@ -684,6 +1032,22 @@ export class KordNote {
684
1032
  }
685
1033
  }
686
1034
  /**
1035
+ * Returns the [`Note`] represented as a string (same as `name`).
1036
+ * @returns {string}
1037
+ */
1038
+ toString() {
1039
+ try {
1040
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1041
+ wasm.kordnote_toString(retptr, this.ptr);
1042
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1043
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1044
+ return getStringFromWasm0(r0, r1);
1045
+ } finally {
1046
+ wasm.__wbindgen_add_to_stack_pointer(16);
1047
+ wasm.__wbindgen_free(r0, r1);
1048
+ }
1049
+ }
1050
+ /**
687
1051
  * Returns the [`Note`]'s [`NamedPitch`].
688
1052
  * @returns {string}
689
1053
  */
@@ -715,65 +1079,36 @@ export class KordNote {
715
1079
  const ret = wasm.kordnote_frequency(this.ptr);
716
1080
  return ret;
717
1081
  }
718
- }
719
-
720
- const KordNotesFinalization = new FinalizationRegistry(ptr => wasm.__wbg_kordnotes_free(ptr));
721
- /**
722
- * The [`Note`]s wrapper.
723
- */
724
- export class KordNotes {
725
-
726
- static __wrap(ptr) {
727
- const obj = Object.create(KordNotes.prototype);
728
- obj.ptr = ptr;
729
- KordNotesFinalization.register(obj, obj.ptr, obj);
730
- return obj;
731
- }
732
-
733
- __destroy_into_raw() {
734
- const ptr = this.ptr;
735
- this.ptr = 0;
736
- KordNotesFinalization.unregister(this);
737
- return ptr;
738
- }
739
-
740
- free() {
741
- const ptr = this.__destroy_into_raw();
742
- wasm.__wbg_kordnotes_free(ptr);
743
- }
744
- /**
745
- * Gets an item from the collection.
746
- * @param {number} index
747
- * @returns {KordNote | undefined}
748
- */
749
- get(index) {
750
- const ret = wasm.kordnotes_get(this.ptr, index);
751
- return ret === 0 ? undefined : KordNote.__wrap(ret);
752
- }
753
1082
  /**
754
- * Returns the number of items in the collection.
755
- * @returns {number}
756
- */
757
- get length() {
758
- const ret = wasm.kordchords_length(this.ptr);
759
- return ret >>> 0;
760
- }
761
- /**
762
- * Returns the [`Note`]s as a space-separated string.
763
- * @returns {string}
1083
+ * Adds the given interval to the [`Note`].
1084
+ *
1085
+ * Clones the underlying note before mutation, producing a _new_ [`KordNote`].
1086
+ * @param {number} interval
1087
+ * @returns {KordNote}
764
1088
  */
765
- to_string() {
1089
+ addInterval(interval) {
766
1090
  try {
767
1091
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
768
- wasm.kordnotes_to_string(retptr, this.ptr);
1092
+ wasm.kordnote_addInterval(retptr, this.ptr, interval);
769
1093
  var r0 = getInt32Memory0()[retptr / 4 + 0];
770
1094
  var r1 = getInt32Memory0()[retptr / 4 + 1];
771
- return getStringFromWasm0(r0, r1);
1095
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1096
+ if (r2) {
1097
+ throw takeObject(r1);
1098
+ }
1099
+ return KordNote.__wrap(r0);
772
1100
  } finally {
773
1101
  wasm.__wbindgen_add_to_stack_pointer(16);
774
- wasm.__wbindgen_free(r0, r1);
775
1102
  }
776
1103
  }
1104
+ /**
1105
+ * Returns the clone of the [`Note`].
1106
+ * @returns {KordNote}
1107
+ */
1108
+ copy() {
1109
+ const ret = wasm.kordnote_copy(this.ptr);
1110
+ return KordNote.__wrap(ret);
1111
+ }
777
1112
  }
778
1113
 
779
1114
  async function load(module, imports) {
@@ -813,6 +1148,24 @@ function getImports() {
813
1148
  imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
814
1149
  takeObject(arg0);
815
1150
  };
1151
+ imports.wbg.__wbg_kordchord_new = function(arg0) {
1152
+ const ret = KordChord.__wrap(arg0);
1153
+ return addHeapObject(ret);
1154
+ };
1155
+ imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
1156
+ const ret = getStringFromWasm0(arg0, arg1);
1157
+ return addHeapObject(ret);
1158
+ };
1159
+ imports.wbg.__wbg_kordnote_new = function(arg0) {
1160
+ const ret = KordNote.__wrap(arg0);
1161
+ return addHeapObject(ret);
1162
+ };
1163
+ imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
1164
+ const obj = getObject(arg1);
1165
+ const ret = typeof(obj) === 'number' ? obj : undefined;
1166
+ getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
1167
+ getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
1168
+ };
816
1169
  imports.wbg.__wbindgen_cb_drop = function(arg0) {
817
1170
  const obj = takeObject(arg0).original;
818
1171
  if (obj.cnt-- == 1) {
@@ -822,10 +1175,24 @@ function getImports() {
822
1175
  const ret = false;
823
1176
  return ret;
824
1177
  };
825
- imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
826
- const ret = getStringFromWasm0(arg0, arg1);
1178
+ imports.wbg.__wbg_new_abda76e883ba8a5f = function() {
1179
+ const ret = new Error();
827
1180
  return addHeapObject(ret);
828
1181
  };
1182
+ imports.wbg.__wbg_stack_658279fe44541cf6 = function(arg0, arg1) {
1183
+ const ret = getObject(arg1).stack;
1184
+ const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1185
+ const len0 = WASM_VECTOR_LEN;
1186
+ getInt32Memory0()[arg0 / 4 + 1] = len0;
1187
+ getInt32Memory0()[arg0 / 4 + 0] = ptr0;
1188
+ };
1189
+ imports.wbg.__wbg_error_f851667af71bcfc6 = function(arg0, arg1) {
1190
+ try {
1191
+ console.error(getStringFromWasm0(arg0, arg1));
1192
+ } finally {
1193
+ wasm.__wbindgen_free(arg0, arg1);
1194
+ }
1195
+ };
829
1196
  imports.wbg.__wbindgen_boolean_get = function(arg0) {
830
1197
  const v = getObject(arg0);
831
1198
  const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
@@ -877,6 +1244,14 @@ function getImports() {
877
1244
  const ret = arg0;
878
1245
  return addHeapObject(ret);
879
1246
  };
1247
+ imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
1248
+ const obj = getObject(arg1);
1249
+ const ret = typeof(obj) === 'string' ? obj : undefined;
1250
+ var ptr0 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1251
+ var len0 = WASM_VECTOR_LEN;
1252
+ getInt32Memory0()[arg0 / 4 + 1] = len0;
1253
+ getInt32Memory0()[arg0 / 4 + 0] = ptr0;
1254
+ };
880
1255
  imports.wbg.__wbg_setbuffer_bad384d1628a8306 = function(arg0, arg1) {
881
1256
  getObject(arg0).buffer = getObject(arg1);
882
1257
  };
@@ -893,10 +1268,26 @@ function getImports() {
893
1268
  imports.wbg.__wbg_copyToChannel_9babe9bf308bffc3 = function() { return handleError(function (arg0, arg1, arg2, arg3) {
894
1269
  getObject(arg0).copyToChannel(getArrayF32FromWasm0(arg1, arg2), arg3);
895
1270
  }, arguments) };
1271
+ imports.wbg.__wbg_get_27fe3dac1c4d0224 = function(arg0, arg1) {
1272
+ const ret = getObject(arg0)[arg1 >>> 0];
1273
+ return addHeapObject(ret);
1274
+ };
1275
+ imports.wbg.__wbg_length_e498fbc24f9c1d4f = function(arg0) {
1276
+ const ret = getObject(arg0).length;
1277
+ return ret;
1278
+ };
1279
+ imports.wbg.__wbg_new_b525de17f44a8943 = function() {
1280
+ const ret = new Array();
1281
+ return addHeapObject(ret);
1282
+ };
896
1283
  imports.wbg.__wbg_newnoargs_2b8b6bd7753c76ba = function(arg0, arg1) {
897
1284
  const ret = new Function(getStringFromWasm0(arg0, arg1));
898
1285
  return addHeapObject(ret);
899
1286
  };
1287
+ imports.wbg.__wbg_get_baf4855f9a986186 = function() { return handleError(function (arg0, arg1) {
1288
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
1289
+ return addHeapObject(ret);
1290
+ }, arguments) };
900
1291
  imports.wbg.__wbg_call_95d1ea488d03e4e8 = function() { return handleError(function (arg0, arg1) {
901
1292
  const ret = getObject(arg0).call(getObject(arg1));
902
1293
  return addHeapObject(ret);
@@ -933,10 +1324,32 @@ function getImports() {
933
1324
  const ret = eval(getStringFromWasm0(arg0, arg1));
934
1325
  return addHeapObject(ret);
935
1326
  }, arguments) };
1327
+ imports.wbg.__wbg_push_49c286f04dd3bf59 = function(arg0, arg1) {
1328
+ const ret = getObject(arg0).push(getObject(arg1));
1329
+ return ret;
1330
+ };
936
1331
  imports.wbg.__wbg_call_9495de66fdbe016b = function() { return handleError(function (arg0, arg1, arg2) {
937
1332
  const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
938
1333
  return addHeapObject(ret);
939
1334
  }, arguments) };
1335
+ imports.wbg.__wbg_name_4e66d4cfa3e9270a = function(arg0) {
1336
+ const ret = getObject(arg0).name;
1337
+ return addHeapObject(ret);
1338
+ };
1339
+ imports.wbg.__wbg_instanceof_Object_f5a826c4da0d4a94 = function(arg0) {
1340
+ let result;
1341
+ try {
1342
+ result = getObject(arg0) instanceof Object;
1343
+ } catch {
1344
+ result = false;
1345
+ }
1346
+ const ret = result;
1347
+ return ret;
1348
+ };
1349
+ imports.wbg.__wbg_constructor_0c9828c8a7cf1dc6 = function(arg0) {
1350
+ const ret = getObject(arg0).constructor;
1351
+ return addHeapObject(ret);
1352
+ };
940
1353
  imports.wbg.__wbg_new_9d3a9ce4282a18a8 = function(arg0, arg1) {
941
1354
  try {
942
1355
  var state0 = {a: arg0, b: arg1};
@@ -944,7 +1357,7 @@ function getImports() {
944
1357
  const a = state0.a;
945
1358
  state0.a = 0;
946
1359
  try {
947
- return __wbg_adapter_91(a, state0.b, arg0, arg1);
1360
+ return __wbg_adapter_125(a, state0.b, arg0, arg1);
948
1361
  } finally {
949
1362
  state0.a = a;
950
1363
  }
@@ -977,12 +1390,12 @@ function getImports() {
977
1390
  imports.wbg.__wbindgen_throw = function(arg0, arg1) {
978
1391
  throw new Error(getStringFromWasm0(arg0, arg1));
979
1392
  };
980
- imports.wbg.__wbindgen_closure_wrapper1008 = function(arg0, arg1, arg2) {
981
- const ret = makeMutClosure(arg0, arg1, 468, __wbg_adapter_20);
1393
+ imports.wbg.__wbindgen_closure_wrapper1041 = function(arg0, arg1, arg2) {
1394
+ const ret = makeMutClosure(arg0, arg1, 469, __wbg_adapter_24);
982
1395
  return addHeapObject(ret);
983
1396
  };
984
- imports.wbg.__wbindgen_closure_wrapper1308 = function(arg0, arg1, arg2) {
985
- const ret = makeMutClosure(arg0, arg1, 588, __wbg_adapter_23);
1397
+ imports.wbg.__wbindgen_closure_wrapper1368 = function(arg0, arg1, arg2) {
1398
+ const ret = makeMutClosure(arg0, arg1, 606, __wbg_adapter_27);
986
1399
  return addHeapObject(ret);
987
1400
  };
988
1401
 
@@ -997,10 +1410,11 @@ function finalizeInit(instance, module) {
997
1410
  wasm = instance.exports;
998
1411
  init.__wbindgen_wasm_module = module;
999
1412
  cachedFloat32Memory0 = null;
1413
+ cachedFloat64Memory0 = null;
1000
1414
  cachedInt32Memory0 = null;
1001
1415
  cachedUint8Memory0 = null;
1002
1416
 
1003
-
1417
+ wasm.__wbindgen_start();
1004
1418
  return wasm;
1005
1419
  }
1006
1420