kordweb 0.6.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/klib.d.ts CHANGED
@@ -1,2 +1,651 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
+ /**
4
+ * The chord modifiers.
5
+ */
6
+ export enum KordModifier {
7
+ /**
8
+ * Minor modifier.
9
+ */
10
+ Minor = 0,
11
+ /**
12
+ * Flat 5 modifier.
13
+ */
14
+ Flat5 = 1,
15
+ /**
16
+ * Sharp 5 modifier.
17
+ */
18
+ Augmented5 = 2,
19
+ /**
20
+ * Major 7 modifier.
21
+ */
22
+ Major7 = 3,
23
+ /**
24
+ * Dominant 7 modifier.
25
+ */
26
+ Dominant7 = 4,
27
+ /**
28
+ * Dominant 9 modifier.
29
+ */
30
+ Dominant9 = 5,
31
+ /**
32
+ * Dominant 11 modifier.
33
+ */
34
+ Dominant11 = 6,
35
+ /**
36
+ * Dominant 13 modifier.
37
+ */
38
+ Dominant13 = 7,
39
+ /**
40
+ * Flat 9 modifier.
41
+ */
42
+ Flat9 = 8,
43
+ /**
44
+ * Sharp 9 modifier.
45
+ */
46
+ Sharp9 = 9,
47
+ /**
48
+ * Sharp 11 modifier.
49
+ */
50
+ Sharp11 = 10,
51
+ /**
52
+ * Diminished modifier.
53
+ */
54
+ Diminished = 11,
55
+ }
56
+ /**
57
+ * An enum representing the interval between two notes.
58
+ */
59
+ export enum KordInterval {
60
+ /**
61
+ * A perfect unison interval.
62
+ */
63
+ PerfectUnison = 0,
64
+ /**
65
+ * A diminished second interval.
66
+ */
67
+ DiminishedSecond = 1,
68
+ /**
69
+ * An augmented unison interval.
70
+ */
71
+ AugmentedUnison = 2,
72
+ /**
73
+ * A minor second interval.
74
+ */
75
+ MinorSecond = 3,
76
+ /**
77
+ * A major second interval.
78
+ */
79
+ MajorSecond = 4,
80
+ /**
81
+ * A diminished third interval.
82
+ */
83
+ DiminishedThird = 5,
84
+ /**
85
+ * An augmented second interval.
86
+ */
87
+ AugmentedSecond = 6,
88
+ /**
89
+ * A minor third interval.
90
+ */
91
+ MinorThird = 7,
92
+ /**
93
+ * A major third interval.
94
+ */
95
+ MajorThird = 8,
96
+ /**
97
+ * A diminished fourth interval.
98
+ */
99
+ DiminishedFourth = 9,
100
+ /**
101
+ * An augmented third interval.
102
+ */
103
+ AugmentedThird = 10,
104
+ /**
105
+ * A perfect fourth interval.
106
+ */
107
+ PerfectFourth = 11,
108
+ /**
109
+ * An augmented fourth interval.
110
+ */
111
+ AugmentedFourth = 12,
112
+ /**
113
+ * A diminished fifth interval.
114
+ */
115
+ DiminishedFifth = 13,
116
+ /**
117
+ * A perfect fifth interval.
118
+ */
119
+ PerfectFifth = 14,
120
+ /**
121
+ * A diminished sixth interval.
122
+ */
123
+ DiminishedSixth = 15,
124
+ /**
125
+ * An augmented fifth interval.
126
+ */
127
+ AugmentedFifth = 16,
128
+ /**
129
+ * A minor sixth interval.
130
+ */
131
+ MinorSixth = 17,
132
+ /**
133
+ * A major sixth interval.
134
+ */
135
+ MajorSixth = 18,
136
+ /**
137
+ * A diminished seventh interval.
138
+ */
139
+ DiminishedSeventh = 19,
140
+ /**
141
+ * An augmented sixth interval.
142
+ */
143
+ AugmentedSixth = 20,
144
+ /**
145
+ * A minor seventh interval.
146
+ */
147
+ MinorSeventh = 21,
148
+ /**
149
+ * A major seventh interval.
150
+ */
151
+ MajorSeventh = 22,
152
+ /**
153
+ * A diminished octave interval.
154
+ */
155
+ DiminishedOctave = 23,
156
+ /**
157
+ * An augmented seventh interval.
158
+ */
159
+ AugmentedSeventh = 24,
160
+ /**
161
+ * A perfect octave interval.
162
+ */
163
+ PerfectOctave = 25,
164
+ /**
165
+ * An minor ninth interval.
166
+ */
167
+ MinorNinth = 26,
168
+ /**
169
+ * A major ninth interval.
170
+ */
171
+ MajorNinth = 27,
172
+ /**
173
+ * An augmented ninth interval.
174
+ */
175
+ AugmentedNinth = 28,
176
+ /**
177
+ * A diminished eleventh interval.
178
+ */
179
+ DiminishedEleventh = 29,
180
+ /**
181
+ * A perfect eleventh interval.
182
+ */
183
+ PerfectEleventh = 30,
184
+ /**
185
+ * An augmented eleventh interval.
186
+ */
187
+ AugmentedEleventh = 31,
188
+ /**
189
+ * A minor thirteenth interval.
190
+ */
191
+ MinorThirteenth = 32,
192
+ /**
193
+ * A major thirteenth interval.
194
+ */
195
+ MajorThirteenth = 33,
196
+ /**
197
+ * An augmented thirteenth interval.
198
+ */
199
+ AugmentedThirteenth = 34,
200
+ /**
201
+ * A perfect octave and perfect fifth interval.
202
+ */
203
+ PerfectOctaveAndPerfectFifth = 35,
204
+ /**
205
+ * Two perfect octaves.
206
+ */
207
+ TwoPerfectOctaves = 36,
208
+ /**
209
+ * Two perfect octaves and a major third.
210
+ */
211
+ TwoPerfectOctavesAndMajorThird = 37,
212
+ /**
213
+ * Two perfect octaves and a perfect fifth.
214
+ */
215
+ TwoPerfectOctavesAndPerfectFifth = 38,
216
+ /**
217
+ * Two perfect octaves and a minor sixth.
218
+ */
219
+ TwoPerfectOctavesAndMinorSeventh = 39,
220
+ /**
221
+ * Three perfect octaves.
222
+ */
223
+ ThreePerfectOctaves = 40,
224
+ /**
225
+ * Three perfect octaves and a major second.
226
+ */
227
+ ThreePerfectOctavesAndMajorSecond = 41,
228
+ /**
229
+ * Three perfect octaves and a major third.
230
+ */
231
+ ThreePerfectOctavesAndMajorThird = 42,
232
+ /**
233
+ * Three perfect octaves and an augmented fourth.
234
+ */
235
+ ThreePerfectOctavesAndAugmentedFourth = 43,
236
+ /**
237
+ * Three perfect octaves and a perfect fifth.
238
+ */
239
+ ThreePerfectOctavesAndPerfectFifth = 44,
240
+ /**
241
+ * Three perfect octaves and a minor sixth.
242
+ */
243
+ ThreePerfectOctavesAndMinorSixth = 45,
244
+ /**
245
+ * Three perfect octaves and a minor seventh.
246
+ */
247
+ ThreePerfectOctavesAndMinorSeventh = 46,
248
+ /**
249
+ * Three perfect octaves and a major seventh.
250
+ */
251
+ ThreePerfectOctavesAndMajorSeventh = 47,
252
+ }
253
+ /**
254
+ * An enum representing the extension of a chord.
255
+ *
256
+ * Extensions are not really "special" in the sense that they do not change how the
257
+ * chord is interpreted by the system. E.g., an `add2` just adds a 2 to the chord,
258
+ * and the chord is still interpreted as a major chord.
259
+ */
260
+ export enum KordExtension {
261
+ /**
262
+ * Sus2 extension.
263
+ */
264
+ Sus2 = 0,
265
+ /**
266
+ * Sus4 extension.
267
+ */
268
+ Sus4 = 1,
269
+ /**
270
+ * Flat 11 extension.
271
+ */
272
+ Flat11 = 2,
273
+ /**
274
+ * Flat 13 extension.
275
+ */
276
+ Flat13 = 3,
277
+ /**
278
+ * Sharp 13 extension.
279
+ */
280
+ Sharp13 = 4,
281
+ /**
282
+ * Add2 extension.
283
+ */
284
+ Add2 = 5,
285
+ /**
286
+ * Add4 extension.
287
+ */
288
+ Add4 = 6,
289
+ /**
290
+ * Add6 extension.
291
+ */
292
+ Add6 = 7,
293
+ /**
294
+ * Add9 extension.
295
+ */
296
+ Add9 = 8,
297
+ /**
298
+ * Add11 extension.
299
+ */
300
+ Add11 = 9,
301
+ /**
302
+ * Add13 extension.
303
+ */
304
+ Add13 = 10,
305
+ }
306
+ /**
307
+ * The [`Chord`] wrapper.
308
+ */
309
+ export class KordChord {
310
+ free(): void;
311
+ /**
312
+ * Creates a new [`Chord`] from a frequency.
313
+ * @param {string} name
314
+ * @returns {KordChord}
315
+ */
316
+ static parse(name: string): KordChord;
317
+ /**
318
+ * Creates a new [`Chord`] from a set of [`Note`]s.
319
+ *
320
+ * The [`Note`]s should be represented as a space-separated string.
321
+ * E.g., `C E G`.
322
+ * @param {string} notes
323
+ * @returns {Array<any>}
324
+ */
325
+ static fromNotesString(notes: string): Array<any>;
326
+ /**
327
+ * Creates a new [`Chord`] from a set of [`Note`]s.
328
+ * @param {Array<any>} notes
329
+ * @returns {Array<any>}
330
+ */
331
+ static fromNotes(notes: Array<any>): Array<any>;
332
+ /**
333
+ * Returns the [`Chord`]'s friendly name.
334
+ * @returns {string}
335
+ */
336
+ name(): string;
337
+ /**
338
+ * Returns the [`Chord`]'s precise name.
339
+ * @returns {string}
340
+ */
341
+ preciseName(): string;
342
+ /**
343
+ * Returns the [`Chord`] as a string (same as `precise_name`).
344
+ * @returns {string}
345
+ */
346
+ toString(): string;
347
+ /**
348
+ * Returns the [`Chord`]'s description.
349
+ * @returns {string}
350
+ */
351
+ description(): string;
352
+ /**
353
+ * Returns the [`Chord`]'s display text.
354
+ * @returns {string}
355
+ */
356
+ display(): string;
357
+ /**
358
+ * Returns the [`Chord`]'s root note.
359
+ * @returns {string}
360
+ */
361
+ root(): string;
362
+ /**
363
+ * Returns the [`Chord`]'s slash note.
364
+ * @returns {string}
365
+ */
366
+ slash(): string;
367
+ /**
368
+ * Returns the [`Chord`]'s inversion.
369
+ * @returns {number}
370
+ */
371
+ inversion(): number;
372
+ /**
373
+ * Returns whether or not the [`Chord`] is "crunchy".
374
+ * @returns {boolean}
375
+ */
376
+ isCrunchy(): boolean;
377
+ /**
378
+ * Returns the [`Chord`]'s chord tones.
379
+ * @returns {Array<any>}
380
+ */
381
+ chord(): Array<any>;
382
+ /**
383
+ * Returns the [`Chord`]'s chord tones as a string.
384
+ * @returns {string}
385
+ */
386
+ chordString(): string;
387
+ /**
388
+ * Returns the [`Chord`]'s scale tones.
389
+ * @returns {Array<any>}
390
+ */
391
+ scale(): Array<any>;
392
+ /**
393
+ * Returns the [`Chord`]'s scale tones as a string.
394
+ * @returns {string}
395
+ */
396
+ scaleString(): string;
397
+ /**
398
+ * Returns the [`Chord`]'s modifiers.
399
+ * @returns {Array<any>}
400
+ */
401
+ modifiers(): Array<any>;
402
+ /**
403
+ * Returns the [`Chord`]'s extensions.
404
+ * @returns {Array<any>}
405
+ */
406
+ extensions(): Array<any>;
407
+ /**
408
+ * Returns a new [`Chord`] with the inversion set to the provided value.
409
+ * @param {number} inversion
410
+ * @returns {KordChord}
411
+ */
412
+ withInversion(inversion: number): KordChord;
413
+ /**
414
+ * Returns a new [`Chord`] with the slash set to the provided value.
415
+ * @param {KordNote} slash
416
+ * @returns {KordChord}
417
+ */
418
+ withSlash(slash: KordNote): KordChord;
419
+ /**
420
+ * Returns a new [`Chord`] with the octave of the root set to the provided value.
421
+ * @param {number} octave
422
+ * @returns {KordChord}
423
+ */
424
+ withOctave(octave: number): KordChord;
425
+ /**
426
+ * Returns a new [`Chord`] with the "crunchiness" set to the provided value.
427
+ * @param {boolean} is_crunchy
428
+ * @returns {KordChord}
429
+ */
430
+ withCrunchy(is_crunchy: boolean): KordChord;
431
+ /**
432
+ * Plays the [`Chord`].
433
+ * @param {number} delay
434
+ * @param {number} length
435
+ * @param {number} fade_in
436
+ * @returns {Promise<void>}
437
+ */
438
+ play(delay: number, length: number, fade_in: number): Promise<void>;
439
+ /**
440
+ * Returns the clone of the [`Chord`].
441
+ * @returns {KordChord}
442
+ */
443
+ copy(): KordChord;
444
+ /**
445
+ * Returns a new [`Chord`] with the `minor` modifier.
446
+ * @returns {KordChord}
447
+ */
448
+ minor(): KordChord;
449
+ /**
450
+ * Returns a new [`Chord`] with the `flat5` modifier.
451
+ * @returns {KordChord}
452
+ */
453
+ flat5(): KordChord;
454
+ /**
455
+ * Returns a new [`Chord`] with the `augmented` modifier.
456
+ * @returns {KordChord}
457
+ */
458
+ aug(): KordChord;
459
+ /**
460
+ * Returns a new [`Chord`] with the `maj7` modifier.
461
+ * @returns {KordChord}
462
+ */
463
+ maj7(): KordChord;
464
+ /**
465
+ * Returns a new [`Chord`] with the `dom7` modifier.
466
+ * @returns {KordChord}
467
+ */
468
+ seven(): KordChord;
469
+ /**
470
+ * Returns a new [`Chord`] with the `dom9` modifier.
471
+ * @returns {KordChord}
472
+ */
473
+ nine(): KordChord;
474
+ /**
475
+ * Returns a new [`Chord`] with the `dom11` modifier.
476
+ * @returns {KordChord}
477
+ */
478
+ eleven(): KordChord;
479
+ /**
480
+ * Returns a new [`Chord`] with the `dom13` modifier.
481
+ * @returns {KordChord}
482
+ */
483
+ thirteen(): KordChord;
484
+ /**
485
+ * Returns a new [`Chord`] with the `flat9` modifier.
486
+ * @returns {KordChord}
487
+ */
488
+ flat9(): KordChord;
489
+ /**
490
+ * Returns a new [`Chord`] with the `sharp9` modifier.
491
+ * @returns {KordChord}
492
+ */
493
+ sharp9(): KordChord;
494
+ /**
495
+ * Returns a new [`Chord`] with the `sharp11` modifier.
496
+ * @returns {KordChord}
497
+ */
498
+ sharp11(): KordChord;
499
+ /**
500
+ * Returns a new [`Chord`] with the `dim` modifier.
501
+ * @returns {KordChord}
502
+ */
503
+ dim(): KordChord;
504
+ /**
505
+ * Returns a new [`Chord`] with the `halfDim` modifier.
506
+ * @returns {KordChord}
507
+ */
508
+ halfDim(): KordChord;
509
+ /**
510
+ * Returns a new [`Chord`] with the `sus2` extension.
511
+ * @returns {KordChord}
512
+ */
513
+ sus2(): KordChord;
514
+ /**
515
+ * Returns a new [`Chord`] with the `sus4` extension.
516
+ * @returns {KordChord}
517
+ */
518
+ sus4(): KordChord;
519
+ /**
520
+ * Returns a new [`Chord`] with the `flat11` extension.
521
+ * @returns {KordChord}
522
+ */
523
+ flat11(): KordChord;
524
+ /**
525
+ * Returns a new [`Chord`] with the `flat13` extension.
526
+ * @returns {KordChord}
527
+ */
528
+ flat13(): KordChord;
529
+ /**
530
+ * Returns a new [`Chord`] with the `sharp13` extension.
531
+ * @returns {KordChord}
532
+ */
533
+ sharp13(): KordChord;
534
+ /**
535
+ * Returns a new [`Chord`] with the `add2` extension.
536
+ * @returns {KordChord}
537
+ */
538
+ add2(): KordChord;
539
+ /**
540
+ * Returns a new [`Chord`] with the `add4` extension.
541
+ * @returns {KordChord}
542
+ */
543
+ add4(): KordChord;
544
+ /**
545
+ * Returns a new [`Chord`] with the `add6` extension.
546
+ * @returns {KordChord}
547
+ */
548
+ add6(): KordChord;
549
+ /**
550
+ * Returns a new [`Chord`] with the `add9` extension.
551
+ * @returns {KordChord}
552
+ */
553
+ add9(): KordChord;
554
+ /**
555
+ * Returns a new [`Chord`] with the `add11` extension.
556
+ * @returns {KordChord}
557
+ */
558
+ add11(): KordChord;
559
+ /**
560
+ * Returns a new [`Chord`] with the `add13` extension.
561
+ * @returns {KordChord}
562
+ */
563
+ add13(): KordChord;
564
+ }
565
+ /**
566
+ * The [`Note`] wrapper.
567
+ */
568
+ export class KordNote {
569
+ free(): void;
570
+ /**
571
+ * Creates a new [`Note`] from a frequency.
572
+ * @param {string} name
573
+ * @returns {KordNote}
574
+ */
575
+ static parse(name: string): KordNote;
576
+ /**
577
+ * Returns [`Note`]s from audio data.
578
+ * @param {Float32Array} data
579
+ * @param {number} length_in_seconds
580
+ * @returns {Array<any>}
581
+ */
582
+ static fromAudio(data: Float32Array, length_in_seconds: number): Array<any>;
583
+ /**
584
+ * Returns [`Note`]s from audio data using the ML inference algorithm.
585
+ * @param {Float32Array} data
586
+ * @param {number} length_in_seconds
587
+ * @returns {Array<any>}
588
+ */
589
+ static fromAudioMl(data: Float32Array, length_in_seconds: number): Array<any>;
590
+ /**
591
+ * Returns the [`Note`]'s friendly name.
592
+ * @returns {string}
593
+ */
594
+ name(): string;
595
+ /**
596
+ * Returns the [`Note`] represented as a string (same as `name`).
597
+ * @returns {string}
598
+ */
599
+ toString(): string;
600
+ /**
601
+ * Returns the [`Note`]'s [`NamedPitch`].
602
+ * @returns {string}
603
+ */
604
+ pitch(): string;
605
+ /**
606
+ * Returns the [`Note`]'s [`Octave`].
607
+ * @returns {number}
608
+ */
609
+ octave(): number;
610
+ /**
611
+ * Returns the [`Note`]'s frequency.
612
+ * @returns {number}
613
+ */
614
+ frequency(): number;
615
+ /**
616
+ * Adds the given interval to the [`Note`], producing a new [`Note`] instance.
617
+ * @param {number} interval
618
+ * @returns {KordNote}
619
+ */
620
+ addInterval(interval: number): KordNote;
621
+ /**
622
+ * Subtracts the given interval from the [`Note`], producing a new [`Note`] instance.
623
+ * @param {number} interval
624
+ * @returns {KordNote}
625
+ */
626
+ subInterval(interval: number): KordNote;
627
+ /**
628
+ * Computes the [`Interval`] distance between the [`Note`] and the given [`Note`].
629
+ * @param {KordNote} other
630
+ * @returns {number}
631
+ */
632
+ distanceTo(other: KordNote): number;
633
+ /**
634
+ * Returns the primary (first 13) harmonic series of the [`Note`].
635
+ * @returns {Array<any>}
636
+ */
637
+ harmonicSeries(): Array<any>;
638
+ /**
639
+ * Returns the clone of the [`Note`].
640
+ * @returns {KordNote}
641
+ */
642
+ copy(): KordNote;
643
+ }
644
+ /**
645
+ * A handle to a [`Chord`] playback.
646
+ *
647
+ * Should be dropped to stop the playback, or after playback is finished.
648
+ */
649
+ export class KordPlaybackHandle {
650
+ free(): void;
651
+ }