kordweb 0.5.11 → 0.5.14
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/README.md +1 -1
- package/klib.d.ts +69 -57
- package/klib.js +85 -78
- package/klib_bg.wasm +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -231,7 +231,7 @@ chord.chordString(); // C4 E4 G4 Bb5 D#5
|
|
|
231
231
|
KordChord.parse('C7b9').withOctave(2).chord().map(n => n.name()); // [ 'C2', 'D♭2', 'E2', 'G2', 'B♭2' ]
|
|
232
232
|
|
|
233
233
|
// Build chords.
|
|
234
|
-
KordChord.parse('C').
|
|
234
|
+
KordChord.parse('C').minor().seven().chord().map(n => n.name()); // [ 'C4', 'Eb4', 'G4', 'Bb4' ]
|
|
235
235
|
```
|
|
236
236
|
|
|
237
237
|
## Feature Flags
|
package/klib.d.ts
CHANGED
|
@@ -5,6 +5,59 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export function main(): void;
|
|
7
7
|
/**
|
|
8
|
+
* An enum representing the extension of a chord.
|
|
9
|
+
*
|
|
10
|
+
* Extensions are not really "special" in the sense that they do not change how the
|
|
11
|
+
* chord is interpreted by the system. E.g., an `add2` just adds a 2 to the chord,
|
|
12
|
+
* and the chord is still interpreted as a major chord.
|
|
13
|
+
*/
|
|
14
|
+
export enum KordExtension {
|
|
15
|
+
/**
|
|
16
|
+
* Sus2 extension.
|
|
17
|
+
*/
|
|
18
|
+
Sus2 = 0,
|
|
19
|
+
/**
|
|
20
|
+
* Sus4 extension.
|
|
21
|
+
*/
|
|
22
|
+
Sus4 = 1,
|
|
23
|
+
/**
|
|
24
|
+
* Flat 11 extension.
|
|
25
|
+
*/
|
|
26
|
+
Flat11 = 2,
|
|
27
|
+
/**
|
|
28
|
+
* Flat 13 extension.
|
|
29
|
+
*/
|
|
30
|
+
Flat13 = 3,
|
|
31
|
+
/**
|
|
32
|
+
* Sharp 13 extension.
|
|
33
|
+
*/
|
|
34
|
+
Sharp13 = 4,
|
|
35
|
+
/**
|
|
36
|
+
* Add2 extension.
|
|
37
|
+
*/
|
|
38
|
+
Add2 = 5,
|
|
39
|
+
/**
|
|
40
|
+
* Add4 extension.
|
|
41
|
+
*/
|
|
42
|
+
Add4 = 6,
|
|
43
|
+
/**
|
|
44
|
+
* Add6 extension.
|
|
45
|
+
*/
|
|
46
|
+
Add6 = 7,
|
|
47
|
+
/**
|
|
48
|
+
* Add9 extension.
|
|
49
|
+
*/
|
|
50
|
+
Add9 = 8,
|
|
51
|
+
/**
|
|
52
|
+
* Add11 extension.
|
|
53
|
+
*/
|
|
54
|
+
Add11 = 9,
|
|
55
|
+
/**
|
|
56
|
+
* Add13 extension.
|
|
57
|
+
*/
|
|
58
|
+
Add13 = 10,
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
8
61
|
* An enum representing the interval between two notes.
|
|
9
62
|
*/
|
|
10
63
|
export enum KordInterval {
|
|
@@ -202,59 +255,6 @@ export enum KordInterval {
|
|
|
202
255
|
ThreePerfectOctavesAndMajorSeventh = 47,
|
|
203
256
|
}
|
|
204
257
|
/**
|
|
205
|
-
* An enum representing the extension of a chord.
|
|
206
|
-
*
|
|
207
|
-
* Extensions are not really "special" in the sense that they do not change how the
|
|
208
|
-
* chord is interpreted by the system. E.g., an `add2` just adds a 2 to the chord,
|
|
209
|
-
* and the chord is still interpreted as a major chord.
|
|
210
|
-
*/
|
|
211
|
-
export enum KordExtension {
|
|
212
|
-
/**
|
|
213
|
-
* Sus2 extension.
|
|
214
|
-
*/
|
|
215
|
-
Sus2 = 0,
|
|
216
|
-
/**
|
|
217
|
-
* Sus4 extension.
|
|
218
|
-
*/
|
|
219
|
-
Sus4 = 1,
|
|
220
|
-
/**
|
|
221
|
-
* Flat 11 extension.
|
|
222
|
-
*/
|
|
223
|
-
Flat11 = 2,
|
|
224
|
-
/**
|
|
225
|
-
* Flat 13 extension.
|
|
226
|
-
*/
|
|
227
|
-
Flat13 = 3,
|
|
228
|
-
/**
|
|
229
|
-
* Sharp 13 extension.
|
|
230
|
-
*/
|
|
231
|
-
Sharp13 = 4,
|
|
232
|
-
/**
|
|
233
|
-
* Add2 extension.
|
|
234
|
-
*/
|
|
235
|
-
Add2 = 5,
|
|
236
|
-
/**
|
|
237
|
-
* Add4 extension.
|
|
238
|
-
*/
|
|
239
|
-
Add4 = 6,
|
|
240
|
-
/**
|
|
241
|
-
* Add6 extension.
|
|
242
|
-
*/
|
|
243
|
-
Add6 = 7,
|
|
244
|
-
/**
|
|
245
|
-
* Add9 extension.
|
|
246
|
-
*/
|
|
247
|
-
Add9 = 8,
|
|
248
|
-
/**
|
|
249
|
-
* Add11 extension.
|
|
250
|
-
*/
|
|
251
|
-
Add11 = 9,
|
|
252
|
-
/**
|
|
253
|
-
* Add13 extension.
|
|
254
|
-
*/
|
|
255
|
-
Add13 = 10,
|
|
256
|
-
}
|
|
257
|
-
/**
|
|
258
258
|
* The chord modifiers.
|
|
259
259
|
*/
|
|
260
260
|
export enum KordModifier {
|
|
@@ -617,14 +617,24 @@ export class KordNote {
|
|
|
617
617
|
*/
|
|
618
618
|
frequency(): number;
|
|
619
619
|
/**
|
|
620
|
-
* Adds the given interval to the [`Note`].
|
|
621
|
-
*
|
|
622
|
-
* Clones the underlying note before mutation, producing a _new_ [`KordNote`].
|
|
620
|
+
* Adds the given interval to the [`Note`], producing a new [`Note`] instance.
|
|
623
621
|
* @param {number} interval
|
|
624
622
|
* @returns {KordNote}
|
|
625
623
|
*/
|
|
626
624
|
addInterval(interval: number): KordNote;
|
|
627
625
|
/**
|
|
626
|
+
* Subtracts the given interval from the [`Note`], producing a new [`Note`] instance.
|
|
627
|
+
* @param {number} interval
|
|
628
|
+
* @returns {KordNote}
|
|
629
|
+
*/
|
|
630
|
+
subInterval(interval: number): KordNote;
|
|
631
|
+
/**
|
|
632
|
+
* Computes the [`Interval`] distance between the [`Note`] and the given [`Note`].
|
|
633
|
+
* @param {KordNote} other
|
|
634
|
+
* @returns {number}
|
|
635
|
+
*/
|
|
636
|
+
distanceTo(other: KordNote): number;
|
|
637
|
+
/**
|
|
628
638
|
* Returns the primary (first 13) harmonic series of the [`Note`].
|
|
629
639
|
* @returns {Array<any>}
|
|
630
640
|
*/
|
|
@@ -649,7 +659,9 @@ export interface InitOutput {
|
|
|
649
659
|
readonly kordnote_pitch: (a: number, b: number) => void;
|
|
650
660
|
readonly kordnote_octave: (a: number) => number;
|
|
651
661
|
readonly kordnote_frequency: (a: number) => number;
|
|
652
|
-
readonly kordnote_addInterval: (a: number, b: number
|
|
662
|
+
readonly kordnote_addInterval: (a: number, b: number) => number;
|
|
663
|
+
readonly kordnote_subInterval: (a: number, b: number) => number;
|
|
664
|
+
readonly kordnote_distanceTo: (a: number, b: number) => number;
|
|
653
665
|
readonly kordnote_harmonicSeries: (a: number) => number;
|
|
654
666
|
readonly kordnote_copy: (a: number) => number;
|
|
655
667
|
readonly __wbg_kordchord_free: (a: number) => void;
|
package/klib.js
CHANGED
|
@@ -266,10 +266,62 @@ function handleError(f, args) {
|
|
|
266
266
|
function getArrayF32FromWasm0(ptr, len) {
|
|
267
267
|
return getFloat32Memory0().subarray(ptr / 4, ptr / 4 + len);
|
|
268
268
|
}
|
|
269
|
-
function
|
|
269
|
+
function __wbg_adapter_152(arg0, arg1, arg2, arg3) {
|
|
270
270
|
wasm.wasm_bindgen__convert__closures__invoke2_mut__h2d4abc1ddedd8c19(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
271
271
|
}
|
|
272
272
|
|
|
273
|
+
/**
|
|
274
|
+
* An enum representing the extension of a chord.
|
|
275
|
+
*
|
|
276
|
+
* Extensions are not really "special" in the sense that they do not change how the
|
|
277
|
+
* chord is interpreted by the system. E.g., an `add2` just adds a 2 to the chord,
|
|
278
|
+
* and the chord is still interpreted as a major chord.
|
|
279
|
+
*/
|
|
280
|
+
export const KordExtension = Object.freeze({
|
|
281
|
+
/**
|
|
282
|
+
* Sus2 extension.
|
|
283
|
+
*/
|
|
284
|
+
Sus2:0,"0":"Sus2",
|
|
285
|
+
/**
|
|
286
|
+
* Sus4 extension.
|
|
287
|
+
*/
|
|
288
|
+
Sus4:1,"1":"Sus4",
|
|
289
|
+
/**
|
|
290
|
+
* Flat 11 extension.
|
|
291
|
+
*/
|
|
292
|
+
Flat11:2,"2":"Flat11",
|
|
293
|
+
/**
|
|
294
|
+
* Flat 13 extension.
|
|
295
|
+
*/
|
|
296
|
+
Flat13:3,"3":"Flat13",
|
|
297
|
+
/**
|
|
298
|
+
* Sharp 13 extension.
|
|
299
|
+
*/
|
|
300
|
+
Sharp13:4,"4":"Sharp13",
|
|
301
|
+
/**
|
|
302
|
+
* Add2 extension.
|
|
303
|
+
*/
|
|
304
|
+
Add2:5,"5":"Add2",
|
|
305
|
+
/**
|
|
306
|
+
* Add4 extension.
|
|
307
|
+
*/
|
|
308
|
+
Add4:6,"6":"Add4",
|
|
309
|
+
/**
|
|
310
|
+
* Add6 extension.
|
|
311
|
+
*/
|
|
312
|
+
Add6:7,"7":"Add6",
|
|
313
|
+
/**
|
|
314
|
+
* Add9 extension.
|
|
315
|
+
*/
|
|
316
|
+
Add9:8,"8":"Add9",
|
|
317
|
+
/**
|
|
318
|
+
* Add11 extension.
|
|
319
|
+
*/
|
|
320
|
+
Add11:9,"9":"Add11",
|
|
321
|
+
/**
|
|
322
|
+
* Add13 extension.
|
|
323
|
+
*/
|
|
324
|
+
Add13:10,"10":"Add13", });
|
|
273
325
|
/**
|
|
274
326
|
* An enum representing the interval between two notes.
|
|
275
327
|
*/
|
|
@@ -467,58 +519,6 @@ ThreePerfectOctavesAndMinorSeventh:46,"46":"ThreePerfectOctavesAndMinorSeventh",
|
|
|
467
519
|
*/
|
|
468
520
|
ThreePerfectOctavesAndMajorSeventh:47,"47":"ThreePerfectOctavesAndMajorSeventh", });
|
|
469
521
|
/**
|
|
470
|
-
* An enum representing the extension of a chord.
|
|
471
|
-
*
|
|
472
|
-
* Extensions are not really "special" in the sense that they do not change how the
|
|
473
|
-
* chord is interpreted by the system. E.g., an `add2` just adds a 2 to the chord,
|
|
474
|
-
* and the chord is still interpreted as a major chord.
|
|
475
|
-
*/
|
|
476
|
-
export const KordExtension = Object.freeze({
|
|
477
|
-
/**
|
|
478
|
-
* Sus2 extension.
|
|
479
|
-
*/
|
|
480
|
-
Sus2:0,"0":"Sus2",
|
|
481
|
-
/**
|
|
482
|
-
* Sus4 extension.
|
|
483
|
-
*/
|
|
484
|
-
Sus4:1,"1":"Sus4",
|
|
485
|
-
/**
|
|
486
|
-
* Flat 11 extension.
|
|
487
|
-
*/
|
|
488
|
-
Flat11:2,"2":"Flat11",
|
|
489
|
-
/**
|
|
490
|
-
* Flat 13 extension.
|
|
491
|
-
*/
|
|
492
|
-
Flat13:3,"3":"Flat13",
|
|
493
|
-
/**
|
|
494
|
-
* Sharp 13 extension.
|
|
495
|
-
*/
|
|
496
|
-
Sharp13:4,"4":"Sharp13",
|
|
497
|
-
/**
|
|
498
|
-
* Add2 extension.
|
|
499
|
-
*/
|
|
500
|
-
Add2:5,"5":"Add2",
|
|
501
|
-
/**
|
|
502
|
-
* Add4 extension.
|
|
503
|
-
*/
|
|
504
|
-
Add4:6,"6":"Add4",
|
|
505
|
-
/**
|
|
506
|
-
* Add6 extension.
|
|
507
|
-
*/
|
|
508
|
-
Add6:7,"7":"Add6",
|
|
509
|
-
/**
|
|
510
|
-
* Add9 extension.
|
|
511
|
-
*/
|
|
512
|
-
Add9:8,"8":"Add9",
|
|
513
|
-
/**
|
|
514
|
-
* Add11 extension.
|
|
515
|
-
*/
|
|
516
|
-
Add11:9,"9":"Add11",
|
|
517
|
-
/**
|
|
518
|
-
* Add13 extension.
|
|
519
|
-
*/
|
|
520
|
-
Add13:10,"10":"Add13", });
|
|
521
|
-
/**
|
|
522
522
|
* The chord modifiers.
|
|
523
523
|
*/
|
|
524
524
|
export const KordModifier = Object.freeze({
|
|
@@ -1272,26 +1272,33 @@ export class KordNote {
|
|
|
1272
1272
|
return ret;
|
|
1273
1273
|
}
|
|
1274
1274
|
/**
|
|
1275
|
-
* Adds the given interval to the [`Note`].
|
|
1276
|
-
*
|
|
1277
|
-
* Clones the underlying note before mutation, producing a _new_ [`KordNote`].
|
|
1275
|
+
* Adds the given interval to the [`Note`], producing a new [`Note`] instance.
|
|
1278
1276
|
* @param {number} interval
|
|
1279
1277
|
* @returns {KordNote}
|
|
1280
1278
|
*/
|
|
1281
1279
|
addInterval(interval) {
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1280
|
+
const ret = wasm.kordnote_addInterval(this.ptr, interval);
|
|
1281
|
+
return KordNote.__wrap(ret);
|
|
1282
|
+
}
|
|
1283
|
+
/**
|
|
1284
|
+
* Subtracts the given interval from the [`Note`], producing a new [`Note`] instance.
|
|
1285
|
+
* @param {number} interval
|
|
1286
|
+
* @returns {KordNote}
|
|
1287
|
+
*/
|
|
1288
|
+
subInterval(interval) {
|
|
1289
|
+
const ret = wasm.kordnote_subInterval(this.ptr, interval);
|
|
1290
|
+
return KordNote.__wrap(ret);
|
|
1291
|
+
}
|
|
1292
|
+
/**
|
|
1293
|
+
* Computes the [`Interval`] distance between the [`Note`] and the given [`Note`].
|
|
1294
|
+
* @param {KordNote} other
|
|
1295
|
+
* @returns {number}
|
|
1296
|
+
*/
|
|
1297
|
+
distanceTo(other) {
|
|
1298
|
+
_assertClass(other, KordNote);
|
|
1299
|
+
var ptr0 = other.__destroy_into_raw();
|
|
1300
|
+
const ret = wasm.kordnote_distanceTo(this.ptr, ptr0);
|
|
1301
|
+
return ret >>> 0;
|
|
1295
1302
|
}
|
|
1296
1303
|
/**
|
|
1297
1304
|
* Returns the primary (first 13) harmonic series of the [`Note`].
|
|
@@ -1352,14 +1359,14 @@ function getImports() {
|
|
|
1352
1359
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
1353
1360
|
return addHeapObject(ret);
|
|
1354
1361
|
};
|
|
1355
|
-
imports.wbg.__wbg_kordchord_new = function(arg0) {
|
|
1356
|
-
const ret = KordChord.__wrap(arg0);
|
|
1357
|
-
return addHeapObject(ret);
|
|
1358
|
-
};
|
|
1359
1362
|
imports.wbg.__wbg_kordnote_new = function(arg0) {
|
|
1360
1363
|
const ret = KordNote.__wrap(arg0);
|
|
1361
1364
|
return addHeapObject(ret);
|
|
1362
1365
|
};
|
|
1366
|
+
imports.wbg.__wbg_kordchord_new = function(arg0) {
|
|
1367
|
+
const ret = KordChord.__wrap(arg0);
|
|
1368
|
+
return addHeapObject(ret);
|
|
1369
|
+
};
|
|
1363
1370
|
imports.wbg.__wbindgen_cb_drop = function(arg0) {
|
|
1364
1371
|
const obj = takeObject(arg0).original;
|
|
1365
1372
|
if (obj.cnt-- == 1) {
|
|
@@ -1557,7 +1564,7 @@ function getImports() {
|
|
|
1557
1564
|
const a = state0.a;
|
|
1558
1565
|
state0.a = 0;
|
|
1559
1566
|
try {
|
|
1560
|
-
return
|
|
1567
|
+
return __wbg_adapter_152(a, state0.b, arg0, arg1);
|
|
1561
1568
|
} finally {
|
|
1562
1569
|
state0.a = a;
|
|
1563
1570
|
}
|
|
@@ -1590,12 +1597,12 @@ function getImports() {
|
|
|
1590
1597
|
imports.wbg.__wbindgen_throw = function(arg0, arg1) {
|
|
1591
1598
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
1592
1599
|
};
|
|
1593
|
-
imports.wbg.
|
|
1594
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
1600
|
+
imports.wbg.__wbindgen_closure_wrapper1089 = function(arg0, arg1, arg2) {
|
|
1601
|
+
const ret = makeMutClosure(arg0, arg1, 477, __wbg_adapter_24);
|
|
1595
1602
|
return addHeapObject(ret);
|
|
1596
1603
|
};
|
|
1597
|
-
imports.wbg.
|
|
1598
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
1604
|
+
imports.wbg.__wbindgen_closure_wrapper1420 = function(arg0, arg1, arg2) {
|
|
1605
|
+
const ret = makeMutClosure(arg0, arg1, 657, __wbg_adapter_27);
|
|
1599
1606
|
return addHeapObject(ret);
|
|
1600
1607
|
};
|
|
1601
1608
|
|
package/klib_bg.wasm
CHANGED
|
Binary file
|