@libraz/libcantus 1.1.0 → 1.2.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/dist/analyze/index.cjs +7 -7
- package/dist/analyze/index.d.cts +8 -8
- package/dist/analyze/index.d.ts +8 -8
- package/dist/analyze/index.js +6 -6
- package/dist/{chunk-TT6PKMPR.cjs → chunk-35NBV2FT.cjs} +16 -16
- package/dist/{chunk-TT6PKMPR.cjs.map → chunk-35NBV2FT.cjs.map} +1 -1
- package/dist/{chunk-YPB3A3EY.cjs → chunk-3R3QVKY5.cjs} +314 -285
- package/dist/chunk-3R3QVKY5.cjs.map +1 -0
- package/dist/{chunk-RVS4G4MR.cjs → chunk-76ZBTRG2.cjs} +198 -198
- package/dist/{chunk-RVS4G4MR.cjs.map → chunk-76ZBTRG2.cjs.map} +1 -1
- package/dist/{chunk-X6RJAHII.js → chunk-7KG3RTYS.js} +2 -2
- package/dist/{chunk-PQL7E5F6.js → chunk-AGOVW7U6.js} +1 -1
- package/dist/{chunk-PQL7E5F6.js.map → chunk-AGOVW7U6.js.map} +1 -1
- package/dist/{chunk-J772DL3B.cjs → chunk-CGBADIO5.cjs} +53 -53
- package/dist/{chunk-J772DL3B.cjs.map → chunk-CGBADIO5.cjs.map} +1 -1
- package/dist/{chunk-GDKE6RQW.cjs → chunk-DSMJRXCZ.cjs} +402 -401
- package/dist/chunk-DSMJRXCZ.cjs.map +1 -0
- package/dist/{chunk-DKICR7AN.js → chunk-FBH75DAY.js} +13 -12
- package/dist/{chunk-DKICR7AN.js.map → chunk-FBH75DAY.js.map} +1 -1
- package/dist/{chunk-VLE5R7PF.js → chunk-H2KJHBW4.js} +4 -4
- package/dist/{chunk-XVMJO3QF.cjs → chunk-HPVSH7SF.cjs} +237 -215
- package/dist/chunk-HPVSH7SF.cjs.map +1 -0
- package/dist/{chunk-QCXYKSZS.cjs → chunk-HWHGOVO6.cjs} +19 -19
- package/dist/{chunk-QCXYKSZS.cjs.map → chunk-HWHGOVO6.cjs.map} +1 -1
- package/dist/{chunk-HSY2VQXZ.js → chunk-HYJJ2V2I.js} +32 -10
- package/dist/chunk-HYJJ2V2I.js.map +1 -0
- package/dist/{chunk-5KW7DNCJ.cjs → chunk-J7FHVZII.cjs} +445 -445
- package/dist/{chunk-5KW7DNCJ.cjs.map → chunk-J7FHVZII.cjs.map} +1 -1
- package/dist/{chunk-AWEMD747.js → chunk-M5RYMAFI.js} +3 -3
- package/dist/{chunk-H66ARFU5.js → chunk-NB25P3EH.js} +3 -3
- package/dist/{chunk-57WB2EDF.js → chunk-NFJ4P6ZZ.js} +3 -3
- package/dist/{chunk-5JJ6EHEZ.cjs → chunk-NM7UAMC3.cjs} +62 -62
- package/dist/{chunk-5JJ6EHEZ.cjs.map → chunk-NM7UAMC3.cjs.map} +1 -1
- package/dist/{chunk-R7B5N2JK.cjs → chunk-PM4XJE2Y.cjs} +47 -47
- package/dist/{chunk-R7B5N2JK.cjs.map → chunk-PM4XJE2Y.cjs.map} +1 -1
- package/dist/{chunk-7GOKQJTQ.js → chunk-PUKJP2Z5.js} +2 -2
- package/dist/{chunk-R5VUXQMP.js → chunk-Q6LFSAKV.js} +7 -7
- package/dist/{chunk-FPBZFNCD.js → chunk-RFIBF2RR.js} +47 -18
- package/dist/{chunk-FPBZFNCD.js.map → chunk-RFIBF2RR.js.map} +1 -1
- package/dist/{chunk-XKSO2V5I.cjs → chunk-S5BKZZGM.cjs} +1 -1
- package/dist/{chunk-XKSO2V5I.cjs.map → chunk-S5BKZZGM.cjs.map} +1 -1
- package/dist/{chunk-Q6R3QAZD.cjs → chunk-SGLEQVJH.cjs} +332 -332
- package/dist/{chunk-Q6R3QAZD.cjs.map → chunk-SGLEQVJH.cjs.map} +1 -1
- package/dist/{chunk-HOHFYGKW.js → chunk-UMWZ4ZET.js} +2 -2
- package/dist/{coerce-wwdELNYS.d.ts → coerce-DP0vYu-x.d.ts} +77 -1
- package/dist/{coerce-CJlgULrQ.d.cts → coerce-DRERzdve.d.cts} +77 -1
- package/dist/core/index.cjs +5 -5
- package/dist/core/index.d.cts +2 -2
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.js +4 -4
- package/dist/generate/index.cjs +8 -8
- package/dist/generate/index.d.cts +8 -8
- package/dist/generate/index.d.ts +8 -8
- package/dist/generate/index.js +7 -7
- package/dist/{index-BaoKVVhE.d.cts → index-B9QLziDe.d.cts} +2 -2
- package/dist/{index-B3WCj_Hm.d.cts → index-BBWNZS0f.d.cts} +2 -2
- package/dist/{index-CnHQgqNh.d.ts → index-BHIUyjhZ.d.ts} +2 -2
- package/dist/{index-DpC-mDlV.d.ts → index-BJgP97N1.d.ts} +4 -4
- package/dist/{index-CBCP84rv.d.cts → index-BL5N2Oyz.d.cts} +1 -1
- package/dist/{index-D_hzxD8w.d.cts → index-BMweUlm5.d.cts} +3 -0
- package/dist/{index-BzLNkmA7.d.cts → index-BNSM-DSk.d.cts} +4 -4
- package/dist/{index-BUtIf2go.d.ts → index-BRMbPkHE.d.ts} +25 -5
- package/dist/{index-BpWOhkkE.d.ts → index-CJBBiAmU.d.ts} +2 -2
- package/dist/{index-Ci3xyows.d.ts → index-CL4b4gUQ.d.ts} +3 -0
- package/dist/{index-DTsKaPaC.d.cts → index-DGCNKAUr.d.cts} +25 -5
- package/dist/{index-CnIdP4EZ.d.ts → index-Dw2DP7vm.d.ts} +1 -1
- package/dist/index.cjs +13 -13
- package/dist/index.d.cts +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.js +12 -12
- package/dist/{masks-O73Rhj5d.d.ts → masks-Cc7-MzzY.d.ts} +1 -1
- package/dist/{masks-C8TWLFIi.d.cts → masks-pADfTOiD.d.cts} +1 -1
- package/dist/model/index.cjs +12 -12
- package/dist/model/index.d.cts +16 -15
- package/dist/model/index.d.ts +16 -15
- package/dist/model/index.js +11 -11
- package/dist/theory/index.cjs +5 -5
- package/dist/theory/index.d.cts +7 -7
- package/dist/theory/index.d.ts +7 -7
- package/dist/theory/index.js +4 -4
- package/package.json +6 -5
- package/dist/chunk-GDKE6RQW.cjs.map +0 -1
- package/dist/chunk-HSY2VQXZ.js.map +0 -1
- package/dist/chunk-XVMJO3QF.cjs.map +0 -1
- package/dist/chunk-YPB3A3EY.cjs.map +0 -1
- /package/dist/{chunk-X6RJAHII.js.map → chunk-7KG3RTYS.js.map} +0 -0
- /package/dist/{chunk-VLE5R7PF.js.map → chunk-H2KJHBW4.js.map} +0 -0
- /package/dist/{chunk-AWEMD747.js.map → chunk-M5RYMAFI.js.map} +0 -0
- /package/dist/{chunk-H66ARFU5.js.map → chunk-NB25P3EH.js.map} +0 -0
- /package/dist/{chunk-57WB2EDF.js.map → chunk-NFJ4P6ZZ.js.map} +0 -0
- /package/dist/{chunk-7GOKQJTQ.js.map → chunk-PUKJP2Z5.js.map} +0 -0
- /package/dist/{chunk-R5VUXQMP.js.map → chunk-Q6LFSAKV.js.map} +0 -0
- /package/dist/{chunk-HOHFYGKW.js.map → chunk-UMWZ4ZET.js.map} +0 -0
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
var
|
|
17
|
+
var _chunkHPVSH7SFcjs = require('./chunk-HPVSH7SF.cjs');
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
@@ -38,7 +38,7 @@ var _chunkXVMJO3QFcjs = require('./chunk-XVMJO3QF.cjs');
|
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
|
|
41
|
-
var
|
|
41
|
+
var _chunkNM7UAMC3cjs = require('./chunk-NM7UAMC3.cjs');
|
|
42
42
|
|
|
43
43
|
|
|
44
44
|
|
|
@@ -69,7 +69,7 @@ var _chunk5JJ6EHEZcjs = require('./chunk-5JJ6EHEZ.cjs');
|
|
|
69
69
|
|
|
70
70
|
|
|
71
71
|
|
|
72
|
-
var
|
|
72
|
+
var _chunkJ7FHVZIIcjs = require('./chunk-J7FHVZII.cjs');
|
|
73
73
|
|
|
74
74
|
|
|
75
75
|
|
|
@@ -97,7 +97,7 @@ var _chunk5KW7DNCJcjs = require('./chunk-5KW7DNCJ.cjs');
|
|
|
97
97
|
|
|
98
98
|
|
|
99
99
|
|
|
100
|
-
var
|
|
100
|
+
var _chunkSGLEQVJHcjs = require('./chunk-SGLEQVJH.cjs');
|
|
101
101
|
|
|
102
102
|
|
|
103
103
|
|
|
@@ -110,10 +110,10 @@ var _chunkQ6R3QAZDcjs = require('./chunk-Q6R3QAZD.cjs');
|
|
|
110
110
|
|
|
111
111
|
|
|
112
112
|
|
|
113
|
-
var
|
|
113
|
+
var _chunkCGBADIO5cjs = require('./chunk-CGBADIO5.cjs');
|
|
114
114
|
|
|
115
115
|
|
|
116
|
-
var
|
|
116
|
+
var _chunk35NBV2FTcjs = require('./chunk-35NBV2FT.cjs');
|
|
117
117
|
|
|
118
118
|
|
|
119
119
|
|
|
@@ -128,14 +128,14 @@ var _chunkTT6PKMPRcjs = require('./chunk-TT6PKMPR.cjs');
|
|
|
128
128
|
|
|
129
129
|
|
|
130
130
|
|
|
131
|
-
var
|
|
131
|
+
var _chunk76ZBTRG2cjs = require('./chunk-76ZBTRG2.cjs');
|
|
132
132
|
|
|
133
133
|
|
|
134
134
|
|
|
135
135
|
|
|
136
136
|
|
|
137
137
|
|
|
138
|
-
var
|
|
138
|
+
var _chunkPM4XJE2Ycjs = require('./chunk-PM4XJE2Y.cjs');
|
|
139
139
|
|
|
140
140
|
|
|
141
141
|
|
|
@@ -191,7 +191,7 @@ var _chunkR7B5N2JKcjs = require('./chunk-R7B5N2JK.cjs');
|
|
|
191
191
|
|
|
192
192
|
|
|
193
193
|
|
|
194
|
-
var
|
|
194
|
+
var _chunk3R3QVKY5cjs = require('./chunk-3R3QVKY5.cjs');
|
|
195
195
|
|
|
196
196
|
|
|
197
197
|
|
|
@@ -235,7 +235,7 @@ var _chunkYPB3A3EYcjs = require('./chunk-YPB3A3EY.cjs');
|
|
|
235
235
|
|
|
236
236
|
|
|
237
237
|
|
|
238
|
-
var
|
|
238
|
+
var _chunkS5BKZZGMcjs = require('./chunk-S5BKZZGM.cjs');
|
|
239
239
|
|
|
240
240
|
// src/model/interval.ts
|
|
241
241
|
var INVERSION_SUM = 9;
|
|
@@ -304,7 +304,7 @@ var Interval = class _Interval {
|
|
|
304
304
|
* @throws If the number, quality, and span do not describe the same interval.
|
|
305
305
|
*/
|
|
306
306
|
static fromData(data) {
|
|
307
|
-
const checked =
|
|
307
|
+
const checked = _chunkS5BKZZGMcjs.toSpelledInterval.call(void 0, data);
|
|
308
308
|
return new _Interval(checked.number, checked.quality, checked.semitones, checked.descending);
|
|
309
309
|
}
|
|
310
310
|
/**
|
|
@@ -328,7 +328,7 @@ var Interval = class _Interval {
|
|
|
328
328
|
* interval field read on every keystroke.
|
|
329
329
|
*/
|
|
330
330
|
static parse(name) {
|
|
331
|
-
return
|
|
331
|
+
return _chunkS5BKZZGMcjs.unwrapParse.call(void 0, _Interval.tryParse(name));
|
|
332
332
|
}
|
|
333
333
|
/**
|
|
334
334
|
* Parse an interval name, reporting failure instead of throwing it.
|
|
@@ -347,7 +347,7 @@ var Interval = class _Interval {
|
|
|
347
347
|
* ```
|
|
348
348
|
*/
|
|
349
349
|
static tryParse(name) {
|
|
350
|
-
const parsed =
|
|
350
|
+
const parsed = _chunkS5BKZZGMcjs.tryParseInterval.call(void 0, name);
|
|
351
351
|
return parsed.ok ? { ok: true, value: _Interval.fromData(parsed.value) } : parsed;
|
|
352
352
|
}
|
|
353
353
|
/** Diatonic size: 1 = unison, 2 = second, ... 8 = octave, and beyond. */
|
|
@@ -403,7 +403,7 @@ var Interval = class _Interval {
|
|
|
403
403
|
invert() {
|
|
404
404
|
const numberValue = INVERSION_SUM - simpleDegree(this.#number);
|
|
405
405
|
const quality = invertQuality(this.#quality);
|
|
406
|
-
return _Interval.of(numberValue, quality,
|
|
406
|
+
return _Interval.of(numberValue, quality, _chunkS5BKZZGMcjs.intervalSemitones.call(void 0, numberValue, quality));
|
|
407
407
|
}
|
|
408
408
|
/**
|
|
409
409
|
* The same interval taken in the opposite direction.
|
|
@@ -435,7 +435,7 @@ var Interval = class _Interval {
|
|
|
435
435
|
* @returns True if the interval is consonant in that context.
|
|
436
436
|
*/
|
|
437
437
|
isConsonant(twoVoice = true) {
|
|
438
|
-
return
|
|
438
|
+
return _chunkS5BKZZGMcjs.isConsonantInterval.call(void 0, this.#semitones, twoVoice);
|
|
439
439
|
}
|
|
440
440
|
/**
|
|
441
441
|
* Whether another interval is spelled identically.
|
|
@@ -491,13 +491,13 @@ function describeShape(value) {
|
|
|
491
491
|
}
|
|
492
492
|
function assertDataObject(value, name) {
|
|
493
493
|
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
494
|
-
throw new (0,
|
|
494
|
+
throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)(`${name} must be an object; received ${describeShape(value)}`);
|
|
495
495
|
}
|
|
496
496
|
return value;
|
|
497
497
|
}
|
|
498
498
|
function assertDataArray(value, name) {
|
|
499
499
|
if (!Array.isArray(value)) {
|
|
500
|
-
throw new (0,
|
|
500
|
+
throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)(`${name} must be an array; received ${describeShape(value)}`);
|
|
501
501
|
}
|
|
502
502
|
return value;
|
|
503
503
|
}
|
|
@@ -509,14 +509,14 @@ function assertDataObjects(value, name) {
|
|
|
509
509
|
return items;
|
|
510
510
|
}
|
|
511
511
|
function assertNoteEventArray(notes, name, options) {
|
|
512
|
-
return
|
|
512
|
+
return _chunkS5BKZZGMcjs.assertNoteEvents.call(void 0, assertDataArray(notes, name), name, options);
|
|
513
513
|
}
|
|
514
514
|
function assertKeyArgument(value, name) {
|
|
515
515
|
if (value === void 0 || typeof value === "string" || isKeyShaped(value)) {
|
|
516
516
|
return;
|
|
517
517
|
}
|
|
518
518
|
const received = value === null ? "null" : typeof value === "object" ? "an object" : `a ${typeof value}`;
|
|
519
|
-
throw new (0,
|
|
519
|
+
throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)(
|
|
520
520
|
`${name} must be a Key; received ${received}. A method that also takes options takes them after the key, not in its place`
|
|
521
521
|
);
|
|
522
522
|
}
|
|
@@ -554,7 +554,7 @@ function copyNoteEvent(note) {
|
|
|
554
554
|
}
|
|
555
555
|
function copyTimeSignature(ts, name) {
|
|
556
556
|
assertDataObject(ts, _nullishCoalesce(name, () => ( "time signature")));
|
|
557
|
-
|
|
557
|
+
_chunkS5BKZZGMcjs.assertTimeSignature.call(void 0, ts, name);
|
|
558
558
|
const copy = { numerator: ts.numerator, denominator: ts.denominator };
|
|
559
559
|
if (ts.grouping !== void 0) {
|
|
560
560
|
copy.grouping = [...ts.grouping];
|
|
@@ -567,19 +567,19 @@ function copyPlain(value, name) {
|
|
|
567
567
|
}
|
|
568
568
|
function copyPlainAt(value, name, seen, depth) {
|
|
569
569
|
if (typeof value === "number") {
|
|
570
|
-
return
|
|
570
|
+
return _chunkS5BKZZGMcjs.assertFiniteNumber.call(void 0, value, name);
|
|
571
571
|
}
|
|
572
572
|
if (typeof value === "function" || typeof value === "symbol" || typeof value === "bigint") {
|
|
573
|
-
throw new (0,
|
|
573
|
+
throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)(`${name} must be plain data; received ${typeof value}`);
|
|
574
574
|
}
|
|
575
575
|
if (typeof value !== "object" || value === null) {
|
|
576
576
|
return value;
|
|
577
577
|
}
|
|
578
578
|
if (seen.has(value)) {
|
|
579
|
-
throw new (0,
|
|
579
|
+
throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)(`${name} must be plain data; received a value referring to itself`);
|
|
580
580
|
}
|
|
581
581
|
if (depth >= MAX_PLAIN_DEPTH) {
|
|
582
|
-
throw new (0,
|
|
582
|
+
throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)(
|
|
583
583
|
`${name} must be plain data; received a value nested more than ${MAX_PLAIN_DEPTH} levels deep`
|
|
584
584
|
);
|
|
585
585
|
}
|
|
@@ -617,7 +617,7 @@ function samePlain(value, other) {
|
|
|
617
617
|
function copyNote(data) {
|
|
618
618
|
assertDataObject(data, "note data");
|
|
619
619
|
if (!Number.isInteger(data.letter) || data.letter < 0 || data.letter > 6) {
|
|
620
|
-
throw new (0,
|
|
620
|
+
throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)(
|
|
621
621
|
`note letter must be an integer in [0, 6]; received ${data.letter}`
|
|
622
622
|
);
|
|
623
623
|
}
|
|
@@ -625,7 +625,7 @@ function copyNote(data) {
|
|
|
625
625
|
if (data.octave !== void 0) {
|
|
626
626
|
copy.octave = data.octave;
|
|
627
627
|
}
|
|
628
|
-
|
|
628
|
+
_chunkS5BKZZGMcjs.noteToPitchClass.call(void 0, copy);
|
|
629
629
|
return copy;
|
|
630
630
|
}
|
|
631
631
|
var NATURAL_LETTER = /^[A-G]$/;
|
|
@@ -634,11 +634,11 @@ function letterNumberOf(letter) {
|
|
|
634
634
|
return letter;
|
|
635
635
|
}
|
|
636
636
|
if (!NATURAL_LETTER.test(letter)) {
|
|
637
|
-
throw new (0,
|
|
638
|
-
`Note.of takes a letter number 0..6 or a bare letter name 'C'..'B'; received ${
|
|
637
|
+
throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)(
|
|
638
|
+
`Note.of takes a letter number 0..6 or a bare letter name 'C'..'B'; received ${_chunkS5BKZZGMcjs.describeRejected.call(void 0, letter)}. Use Note.parse(${_chunkS5BKZZGMcjs.describeRejected.call(void 0, letter)}) to read a note name with an accidental or an octave.`
|
|
639
639
|
);
|
|
640
640
|
}
|
|
641
|
-
return
|
|
641
|
+
return _chunkS5BKZZGMcjs.unwrapParse.call(void 0, _chunkS5BKZZGMcjs.tryParseNote.call(void 0, letter)).letter;
|
|
642
642
|
}
|
|
643
643
|
var DIMINISHED_SECOND = {
|
|
644
644
|
number: 2,
|
|
@@ -651,7 +651,7 @@ var DESCENDING_DIMINISHED_SECOND = {
|
|
|
651
651
|
descending: true
|
|
652
652
|
};
|
|
653
653
|
function soundingOrder(note) {
|
|
654
|
-
return note.octave === void 0 ?
|
|
654
|
+
return note.octave === void 0 ? _chunkS5BKZZGMcjs.noteToPitchClass.call(void 0, note) : _chunkS5BKZZGMcjs.noteToMidi.call(void 0, note);
|
|
655
655
|
}
|
|
656
656
|
var Note = class _Note {
|
|
657
657
|
#data;
|
|
@@ -715,7 +715,7 @@ var Note = class _Note {
|
|
|
715
715
|
* ```
|
|
716
716
|
*/
|
|
717
717
|
static parse(text, opts) {
|
|
718
|
-
return
|
|
718
|
+
return _chunkS5BKZZGMcjs.unwrapParse.call(void 0, _Note.tryParse(text, opts));
|
|
719
719
|
}
|
|
720
720
|
/**
|
|
721
721
|
* Parse a note name, reporting failure instead of throwing it.
|
|
@@ -736,7 +736,7 @@ var Note = class _Note {
|
|
|
736
736
|
* ```
|
|
737
737
|
*/
|
|
738
738
|
static tryParse(name, opts) {
|
|
739
|
-
const parsed =
|
|
739
|
+
const parsed = _chunkS5BKZZGMcjs.tryParseNote.call(void 0, name, opts);
|
|
740
740
|
return parsed.ok ? { ok: true, value: new _Note(parsed.value) } : parsed;
|
|
741
741
|
}
|
|
742
742
|
/**
|
|
@@ -747,7 +747,7 @@ var Note = class _Note {
|
|
|
747
747
|
* @returns The spelled note, with octave.
|
|
748
748
|
*/
|
|
749
749
|
static fromMidi(midi, spelling = "sharp") {
|
|
750
|
-
return new _Note(
|
|
750
|
+
return new _Note(_chunkS5BKZZGMcjs.midiToNote.call(void 0, midi, spelling));
|
|
751
751
|
}
|
|
752
752
|
/**
|
|
753
753
|
* Wrap an existing plain note object.
|
|
@@ -764,7 +764,7 @@ var Note = class _Note {
|
|
|
764
764
|
* `'Bb'`. Use {@link Note.format} to write it in another notation system.
|
|
765
765
|
*/
|
|
766
766
|
get name() {
|
|
767
|
-
return
|
|
767
|
+
return _chunkS5BKZZGMcjs.formatNote.call(void 0, this.#data);
|
|
768
768
|
}
|
|
769
769
|
/**
|
|
770
770
|
* The note name written in a notation system.
|
|
@@ -783,11 +783,11 @@ var Note = class _Note {
|
|
|
783
783
|
* ```
|
|
784
784
|
*/
|
|
785
785
|
format(opts) {
|
|
786
|
-
return
|
|
786
|
+
return _chunkS5BKZZGMcjs.formatNote.call(void 0, this.#data, opts);
|
|
787
787
|
}
|
|
788
788
|
/** The pitch class (0..11), ignoring octave. */
|
|
789
789
|
get pitchClass() {
|
|
790
|
-
return
|
|
790
|
+
return _chunkS5BKZZGMcjs.noteToPitchClass.call(void 0, this.#data);
|
|
791
791
|
}
|
|
792
792
|
/**
|
|
793
793
|
* The MIDI number (middle C = C4 = 60).
|
|
@@ -796,9 +796,9 @@ var Note = class _Note {
|
|
|
796
796
|
*/
|
|
797
797
|
get midi() {
|
|
798
798
|
if (this.#data.octave === void 0) {
|
|
799
|
-
throw new (0,
|
|
799
|
+
throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)(`note ${this.name} has no octave, so it has no MIDI number`);
|
|
800
800
|
}
|
|
801
|
-
return
|
|
801
|
+
return _chunkS5BKZZGMcjs.noteToMidi.call(void 0, this.#data);
|
|
802
802
|
}
|
|
803
803
|
/** The diatonic letter number: 0..6 for C..B. */
|
|
804
804
|
get letter() {
|
|
@@ -840,7 +840,7 @@ var Note = class _Note {
|
|
|
840
840
|
* ```
|
|
841
841
|
*/
|
|
842
842
|
frequency(tuning) {
|
|
843
|
-
return
|
|
843
|
+
return _chunkNM7UAMC3cjs.frequencyOf.call(void 0, this.midi, tuning);
|
|
844
844
|
}
|
|
845
845
|
/**
|
|
846
846
|
* Transpose by a signed number of semitones, keeping the spelling.
|
|
@@ -866,7 +866,7 @@ var Note = class _Note {
|
|
|
866
866
|
if (semitones === 0 && _optionalChain([opts, 'optionalAccess', _ => _.spelling]) === void 0) {
|
|
867
867
|
return new _Note(this.#data);
|
|
868
868
|
}
|
|
869
|
-
return new _Note(
|
|
869
|
+
return new _Note(_chunkS5BKZZGMcjs.transposeNote.call(void 0, this.#data, semitones, opts));
|
|
870
870
|
}
|
|
871
871
|
/**
|
|
872
872
|
* The spelled interval from this note to another.
|
|
@@ -875,7 +875,7 @@ var Note = class _Note {
|
|
|
875
875
|
* @returns The interval, which {@link Interval.toJSON} unwraps to plain data.
|
|
876
876
|
*/
|
|
877
877
|
intervalTo(other) {
|
|
878
|
-
return Interval.fromData(
|
|
878
|
+
return Interval.fromData(_chunkS5BKZZGMcjs.spelledInterval.call(void 0, this.#data, other.data));
|
|
879
879
|
}
|
|
880
880
|
/**
|
|
881
881
|
* Transpose by a spelled interval, keeping the spelling the interval names.
|
|
@@ -896,7 +896,7 @@ var Note = class _Note {
|
|
|
896
896
|
* ```
|
|
897
897
|
*/
|
|
898
898
|
transposeBy(interval) {
|
|
899
|
-
return new _Note(
|
|
899
|
+
return new _Note(_chunkS5BKZZGMcjs.transposeByInterval.call(void 0, this.#data, _chunkS5BKZZGMcjs.toSpelledInterval.call(void 0, interval)));
|
|
900
900
|
}
|
|
901
901
|
/**
|
|
902
902
|
* The same spelled note in another octave.
|
|
@@ -945,7 +945,7 @@ var Note = class _Note {
|
|
|
945
945
|
* ```
|
|
946
946
|
*/
|
|
947
947
|
forInstrument(instrument) {
|
|
948
|
-
return new _Note(
|
|
948
|
+
return new _Note(_chunk76ZBTRG2cjs.toWrittenPitch.call(void 0, this.#data, instrument));
|
|
949
949
|
}
|
|
950
950
|
/**
|
|
951
951
|
* The other ways this note can be spelled: the same sounding pitch written on
|
|
@@ -966,7 +966,7 @@ var Note = class _Note {
|
|
|
966
966
|
* ```
|
|
967
967
|
*/
|
|
968
968
|
enharmonic() {
|
|
969
|
-
return [DIMINISHED_SECOND, DESCENDING_DIMINISHED_SECOND].map((interval) =>
|
|
969
|
+
return [DIMINISHED_SECOND, DESCENDING_DIMINISHED_SECOND].map((interval) => _chunkS5BKZZGMcjs.transposeByInterval.call(void 0, this.#data, interval)).filter((note) => Math.abs(note.alter) <= _chunkS5BKZZGMcjs.MAX_NAME_ACCIDENTALS).map((note) => new _Note(note));
|
|
970
970
|
}
|
|
971
971
|
/**
|
|
972
972
|
* The scale degree this note occupies in a key, counted from 1 at the tonic.
|
|
@@ -987,7 +987,7 @@ var Note = class _Note {
|
|
|
987
987
|
* ```
|
|
988
988
|
*/
|
|
989
989
|
degreeIn(key) {
|
|
990
|
-
const degree =
|
|
990
|
+
const degree = _chunk3R3QVKY5cjs.pitchToScaleDegree.call(void 0, this.pitchClass, key);
|
|
991
991
|
return degree === -1 ? null : degree;
|
|
992
992
|
}
|
|
993
993
|
/**
|
|
@@ -1068,8 +1068,8 @@ var Note = class _Note {
|
|
|
1068
1068
|
function copySegment(segment) {
|
|
1069
1069
|
assertDataObject(segment, "timeline segment");
|
|
1070
1070
|
return {
|
|
1071
|
-
startBeat:
|
|
1072
|
-
endBeat:
|
|
1071
|
+
startBeat: _chunkS5BKZZGMcjs.assertFiniteNumber.call(void 0, segment.startBeat, "timeline segment startBeat"),
|
|
1072
|
+
endBeat: _chunkS5BKZZGMcjs.assertFiniteNumber.call(void 0, segment.endBeat, "timeline segment endBeat"),
|
|
1073
1073
|
// The chord is checked by the same boundary every other chord crosses, so a
|
|
1074
1074
|
// root of 25 or an interval of NaN is refused or reduced here rather than
|
|
1075
1075
|
// surfacing wherever the number is finally used.
|
|
@@ -1079,12 +1079,12 @@ function copySegment(segment) {
|
|
|
1079
1079
|
function copyKeyRegion(region) {
|
|
1080
1080
|
assertDataObject(region, "key region");
|
|
1081
1081
|
const copy = {
|
|
1082
|
-
startBeat:
|
|
1083
|
-
endBeat:
|
|
1082
|
+
startBeat: _chunkS5BKZZGMcjs.assertFiniteNumber.call(void 0, region.startBeat, "key region startBeat"),
|
|
1083
|
+
endBeat: _chunkS5BKZZGMcjs.assertFiniteNumber.call(void 0, region.endBeat, "key region endBeat"),
|
|
1084
1084
|
// Read through the key itself, so a tonic that does not spell the region's
|
|
1085
1085
|
// own root is refused here rather than spelling later notes wrongly.
|
|
1086
1086
|
key: keyIdentity(toKey(region.key)),
|
|
1087
|
-
confidence:
|
|
1087
|
+
confidence: _chunkS5BKZZGMcjs.assertFiniteNumber.call(void 0, region.confidence, "key region confidence")
|
|
1088
1088
|
};
|
|
1089
1089
|
if (region.modulation !== void 0) {
|
|
1090
1090
|
copy.modulation = region.modulation;
|
|
@@ -1105,12 +1105,12 @@ function copyConfidence(confidence, segments) {
|
|
|
1105
1105
|
}
|
|
1106
1106
|
assertDataArray(confidence, "timeline segmentConfidence");
|
|
1107
1107
|
if (confidence.length !== segments) {
|
|
1108
|
-
throw new (0,
|
|
1108
|
+
throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)(
|
|
1109
1109
|
`timeline segmentConfidence must hold one value per segment; received ${confidence.length} for ${segments}`
|
|
1110
1110
|
);
|
|
1111
1111
|
}
|
|
1112
1112
|
return confidence.map(
|
|
1113
|
-
(value, index) =>
|
|
1113
|
+
(value, index) => _chunkS5BKZZGMcjs.assertRange.call(void 0, value, 0, 1, `timeline segmentConfidence[${index}]`)
|
|
1114
1114
|
);
|
|
1115
1115
|
}
|
|
1116
1116
|
function clipSpan(span, fromBeat, toBeat) {
|
|
@@ -1136,7 +1136,7 @@ var Timeline = class _Timeline {
|
|
|
1136
1136
|
this.#segments = Object.freeze(
|
|
1137
1137
|
assertDataArray(data.segments, "timeline segments").map(copySegment)
|
|
1138
1138
|
);
|
|
1139
|
-
this.#totalBeats =
|
|
1139
|
+
this.#totalBeats = _chunkS5BKZZGMcjs.assertRange.call(void 0,
|
|
1140
1140
|
data.totalBeats,
|
|
1141
1141
|
0,
|
|
1142
1142
|
Number.MAX_SAFE_INTEGER,
|
|
@@ -1160,7 +1160,7 @@ var Timeline = class _Timeline {
|
|
|
1160
1160
|
* @returns The timeline.
|
|
1161
1161
|
*/
|
|
1162
1162
|
static fromChords(spans, totalBeats, key) {
|
|
1163
|
-
const timeline =
|
|
1163
|
+
const timeline = _chunkSGLEQVJHcjs.chordTimelineFromChords.call(void 0, spans, totalBeats);
|
|
1164
1164
|
const data = { segments: timeline.segments, totalBeats };
|
|
1165
1165
|
if (key !== void 0) {
|
|
1166
1166
|
data.keys = [
|
|
@@ -1184,7 +1184,7 @@ var Timeline = class _Timeline {
|
|
|
1184
1184
|
* @returns The inferred timeline, carrying the key regions the analysis found.
|
|
1185
1185
|
*/
|
|
1186
1186
|
static fromNotes(notes, opts) {
|
|
1187
|
-
const { timeline, keys, segmentConfidence } =
|
|
1187
|
+
const { timeline, keys, segmentConfidence } = _chunkSGLEQVJHcjs.chordTimelineFromNotes.call(void 0, notes, opts);
|
|
1188
1188
|
const totalBeats = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _5 => _5.totalBeats]), () => ( spanEnd(timeline.segments, keys)));
|
|
1189
1189
|
return new _Timeline({ segments: timeline.segments, totalBeats, keys, segmentConfidence });
|
|
1190
1190
|
}
|
|
@@ -1203,9 +1203,9 @@ var Timeline = class _Timeline {
|
|
|
1203
1203
|
* @throws If `beatsEach` is not a positive finite number of beats.
|
|
1204
1204
|
*/
|
|
1205
1205
|
static fromProgression(progression, beatsEach) {
|
|
1206
|
-
|
|
1206
|
+
_chunkS5BKZZGMcjs.assertRange.call(void 0, beatsEach, Number.MIN_VALUE, Number.MAX_SAFE_INTEGER, "timeline beatsEach");
|
|
1207
1207
|
const chords = progression.chords;
|
|
1208
|
-
const spans = chords.map((chord, index) =>
|
|
1208
|
+
const spans = chords.map((chord, index) => _chunk3R3QVKY5cjs.spanFromChord.call(void 0, chord.data, index * beatsEach));
|
|
1209
1209
|
const totalBeats = chords.length * beatsEach;
|
|
1210
1210
|
const key = progression.key;
|
|
1211
1211
|
return key === void 0 ? _Timeline.fromChords(spans, totalBeats) : _Timeline.fromChords(spans, totalBeats, key);
|
|
@@ -1231,7 +1231,7 @@ var Timeline = class _Timeline {
|
|
|
1231
1231
|
* @throws If `beat` is not finite.
|
|
1232
1232
|
*/
|
|
1233
1233
|
at(beat) {
|
|
1234
|
-
const chord =
|
|
1234
|
+
const chord = _chunkSGLEQVJHcjs.chordAtBeat.call(void 0, this.#segments, beat);
|
|
1235
1235
|
if (chord === null) {
|
|
1236
1236
|
return null;
|
|
1237
1237
|
}
|
|
@@ -1248,7 +1248,7 @@ var Timeline = class _Timeline {
|
|
|
1248
1248
|
}
|
|
1249
1249
|
/** The key held longest across the span, when the analysis found one. */
|
|
1250
1250
|
get key() {
|
|
1251
|
-
const prevailing =
|
|
1251
|
+
const prevailing = _chunkSGLEQVJHcjs.prevailingKeyOf.call(void 0, this.#keys);
|
|
1252
1252
|
return prevailing === null ? void 0 : toKey(prevailing);
|
|
1253
1253
|
}
|
|
1254
1254
|
/**
|
|
@@ -1320,7 +1320,7 @@ var Timeline = class _Timeline {
|
|
|
1320
1320
|
* @throws If the timeline carries no key region to read the chords against.
|
|
1321
1321
|
*/
|
|
1322
1322
|
reduce(opts) {
|
|
1323
|
-
return
|
|
1323
|
+
return _chunkHPVSH7SFcjs.reduceProgression.call(void 0, this.chordTimeline, this.#keyContext(), opts);
|
|
1324
1324
|
}
|
|
1325
1325
|
/**
|
|
1326
1326
|
* The cadences the harmony arrives at.
|
|
@@ -1333,7 +1333,7 @@ var Timeline = class _Timeline {
|
|
|
1333
1333
|
* @throws If the timeline carries no key region to read the chords against.
|
|
1334
1334
|
*/
|
|
1335
1335
|
cadences() {
|
|
1336
|
-
return
|
|
1336
|
+
return _chunkSGLEQVJHcjs.detectCadences.call(void 0, this.chordTimeline, this.#keyContext());
|
|
1337
1337
|
}
|
|
1338
1338
|
/**
|
|
1339
1339
|
* The keys the chords themselves imply, in time order.
|
|
@@ -1362,7 +1362,7 @@ var Timeline = class _Timeline {
|
|
|
1362
1362
|
* ```
|
|
1363
1363
|
*/
|
|
1364
1364
|
modulations(opts) {
|
|
1365
|
-
return
|
|
1365
|
+
return _chunkSGLEQVJHcjs.detectModulations.call(void 0, this.#copySegments(), {
|
|
1366
1366
|
totalBeats: this.#totalBeats,
|
|
1367
1367
|
...opts
|
|
1368
1368
|
}).map(copyKeyRegion);
|
|
@@ -1380,12 +1380,12 @@ var Timeline = class _Timeline {
|
|
|
1380
1380
|
*/
|
|
1381
1381
|
roman(key, opts) {
|
|
1382
1382
|
assertKeyArgument(key, "timeline key");
|
|
1383
|
-
const given = key === void 0 ? void 0 :
|
|
1383
|
+
const given = key === void 0 ? void 0 : _chunk3R3QVKY5cjs.resolveKey.call(void 0, key);
|
|
1384
1384
|
const keyAt = given === void 0 ? this.#resolvedKeyAt() : () => given;
|
|
1385
1385
|
return this.#segments.map((segment) => ({
|
|
1386
1386
|
startBeat: segment.startBeat,
|
|
1387
1387
|
endBeat: segment.endBeat,
|
|
1388
|
-
roman:
|
|
1388
|
+
roman: _chunkSGLEQVJHcjs.chordToRoman.call(void 0, segment.chord, keyAt(segment.startBeat), opts)
|
|
1389
1389
|
}));
|
|
1390
1390
|
}
|
|
1391
1391
|
/**
|
|
@@ -1402,10 +1402,10 @@ var Timeline = class _Timeline {
|
|
|
1402
1402
|
* @throws If either beat is not finite, or `toBeat` precedes `fromBeat`.
|
|
1403
1403
|
*/
|
|
1404
1404
|
slice(fromBeat, toBeat) {
|
|
1405
|
-
|
|
1406
|
-
|
|
1405
|
+
_chunkS5BKZZGMcjs.assertFiniteNumber.call(void 0, fromBeat, "timeline slice fromBeat");
|
|
1406
|
+
_chunkS5BKZZGMcjs.assertFiniteNumber.call(void 0, toBeat, "timeline slice toBeat");
|
|
1407
1407
|
if (toBeat < fromBeat) {
|
|
1408
|
-
throw new (0,
|
|
1408
|
+
throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)(
|
|
1409
1409
|
`timeline slice toBeat must not precede fromBeat; received [${fromBeat}, ${toBeat})`
|
|
1410
1410
|
);
|
|
1411
1411
|
}
|
|
@@ -1500,7 +1500,7 @@ var Timeline = class _Timeline {
|
|
|
1500
1500
|
/** The `{ at, segments }` shape the analysis functions take. */
|
|
1501
1501
|
get chordTimeline() {
|
|
1502
1502
|
const segments = this.#copySegments();
|
|
1503
|
-
return { at: (beat) =>
|
|
1503
|
+
return { at: (beat) => _chunkSGLEQVJHcjs.chordAtBeat.call(void 0, segments, beat), segments };
|
|
1504
1504
|
}
|
|
1505
1505
|
/** A fresh copy of the segments, which is what every reader is handed. */
|
|
1506
1506
|
#copySegments() {
|
|
@@ -1508,8 +1508,8 @@ var Timeline = class _Timeline {
|
|
|
1508
1508
|
}
|
|
1509
1509
|
/** The key in force at a beat, or undefined when the timeline knows none. */
|
|
1510
1510
|
#keyAt(beat) {
|
|
1511
|
-
const prevailing =
|
|
1512
|
-
return prevailing === null ? void 0 : toKey(
|
|
1511
|
+
const prevailing = _chunkSGLEQVJHcjs.prevailingKeyOf.call(void 0, this.#keys);
|
|
1512
|
+
return prevailing === null ? void 0 : toKey(_chunkSGLEQVJHcjs.keyLookup.call(void 0, this.#keys, prevailing)(beat));
|
|
1513
1513
|
}
|
|
1514
1514
|
/**
|
|
1515
1515
|
* The key every beat of the timeline is read against, spelling and all.
|
|
@@ -1522,13 +1522,13 @@ var Timeline = class _Timeline {
|
|
|
1522
1522
|
* would number it as the G# minor those read best as.
|
|
1523
1523
|
*/
|
|
1524
1524
|
#resolvedKeyAt() {
|
|
1525
|
-
const prevailing =
|
|
1525
|
+
const prevailing = _chunkSGLEQVJHcjs.prevailingKeyOf.call(void 0, this.#keys);
|
|
1526
1526
|
if (prevailing === null) {
|
|
1527
|
-
throw new (0,
|
|
1527
|
+
throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)(
|
|
1528
1528
|
"timeline carries no key; build it from notes, or pass a key to Timeline.fromChords"
|
|
1529
1529
|
);
|
|
1530
1530
|
}
|
|
1531
|
-
return
|
|
1531
|
+
return _chunkSGLEQVJHcjs.keyLookup.call(void 0, this.#keys, prevailing);
|
|
1532
1532
|
}
|
|
1533
1533
|
/**
|
|
1534
1534
|
* The pitch classes of that key, for the readings that want them.
|
|
@@ -1540,7 +1540,7 @@ var Timeline = class _Timeline {
|
|
|
1540
1540
|
*/
|
|
1541
1541
|
#keyContext() {
|
|
1542
1542
|
const keyAt = this.#resolvedKeyAt();
|
|
1543
|
-
return (beat) =>
|
|
1543
|
+
return (beat) => _chunk3R3QVKY5cjs.scaleOf.call(void 0, keyAt(beat));
|
|
1544
1544
|
}
|
|
1545
1545
|
/** Move every chord and every key region by the same step. */
|
|
1546
1546
|
#moved(moveChord, moveKey) {
|
|
@@ -1642,7 +1642,7 @@ var Progression = class _Progression {
|
|
|
1642
1642
|
*/
|
|
1643
1643
|
static fromSpans(spans, key) {
|
|
1644
1644
|
const chords = assertDataObjects(spans, "progression spans").map(
|
|
1645
|
-
(span) => Chord.fromData(
|
|
1645
|
+
(span) => Chord.fromData(_chunk3R3QVKY5cjs.chordFromSpan.call(void 0, span))
|
|
1646
1646
|
);
|
|
1647
1647
|
return new _Progression(chords, key);
|
|
1648
1648
|
}
|
|
@@ -1870,7 +1870,7 @@ var Progression = class _Progression {
|
|
|
1870
1870
|
*/
|
|
1871
1871
|
voice(opts) {
|
|
1872
1872
|
const key = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _6 => _6.key]), () => ( this.#key));
|
|
1873
|
-
return
|
|
1873
|
+
return _chunk76ZBTRG2cjs.voiceProgression.call(void 0,
|
|
1874
1874
|
this.#chords.map((chord) => chord.data),
|
|
1875
1875
|
key === void 0 ? opts : { ...opts, key }
|
|
1876
1876
|
);
|
|
@@ -1937,7 +1937,7 @@ var Progression = class _Progression {
|
|
|
1937
1937
|
const from = this.#chords[this.#chords.length - 2];
|
|
1938
1938
|
const to = this.#chords[this.#chords.length - 1];
|
|
1939
1939
|
const approach = this.#chords[this.#chords.length - 3];
|
|
1940
|
-
const cadence = from !== void 0 && to !== void 0 ?
|
|
1940
|
+
const cadence = from !== void 0 && to !== void 0 ? _chunkSGLEQVJHcjs.detectCadence.call(void 0, from.data, to.data, resolved, {
|
|
1941
1941
|
...cadenceOpts,
|
|
1942
1942
|
...approach === void 0 ? {} : { approach: approach.data },
|
|
1943
1943
|
...voicing === void 0 ? {} : { voicing: this.#closingVoicing(voicing) }
|
|
@@ -1957,7 +1957,7 @@ var Progression = class _Progression {
|
|
|
1957
1957
|
if (voicing.length === this.#chords.length || voicing.length === 2) {
|
|
1958
1958
|
return [_nullishCoalesce(voicing[voicing.length - 2], () => ( [])), _nullishCoalesce(voicing[voicing.length - 1], () => ( []))];
|
|
1959
1959
|
}
|
|
1960
|
-
throw new (0,
|
|
1960
|
+
throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)(
|
|
1961
1961
|
`voicing must hold one voicing per chord (${this.#chords.length}) or the closing pair; received ${voicing.length}`
|
|
1962
1962
|
);
|
|
1963
1963
|
}
|
|
@@ -1967,7 +1967,7 @@ var Progression = class _Progression {
|
|
|
1967
1967
|
* @returns One scale choice per chord in this progression.
|
|
1968
1968
|
*/
|
|
1969
1969
|
scales() {
|
|
1970
|
-
return
|
|
1970
|
+
return _chunkPM4XJE2Ycjs.scalesForChanges.call(void 0, this.#chords.map((chord) => chord.data));
|
|
1971
1971
|
}
|
|
1972
1972
|
/**
|
|
1973
1973
|
* Classify the motion at every chord change, not only the closing one.
|
|
@@ -2014,7 +2014,7 @@ var Progression = class _Progression {
|
|
|
2014
2014
|
const approach = index >= 2 ? _optionalChain([this, 'access', _7 => _7.#chords, 'access', _8 => _8[index - 2], 'optionalAccess', _9 => _9.data]) : _optionalChain([opts, 'optionalAccess', _10 => _10.approach]);
|
|
2015
2015
|
const pair = _optionalChain([opts, 'optionalAccess', _11 => _11.voicing]);
|
|
2016
2016
|
found.push(
|
|
2017
|
-
|
|
2017
|
+
_chunkSGLEQVJHcjs.detectCadence.call(void 0, from.data, to.data, resolved, {
|
|
2018
2018
|
..._optionalChain([opts, 'optionalAccess', _12 => _12.alternatives]) === void 0 ? {} : { alternatives: opts.alternatives },
|
|
2019
2019
|
...approach === void 0 ? {} : { approach },
|
|
2020
2020
|
...pair === void 0 ? {} : { voicing: [_nullishCoalesce(pair[index - 1], () => ( [])), _nullishCoalesce(pair[index], () => ( []))] }
|
|
@@ -2051,16 +2051,16 @@ var Progression = class _Progression {
|
|
|
2051
2051
|
const position = index < 0 ? this.#chords.length + index : index;
|
|
2052
2052
|
const target = this.#chords[position];
|
|
2053
2053
|
if (target === void 0) {
|
|
2054
|
-
throw new (0,
|
|
2054
|
+
throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)(
|
|
2055
2055
|
`progression has no chord at index ${index}; it holds ${this.#chords.length}`
|
|
2056
2056
|
);
|
|
2057
2057
|
}
|
|
2058
2058
|
const key = this.#resolveKey();
|
|
2059
|
-
const chosen =
|
|
2059
|
+
const chosen = _chunkJ7FHVZIIcjs.substituteChord.call(void 0, target.data, key, opts).find(
|
|
2060
2060
|
(candidate) => candidate.type === type
|
|
2061
2061
|
);
|
|
2062
2062
|
if (chosen === void 0) {
|
|
2063
|
-
throw new (0,
|
|
2063
|
+
throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)(
|
|
2064
2064
|
`no ${type} substitution for ${target.symbol()} in ${key.toString()}`
|
|
2065
2065
|
);
|
|
2066
2066
|
}
|
|
@@ -2153,7 +2153,7 @@ var Progression = class _Progression {
|
|
|
2153
2153
|
transposeTo(target) {
|
|
2154
2154
|
const from = this.#key;
|
|
2155
2155
|
if (from === void 0) {
|
|
2156
|
-
throw new (0,
|
|
2156
|
+
throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)(
|
|
2157
2157
|
"progression has no key context; attach one with withKey() before transposing to another key"
|
|
2158
2158
|
);
|
|
2159
2159
|
}
|
|
@@ -2196,7 +2196,7 @@ var Progression = class _Progression {
|
|
|
2196
2196
|
assertKeyArgument(key, "progression key");
|
|
2197
2197
|
const resolved = key === void 0 ? this.#key : toKey(key);
|
|
2198
2198
|
if (resolved === void 0) {
|
|
2199
|
-
throw new (0,
|
|
2199
|
+
throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)(
|
|
2200
2200
|
"progression has no key context; pass a Key or attach one with withKey()"
|
|
2201
2201
|
);
|
|
2202
2202
|
}
|
|
@@ -2206,25 +2206,25 @@ var Progression = class _Progression {
|
|
|
2206
2206
|
|
|
2207
2207
|
// src/model/chord.ts
|
|
2208
2208
|
function hintMatches(hint, pc) {
|
|
2209
|
-
return hint !== void 0 && pc !== void 0 &&
|
|
2209
|
+
return hint !== void 0 && pc !== void 0 && _chunkS5BKZZGMcjs.pitchClassOf.call(void 0, _chunkS5BKZZGMcjs.noteToPitchClass.call(void 0, hint)) === _chunkS5BKZZGMcjs.pitchClassOf.call(void 0, pc);
|
|
2210
2210
|
}
|
|
2211
2211
|
function transposeHintByInterval(hint, interval) {
|
|
2212
2212
|
if (hint === void 0) {
|
|
2213
2213
|
return void 0;
|
|
2214
2214
|
}
|
|
2215
|
-
const moved =
|
|
2215
|
+
const moved = _chunkS5BKZZGMcjs.transposeByInterval.call(void 0, hint, interval);
|
|
2216
2216
|
return { letter: moved.letter, alter: moved.alter };
|
|
2217
2217
|
}
|
|
2218
2218
|
function transposeToneHintsByInterval(hints, interval) {
|
|
2219
2219
|
return _optionalChain([hints, 'optionalAccess', _22 => _22.map, 'call', _23 => _23((hint) => {
|
|
2220
|
-
const moved =
|
|
2220
|
+
const moved = _chunkS5BKZZGMcjs.transposeByInterval.call(void 0, hint, interval);
|
|
2221
2221
|
return { letter: moved.letter, alter: moved.alter };
|
|
2222
2222
|
})]);
|
|
2223
2223
|
}
|
|
2224
2224
|
function copyChord(data) {
|
|
2225
2225
|
assertDataObject(data, "chord data");
|
|
2226
|
-
|
|
2227
|
-
const rootPc =
|
|
2226
|
+
_chunk3R3QVKY5cjs.assertChordQuality.call(void 0, data.quality);
|
|
2227
|
+
const rootPc = _chunkS5BKZZGMcjs.pitchClassOf.call(void 0, data.rootPc);
|
|
2228
2228
|
const copy = {
|
|
2229
2229
|
rootPc,
|
|
2230
2230
|
quality: data.quality,
|
|
@@ -2232,14 +2232,14 @@ function copyChord(data) {
|
|
|
2232
2232
|
// interval voices, spells and formats as a chord that looks real, and the
|
|
2233
2233
|
// failure surfaces wherever the number is finally used.
|
|
2234
2234
|
intervals: assertDataArray(data.intervals, "chord intervals").map(
|
|
2235
|
-
(interval, index) =>
|
|
2235
|
+
(interval, index) => _chunkS5BKZZGMcjs.assertFiniteNumber.call(void 0, interval, `chord intervals[${index}]`)
|
|
2236
2236
|
)
|
|
2237
2237
|
};
|
|
2238
|
-
const bassPc = data.bassPc === void 0 ? void 0 :
|
|
2238
|
+
const bassPc = data.bassPc === void 0 ? void 0 : _chunkS5BKZZGMcjs.pitchClassOf.call(void 0, data.bassPc);
|
|
2239
2239
|
if (bassPc !== void 0 && bassPc !== rootPc) {
|
|
2240
2240
|
copy.bassPc = bassPc;
|
|
2241
2241
|
}
|
|
2242
|
-
const tones =
|
|
2242
|
+
const tones = _chunk3R3QVKY5cjs.chordToneSpellings.call(void 0, data);
|
|
2243
2243
|
if (tones !== void 0) {
|
|
2244
2244
|
copy.toneSpellings = tones;
|
|
2245
2245
|
}
|
|
@@ -2258,8 +2258,8 @@ function deriveBassSpelling(chord, key) {
|
|
|
2258
2258
|
}
|
|
2259
2259
|
const root = chord.rootSpelling;
|
|
2260
2260
|
if (root !== void 0) {
|
|
2261
|
-
const index = chord.intervals.findIndex((i) =>
|
|
2262
|
-
const tone = index >= 0 ?
|
|
2261
|
+
const index = chord.intervals.findIndex((i) => _chunkS5BKZZGMcjs.pitchClassOf.call(void 0, chord.rootPc + i) === bassPc);
|
|
2262
|
+
const tone = index >= 0 ? _chunk3R3QVKY5cjs.spellChordFromRoot.call(void 0, chord, root)[index] : void 0;
|
|
2263
2263
|
if (tone !== void 0) {
|
|
2264
2264
|
return { letter: tone.letter, alter: tone.alter };
|
|
2265
2265
|
}
|
|
@@ -2267,7 +2267,7 @@ function deriveBassSpelling(chord, key) {
|
|
|
2267
2267
|
if (key === void 0) {
|
|
2268
2268
|
return void 0;
|
|
2269
2269
|
}
|
|
2270
|
-
const spelled =
|
|
2270
|
+
const spelled = _chunk3R3QVKY5cjs.spellPitchClass.call(void 0, bassPc, key.tonic.data, key);
|
|
2271
2271
|
return { letter: spelled.letter, alter: spelled.alter };
|
|
2272
2272
|
}
|
|
2273
2273
|
var Chord = class _Chord {
|
|
@@ -2300,7 +2300,7 @@ var Chord = class _Chord {
|
|
|
2300
2300
|
#dataWithKey(key) {
|
|
2301
2301
|
const out = copyChord(this.#given);
|
|
2302
2302
|
if (out.rootSpelling === void 0 && key !== void 0) {
|
|
2303
|
-
out.rootSpelling =
|
|
2303
|
+
out.rootSpelling = _chunk3R3QVKY5cjs.spellPitchClass.call(void 0, out.rootPc, key.tonic.data, key);
|
|
2304
2304
|
}
|
|
2305
2305
|
if (out.bassSpelling === void 0) {
|
|
2306
2306
|
const bass = deriveBassSpelling(out, key);
|
|
@@ -2323,7 +2323,7 @@ var Chord = class _Chord {
|
|
|
2323
2323
|
const bassNote = typeof bass === "string" ? Note.parse(bass) : void 0;
|
|
2324
2324
|
const bassPc = bassNote !== void 0 ? bassNote.pitchClass : bass;
|
|
2325
2325
|
const rootNote = typeof root === "string" ? Note.parse(root) : void 0;
|
|
2326
|
-
const data =
|
|
2326
|
+
const data = _chunk3R3QVKY5cjs.makeChord.call(void 0,
|
|
2327
2327
|
rootNote !== void 0 ? rootNote.pitchClass : root,
|
|
2328
2328
|
quality,
|
|
2329
2329
|
bassPc
|
|
@@ -2389,7 +2389,7 @@ var Chord = class _Chord {
|
|
|
2389
2389
|
* ```
|
|
2390
2390
|
*/
|
|
2391
2391
|
static fromFiguredBass(bass, figures, key) {
|
|
2392
|
-
return new _Chord(
|
|
2392
|
+
return new _Chord(_chunk76ZBTRG2cjs.realizeFiguredBass.call(void 0, _chunkS5BKZZGMcjs.toNoteData.call(void 0, bass), figures, key));
|
|
2393
2393
|
}
|
|
2394
2394
|
/**
|
|
2395
2395
|
* Parse a lead-sheet chord symbol (e.g. `'Cmaj7'`, `'F#m7b5'`, `'C/G'`).
|
|
@@ -2412,7 +2412,7 @@ var Chord = class _Chord {
|
|
|
2412
2412
|
* ```
|
|
2413
2413
|
*/
|
|
2414
2414
|
static parse(symbol, opts) {
|
|
2415
|
-
return
|
|
2415
|
+
return _chunkS5BKZZGMcjs.unwrapParse.call(void 0, _Chord.tryParse(symbol, opts));
|
|
2416
2416
|
}
|
|
2417
2417
|
/**
|
|
2418
2418
|
* Parse a lead-sheet chord symbol, reporting failure instead of throwing it.
|
|
@@ -2435,7 +2435,7 @@ var Chord = class _Chord {
|
|
|
2435
2435
|
* ```
|
|
2436
2436
|
*/
|
|
2437
2437
|
static tryParse(symbol, opts) {
|
|
2438
|
-
const parsed =
|
|
2438
|
+
const parsed = _chunk3R3QVKY5cjs.tryParseChordSymbol.call(void 0, symbol, opts);
|
|
2439
2439
|
return parsed.ok ? { ok: true, value: new _Chord(parsed.value) } : parsed;
|
|
2440
2440
|
}
|
|
2441
2441
|
/**
|
|
@@ -2446,8 +2446,8 @@ var Chord = class _Chord {
|
|
|
2446
2446
|
* @returns Ranked chord interpretations (may be empty).
|
|
2447
2447
|
*/
|
|
2448
2448
|
static detect(pitches, opts) {
|
|
2449
|
-
return
|
|
2450
|
-
(match) => new _Chord(
|
|
2449
|
+
return _chunkSGLEQVJHcjs.detectChord.call(void 0, pitches, opts).map(
|
|
2450
|
+
(match) => new _Chord(_chunk3R3QVKY5cjs.makeChord.call(void 0, match.rootPc, match.quality, match.bassPc))
|
|
2451
2451
|
);
|
|
2452
2452
|
}
|
|
2453
2453
|
/**
|
|
@@ -2469,8 +2469,8 @@ var Chord = class _Chord {
|
|
|
2469
2469
|
* ```
|
|
2470
2470
|
*/
|
|
2471
2471
|
static detectMatches(pitches, opts) {
|
|
2472
|
-
return
|
|
2473
|
-
chord: new _Chord(
|
|
2472
|
+
return _chunkSGLEQVJHcjs.detectChord.call(void 0, pitches, opts).map((match) => ({
|
|
2473
|
+
chord: new _Chord(_chunk3R3QVKY5cjs.makeChord.call(void 0, match.rootPc, match.quality, match.bassPc)),
|
|
2474
2474
|
match
|
|
2475
2475
|
}));
|
|
2476
2476
|
}
|
|
@@ -2482,7 +2482,7 @@ var Chord = class _Chord {
|
|
|
2482
2482
|
* @returns The top-ranked chord, or null when nothing matches.
|
|
2483
2483
|
*/
|
|
2484
2484
|
static detectBest(pitches, opts) {
|
|
2485
|
-
const best =
|
|
2485
|
+
const best = _chunkSGLEQVJHcjs.detectChordBest.call(void 0, pitches, opts);
|
|
2486
2486
|
return best === null ? null : new _Chord(best);
|
|
2487
2487
|
}
|
|
2488
2488
|
/** The root pitch class (0..11). */
|
|
@@ -2526,7 +2526,7 @@ var Chord = class _Chord {
|
|
|
2526
2526
|
* ```
|
|
2527
2527
|
*/
|
|
2528
2528
|
get spec() {
|
|
2529
|
-
return
|
|
2529
|
+
return _chunk3R3QVKY5cjs.chordSpecOf.call(void 0, this.#data);
|
|
2530
2530
|
}
|
|
2531
2531
|
/** The carried key context, if any. */
|
|
2532
2532
|
get key() {
|
|
@@ -2564,7 +2564,7 @@ var Chord = class _Chord {
|
|
|
2564
2564
|
* ```
|
|
2565
2565
|
*/
|
|
2566
2566
|
pitchClasses(opts) {
|
|
2567
|
-
return
|
|
2567
|
+
return _chunk3R3QVKY5cjs.chordPitchClasses.call(void 0, this.#data, opts);
|
|
2568
2568
|
}
|
|
2569
2569
|
/**
|
|
2570
2570
|
* Whether a pitch is one of the chord's tones, ignoring octave.
|
|
@@ -2582,7 +2582,7 @@ var Chord = class _Chord {
|
|
|
2582
2582
|
* ```
|
|
2583
2583
|
*/
|
|
2584
2584
|
contains(pitch) {
|
|
2585
|
-
return
|
|
2585
|
+
return _chunk3R3QVKY5cjs.isChordMember.call(void 0, pitch, this.#data);
|
|
2586
2586
|
}
|
|
2587
2587
|
/**
|
|
2588
2588
|
* A pitch's harmonic role in the chord: root, third, fifth, sixth, or
|
|
@@ -2605,7 +2605,7 @@ var Chord = class _Chord {
|
|
|
2605
2605
|
* ```
|
|
2606
2606
|
*/
|
|
2607
2607
|
roleOf(pitch) {
|
|
2608
|
-
return
|
|
2608
|
+
return _chunk3R3QVKY5cjs.chordToneRole.call(void 0, pitch, this.#data);
|
|
2609
2609
|
}
|
|
2610
2610
|
/**
|
|
2611
2611
|
* The chord's Roman numeral in a key.
|
|
@@ -2617,7 +2617,7 @@ var Chord = class _Chord {
|
|
|
2617
2617
|
* @throws If no key is given and none is carried.
|
|
2618
2618
|
*/
|
|
2619
2619
|
roman(key, opts) {
|
|
2620
|
-
return
|
|
2620
|
+
return _chunkSGLEQVJHcjs.chordToRoman.call(void 0, this.#data, this.#resolveKey(key), opts);
|
|
2621
2621
|
}
|
|
2622
2622
|
/**
|
|
2623
2623
|
* The chord's Roman numeral together with the reasoning behind it: the degree
|
|
@@ -2645,7 +2645,7 @@ var Chord = class _Chord {
|
|
|
2645
2645
|
* ```
|
|
2646
2646
|
*/
|
|
2647
2647
|
explain(key, opts) {
|
|
2648
|
-
return
|
|
2648
|
+
return _chunkSGLEQVJHcjs.explainRoman.call(void 0, this.#data, this.#resolveKey(key), opts);
|
|
2649
2649
|
}
|
|
2650
2650
|
/**
|
|
2651
2651
|
* The chord's harmonic function (tonic / subdominant / dominant) in a key.
|
|
@@ -2656,7 +2656,7 @@ var Chord = class _Chord {
|
|
|
2656
2656
|
* @throws If no key is given and none is carried.
|
|
2657
2657
|
*/
|
|
2658
2658
|
function(key) {
|
|
2659
|
-
return
|
|
2659
|
+
return _chunkSGLEQVJHcjs.functionOf.call(void 0, this.#data, this.#resolveKey(key));
|
|
2660
2660
|
}
|
|
2661
2661
|
/**
|
|
2662
2662
|
* Full functional analysis: function, borrowing, Roman numeral, and the
|
|
@@ -2676,7 +2676,7 @@ var Chord = class _Chord {
|
|
|
2676
2676
|
* ```
|
|
2677
2677
|
*/
|
|
2678
2678
|
analyze(key, opts) {
|
|
2679
|
-
return
|
|
2679
|
+
return _chunkSGLEQVJHcjs.analyzeChord.call(void 0, this.#data, this.#resolveKey(key), opts);
|
|
2680
2680
|
}
|
|
2681
2681
|
/**
|
|
2682
2682
|
* Whether the chord is borrowed from the parallel mode (modal interchange).
|
|
@@ -2687,7 +2687,7 @@ var Chord = class _Chord {
|
|
|
2687
2687
|
* @throws If no key is given and none is carried.
|
|
2688
2688
|
*/
|
|
2689
2689
|
isBorrowed(key) {
|
|
2690
|
-
return
|
|
2690
|
+
return _chunkSGLEQVJHcjs.isBorrowedChord.call(void 0, this.#data, this.#resolveKey(key));
|
|
2691
2691
|
}
|
|
2692
2692
|
/**
|
|
2693
2693
|
* The origin of a non-diatonic chord (parallel mode or Neapolitan), or null.
|
|
@@ -2698,7 +2698,7 @@ var Chord = class _Chord {
|
|
|
2698
2698
|
* @throws If no key is given and none is carried.
|
|
2699
2699
|
*/
|
|
2700
2700
|
borrowedSource(key) {
|
|
2701
|
-
return
|
|
2701
|
+
return _chunkSGLEQVJHcjs.borrowedSource.call(void 0, this.#data, this.#resolveKey(key));
|
|
2702
2702
|
}
|
|
2703
2703
|
/**
|
|
2704
2704
|
* The chord written as the figures a bass would carry under it: `6`, `64`,
|
|
@@ -2723,7 +2723,7 @@ var Chord = class _Chord {
|
|
|
2723
2723
|
* ```
|
|
2724
2724
|
*/
|
|
2725
2725
|
figuredBass(key) {
|
|
2726
|
-
return
|
|
2726
|
+
return _chunk76ZBTRG2cjs.figuredBassOf.call(void 0, this.#data, this.#resolveKey(key));
|
|
2727
2727
|
}
|
|
2728
2728
|
/**
|
|
2729
2729
|
* The chords that can stand in for this one in a key: its tritone substitute,
|
|
@@ -2750,7 +2750,7 @@ var Chord = class _Chord {
|
|
|
2750
2750
|
* ```
|
|
2751
2751
|
*/
|
|
2752
2752
|
substitutions(key, opts) {
|
|
2753
|
-
return
|
|
2753
|
+
return _chunkJ7FHVZIIcjs.substituteChord.call(void 0, this.#data, this.#resolveKey(key), opts);
|
|
2754
2754
|
}
|
|
2755
2755
|
/**
|
|
2756
2756
|
* The modal-interchange palette of the chord's key: the parallel mode's
|
|
@@ -2775,7 +2775,7 @@ var Chord = class _Chord {
|
|
|
2775
2775
|
* ```
|
|
2776
2776
|
*/
|
|
2777
2777
|
modalInterchange(key) {
|
|
2778
|
-
return
|
|
2778
|
+
return _chunkJ7FHVZIIcjs.modalInterchangePalette.call(void 0, this.#resolveKey(key));
|
|
2779
2779
|
}
|
|
2780
2780
|
/**
|
|
2781
2781
|
* The chord rendered as a lead-sheet symbol (e.g. `'Cmaj7'`, `'F#m7'`, `'C/G'`).
|
|
@@ -2790,7 +2790,7 @@ var Chord = class _Chord {
|
|
|
2790
2790
|
* ```
|
|
2791
2791
|
*/
|
|
2792
2792
|
symbol(opts) {
|
|
2793
|
-
return
|
|
2793
|
+
return _chunk3R3QVKY5cjs.formatChordSymbol.call(void 0, this.#data, opts);
|
|
2794
2794
|
}
|
|
2795
2795
|
/**
|
|
2796
2796
|
* Realize the chord as one MIDI pitch per voice, ascending.
|
|
@@ -2804,7 +2804,7 @@ var Chord = class _Chord {
|
|
|
2804
2804
|
*/
|
|
2805
2805
|
voice(opts) {
|
|
2806
2806
|
const key = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _24 => _24.key]), () => ( this.#key));
|
|
2807
|
-
return
|
|
2807
|
+
return _chunk76ZBTRG2cjs.voiceChord.call(void 0, this.#data, key === void 0 ? opts : { ...opts, key });
|
|
2808
2808
|
}
|
|
2809
2809
|
/**
|
|
2810
2810
|
* Realize the chord as a single styled voicing (`close`, `drop2`, `drop3`,
|
|
@@ -2814,7 +2814,7 @@ var Chord = class _Chord {
|
|
|
2814
2814
|
* @returns MIDI pitches, ascending.
|
|
2815
2815
|
*/
|
|
2816
2816
|
styledVoicing(opts) {
|
|
2817
|
-
return
|
|
2817
|
+
return _chunk76ZBTRG2cjs.voiceChordStyled.call(void 0, this.#data, opts);
|
|
2818
2818
|
}
|
|
2819
2819
|
/**
|
|
2820
2820
|
* The negative-harmony mirror of the chord about the key's tonic–dominant
|
|
@@ -2827,7 +2827,7 @@ var Chord = class _Chord {
|
|
|
2827
2827
|
*/
|
|
2828
2828
|
negativeHarmony(key) {
|
|
2829
2829
|
const resolved = this.#resolveKey(key);
|
|
2830
|
-
return new _Chord(
|
|
2830
|
+
return new _Chord(_chunkJ7FHVZIIcjs.negativeHarmonyMirror.call(void 0, this.#data, resolved), resolved);
|
|
2831
2831
|
}
|
|
2832
2832
|
/**
|
|
2833
2833
|
* The V7 that tonicizes this chord: a dominant seventh a perfect fifth above
|
|
@@ -2845,7 +2845,7 @@ var Chord = class _Chord {
|
|
|
2845
2845
|
* ```
|
|
2846
2846
|
*/
|
|
2847
2847
|
secondaryDominant() {
|
|
2848
|
-
return new _Chord(
|
|
2848
|
+
return new _Chord(_chunkSGLEQVJHcjs.secondaryDominantOf.call(void 0, this.#given), this.#key);
|
|
2849
2849
|
}
|
|
2850
2850
|
/**
|
|
2851
2851
|
* The n-th inversion: a copy whose bass is the chord tone `n` steps above the
|
|
@@ -2864,14 +2864,14 @@ var Chord = class _Chord {
|
|
|
2864
2864
|
const intervals = data.intervals;
|
|
2865
2865
|
const length = intervals.length;
|
|
2866
2866
|
if (length === 0) {
|
|
2867
|
-
throw new (0,
|
|
2867
|
+
throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)("cannot invert a chord with no intervals");
|
|
2868
2868
|
}
|
|
2869
2869
|
const index = (n % length + length) % length;
|
|
2870
2870
|
delete data.bassSpelling;
|
|
2871
2871
|
if (index === 0) {
|
|
2872
2872
|
delete data.bassPc;
|
|
2873
2873
|
} else {
|
|
2874
|
-
data.bassPc =
|
|
2874
|
+
data.bassPc = _chunkS5BKZZGMcjs.pitchClassOf.call(void 0, data.rootPc + (_nullishCoalesce(intervals[index], () => ( 0))));
|
|
2875
2875
|
}
|
|
2876
2876
|
return new _Chord(data, this.#key);
|
|
2877
2877
|
}
|
|
@@ -2892,8 +2892,8 @@ var Chord = class _Chord {
|
|
|
2892
2892
|
* ```
|
|
2893
2893
|
*/
|
|
2894
2894
|
transpose(semitones) {
|
|
2895
|
-
const moved =
|
|
2896
|
-
const { rootSpelling, bassSpelling, toneSpellings } =
|
|
2895
|
+
const moved = _chunk3R3QVKY5cjs.transposeChord.call(void 0, this.#given, semitones);
|
|
2896
|
+
const { rootSpelling, bassSpelling, toneSpellings } = _chunk3R3QVKY5cjs.transposeChordSpellings.call(void 0,
|
|
2897
2897
|
this.#given,
|
|
2898
2898
|
semitones
|
|
2899
2899
|
);
|
|
@@ -2928,8 +2928,8 @@ var Chord = class _Chord {
|
|
|
2928
2928
|
* ```
|
|
2929
2929
|
*/
|
|
2930
2930
|
transposeBy(interval) {
|
|
2931
|
-
const spelled =
|
|
2932
|
-
const moved =
|
|
2931
|
+
const spelled = _chunkS5BKZZGMcjs.toSpelledInterval.call(void 0, interval);
|
|
2932
|
+
const moved = _chunk3R3QVKY5cjs.transposeChord.call(void 0, this.#given, spelled.semitones);
|
|
2933
2933
|
const rootSpelling = transposeHintByInterval(this.#given.rootSpelling, spelled);
|
|
2934
2934
|
const bassSpelling = transposeHintByInterval(this.#given.bassSpelling, spelled);
|
|
2935
2935
|
const toneSpellings = transposeToneHintsByInterval(this.#given.toneSpellings, spelled);
|
|
@@ -2955,7 +2955,7 @@ var Chord = class _Chord {
|
|
|
2955
2955
|
* @returns The matching scales.
|
|
2956
2956
|
*/
|
|
2957
2957
|
scales() {
|
|
2958
|
-
return
|
|
2958
|
+
return _chunkPM4XJE2Ycjs.chordScales.call(void 0, this.#data);
|
|
2959
2959
|
}
|
|
2960
2960
|
/**
|
|
2961
2961
|
* The scales that fit over this chord, each with the tones it does not state
|
|
@@ -2977,7 +2977,7 @@ var Chord = class _Chord {
|
|
|
2977
2977
|
* ```
|
|
2978
2978
|
*/
|
|
2979
2979
|
scaleReport(limit) {
|
|
2980
|
-
return
|
|
2980
|
+
return _chunkPM4XJE2Ycjs.chordScaleReport.call(void 0, this.#data, limit);
|
|
2981
2981
|
}
|
|
2982
2982
|
/**
|
|
2983
2983
|
* The available tensions (usable non-chord, non-avoid scale tones) of a
|
|
@@ -3002,7 +3002,7 @@ var Chord = class _Chord {
|
|
|
3002
3002
|
* ```
|
|
3003
3003
|
*/
|
|
3004
3004
|
tensions(scaleName, opts) {
|
|
3005
|
-
return
|
|
3005
|
+
return _chunkPM4XJE2Ycjs.availableTensions.call(void 0, this.#data, scaleName, opts);
|
|
3006
3006
|
}
|
|
3007
3007
|
/**
|
|
3008
3008
|
* The avoid notes (scale tones a semitone above a chord tone) of a scale
|
|
@@ -3026,7 +3026,7 @@ var Chord = class _Chord {
|
|
|
3026
3026
|
* ```
|
|
3027
3027
|
*/
|
|
3028
3028
|
avoidNotes(scaleName, opts) {
|
|
3029
|
-
return
|
|
3029
|
+
return _chunkPM4XJE2Ycjs.avoidNotes.call(void 0, this.#data, scaleName, opts);
|
|
3030
3030
|
}
|
|
3031
3031
|
/**
|
|
3032
3032
|
* Spell the chord tones with letter names, root first, in the key's spelling.
|
|
@@ -3057,17 +3057,17 @@ var Chord = class _Chord {
|
|
|
3057
3057
|
if (resolved === void 0) {
|
|
3058
3058
|
const root = data.rootSpelling;
|
|
3059
3059
|
if (root === void 0) {
|
|
3060
|
-
throw new (0,
|
|
3060
|
+
throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)(
|
|
3061
3061
|
"chord has no key context and no root spelling; pass a Key, attach one with withKey(), or build the chord from a symbol"
|
|
3062
3062
|
);
|
|
3063
3063
|
}
|
|
3064
|
-
tones =
|
|
3064
|
+
tones = _chunk3R3QVKY5cjs.spellChordFromRoot.call(void 0, data, root);
|
|
3065
3065
|
} else {
|
|
3066
|
-
tones =
|
|
3066
|
+
tones = _chunk3R3QVKY5cjs.spellChord.call(void 0, data, resolved.tonic.data, resolved);
|
|
3067
3067
|
}
|
|
3068
3068
|
const bassPc = data.bassPc;
|
|
3069
3069
|
const bass = data.bassSpelling;
|
|
3070
|
-
if (bassPc !== void 0 && bass !== void 0 && !tones.some((tone) =>
|
|
3070
|
+
if (bassPc !== void 0 && bass !== void 0 && !tones.some((tone) => _chunkS5BKZZGMcjs.pitchClassOf.call(void 0, _chunkS5BKZZGMcjs.noteToPitchClass.call(void 0, tone)) === _chunkS5BKZZGMcjs.pitchClassOf.call(void 0, bassPc))) {
|
|
3071
3071
|
tones = [...tones, { letter: bass.letter, alter: bass.alter }];
|
|
3072
3072
|
}
|
|
3073
3073
|
return tones.map((note) => new Note(note));
|
|
@@ -3101,7 +3101,7 @@ var Chord = class _Chord {
|
|
|
3101
3101
|
* ```
|
|
3102
3102
|
*/
|
|
3103
3103
|
span(startBeat) {
|
|
3104
|
-
return
|
|
3104
|
+
return _chunk3R3QVKY5cjs.spanFromChord.call(void 0, this.#data, startBeat);
|
|
3105
3105
|
}
|
|
3106
3106
|
/**
|
|
3107
3107
|
* Whether another chord has the same root, quality, intervals, and bass.
|
|
@@ -3141,7 +3141,7 @@ var Chord = class _Chord {
|
|
|
3141
3141
|
assertKeyArgument(key, "chord key");
|
|
3142
3142
|
const resolved = key === void 0 ? this.#key : toKey(key);
|
|
3143
3143
|
if (resolved === void 0) {
|
|
3144
|
-
throw new (0,
|
|
3144
|
+
throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)(
|
|
3145
3145
|
"chord has no key context; pass a Key or attach one with withKey()"
|
|
3146
3146
|
);
|
|
3147
3147
|
}
|
|
@@ -3151,11 +3151,11 @@ var Chord = class _Chord {
|
|
|
3151
3151
|
|
|
3152
3152
|
// src/model/key.ts
|
|
3153
3153
|
function detectedKeyMatch(match) {
|
|
3154
|
-
const key = { ...
|
|
3154
|
+
const key = { ..._chunk3R3QVKY5cjs.resolveKey.call(void 0, match.key), variant: match.variant };
|
|
3155
3155
|
return { ...match, key: toKey(key) };
|
|
3156
3156
|
}
|
|
3157
3157
|
function scaleWord(mask, isMinor) {
|
|
3158
|
-
const name =
|
|
3158
|
+
const name = _chunk3R3QVKY5cjs.scaleNameOfMask.call(void 0, mask);
|
|
3159
3159
|
if (name === void 0) {
|
|
3160
3160
|
return isMinor ? "minor" : "major";
|
|
3161
3161
|
}
|
|
@@ -3170,13 +3170,13 @@ function scaleWord(mask, isMinor) {
|
|
|
3170
3170
|
var HEPTATONIC_DEGREES = 7;
|
|
3171
3171
|
var REFERENCE_TONIC = { letter: 0, alter: 0 };
|
|
3172
3172
|
function bareInterval(from, to) {
|
|
3173
|
-
return
|
|
3173
|
+
return _chunkS5BKZZGMcjs.spelledInterval.call(void 0,
|
|
3174
3174
|
{ letter: from.letter, alter: from.alter },
|
|
3175
3175
|
{ letter: to.letter, alter: to.alter }
|
|
3176
3176
|
);
|
|
3177
3177
|
}
|
|
3178
3178
|
function spelledTonicFor(scale) {
|
|
3179
|
-
return new Note(
|
|
3179
|
+
return new Note(_chunk3R3QVKY5cjs.resolveKey.call(void 0, scale).tonic);
|
|
3180
3180
|
}
|
|
3181
3181
|
function isNoteInstance(value) {
|
|
3182
3182
|
if (value === null || typeof value !== "object") {
|
|
@@ -3207,28 +3207,28 @@ var Key = class _Key {
|
|
|
3207
3207
|
*/
|
|
3208
3208
|
constructor(scale, tonic, variant) {
|
|
3209
3209
|
assertDataObject(scale, "scale");
|
|
3210
|
-
|
|
3211
|
-
|
|
3210
|
+
_chunkS5BKZZGMcjs.assertInteger.call(void 0, scale.rootPc, "scale.rootPc");
|
|
3211
|
+
_chunkS5BKZZGMcjs.assertInteger.call(void 0, scale.modeMask12, "scale.modeMask12", 1, 4095);
|
|
3212
3212
|
if ((scale.modeMask12 & 1) === 0) {
|
|
3213
|
-
throw new (0,
|
|
3213
|
+
throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)("scale.modeMask12 must include the tonic (bit 0)");
|
|
3214
3214
|
}
|
|
3215
3215
|
if (!isNoteInstance(tonic)) {
|
|
3216
|
-
throw new (0,
|
|
3216
|
+
throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)(
|
|
3217
3217
|
`tonic must be the class API's Note; received ${describeTonic(tonic)}; wrap plain note data with Note.fromData, or omit the tonic to have one chosen`
|
|
3218
3218
|
);
|
|
3219
3219
|
}
|
|
3220
|
-
const rootPc =
|
|
3220
|
+
const rootPc = _chunkS5BKZZGMcjs.pitchClassOf.call(void 0, scale.rootPc);
|
|
3221
3221
|
if (tonic.pitchClass !== rootPc) {
|
|
3222
|
-
throw new (0,
|
|
3222
|
+
throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)(
|
|
3223
3223
|
`tonic ${tonic.name} does not match the scale root pitch class ${rootPc}; pass a tonic that spells the scale root, or omit it to have one chosen`
|
|
3224
3224
|
);
|
|
3225
3225
|
}
|
|
3226
3226
|
if (variant !== void 0) {
|
|
3227
|
-
|
|
3227
|
+
_chunk3R3QVKY5cjs.assertKeyVariant.call(void 0, variant, scale.modeMask12);
|
|
3228
3228
|
}
|
|
3229
3229
|
this.#scale = { rootPc, modeMask12: scale.modeMask12 };
|
|
3230
3230
|
this.#tonic = tonic;
|
|
3231
|
-
this.#variant = _nullishCoalesce(variant, () => (
|
|
3231
|
+
this.#variant = _nullishCoalesce(variant, () => ( _chunk3R3QVKY5cjs.variantOfMask.call(void 0, scale.modeMask12)));
|
|
3232
3232
|
}
|
|
3233
3233
|
/** Preserve detection metadata while replacing its plain key with this API's Key. */
|
|
3234
3234
|
static #fromMatch(match) {
|
|
@@ -3255,9 +3255,9 @@ var Key = class _Key {
|
|
|
3255
3255
|
static major(root) {
|
|
3256
3256
|
if (typeof root === "string") {
|
|
3257
3257
|
const tonic = Note.parse(root);
|
|
3258
|
-
return new _Key(
|
|
3258
|
+
return new _Key(_chunk3R3QVKY5cjs.majorKey.call(void 0, tonic.pitchClass), tonic);
|
|
3259
3259
|
}
|
|
3260
|
-
const scale =
|
|
3260
|
+
const scale = _chunk3R3QVKY5cjs.majorKey.call(void 0, root);
|
|
3261
3261
|
return new _Key(scale, spelledTonicFor(scale));
|
|
3262
3262
|
}
|
|
3263
3263
|
/**
|
|
@@ -3271,9 +3271,9 @@ var Key = class _Key {
|
|
|
3271
3271
|
static minor(root) {
|
|
3272
3272
|
if (typeof root === "string") {
|
|
3273
3273
|
const tonic = Note.parse(root);
|
|
3274
|
-
return new _Key(
|
|
3274
|
+
return new _Key(_chunk3R3QVKY5cjs.minorKey.call(void 0, tonic.pitchClass), tonic);
|
|
3275
3275
|
}
|
|
3276
|
-
const scale =
|
|
3276
|
+
const scale = _chunk3R3QVKY5cjs.minorKey.call(void 0, root);
|
|
3277
3277
|
return new _Key(scale, spelledTonicFor(scale));
|
|
3278
3278
|
}
|
|
3279
3279
|
/**
|
|
@@ -3289,9 +3289,9 @@ var Key = class _Key {
|
|
|
3289
3289
|
static named(name, root) {
|
|
3290
3290
|
if (typeof root === "string") {
|
|
3291
3291
|
const tonic = Note.parse(root);
|
|
3292
|
-
return new _Key(
|
|
3292
|
+
return new _Key(_chunk3R3QVKY5cjs.scaleByName.call(void 0, name, tonic.pitchClass), tonic);
|
|
3293
3293
|
}
|
|
3294
|
-
const scale =
|
|
3294
|
+
const scale = _chunk3R3QVKY5cjs.scaleByName.call(void 0, name, _chunkS5BKZZGMcjs.pitchClassOf.call(void 0, root));
|
|
3295
3295
|
return new _Key(scale, spelledTonicFor(scale));
|
|
3296
3296
|
}
|
|
3297
3297
|
/**
|
|
@@ -3326,7 +3326,7 @@ var Key = class _Key {
|
|
|
3326
3326
|
* ```
|
|
3327
3327
|
*/
|
|
3328
3328
|
static parse(text, opts) {
|
|
3329
|
-
return
|
|
3329
|
+
return _chunkS5BKZZGMcjs.unwrapParse.call(void 0, _Key.tryParse(text, opts));
|
|
3330
3330
|
}
|
|
3331
3331
|
/**
|
|
3332
3332
|
* Parse a key name, reporting failure instead of throwing it.
|
|
@@ -3348,7 +3348,7 @@ var Key = class _Key {
|
|
|
3348
3348
|
* ```
|
|
3349
3349
|
*/
|
|
3350
3350
|
static tryParse(text, opts) {
|
|
3351
|
-
const parsed =
|
|
3351
|
+
const parsed = _chunk3R3QVKY5cjs.tryResolveKeyName.call(void 0, text, opts);
|
|
3352
3352
|
return parsed.ok ? {
|
|
3353
3353
|
ok: true,
|
|
3354
3354
|
value: new _Key(parsed.value.scale, new Note(parsed.value.tonic), parsed.value.variant)
|
|
@@ -3375,7 +3375,7 @@ var Key = class _Key {
|
|
|
3375
3375
|
* ```
|
|
3376
3376
|
*/
|
|
3377
3377
|
static fromFifths(fifths, mode = "major") {
|
|
3378
|
-
return _Key.#fromSpelled(
|
|
3378
|
+
return _Key.#fromSpelled(_chunk3R3QVKY5cjs.keyFromFifths.call(void 0, fifths, mode));
|
|
3379
3379
|
}
|
|
3380
3380
|
/**
|
|
3381
3381
|
* Wrap an existing `KeyScale`, synthesizing a spelled tonic when none is
|
|
@@ -3398,7 +3398,7 @@ var Key = class _Key {
|
|
|
3398
3398
|
* @throws If the given tonic is not the scale's root pitch class.
|
|
3399
3399
|
*/
|
|
3400
3400
|
static of(key, tonic) {
|
|
3401
|
-
const resolved =
|
|
3401
|
+
const resolved = _chunk3R3QVKY5cjs.resolveKey.call(void 0, key);
|
|
3402
3402
|
return new _Key(resolved.scale, _nullishCoalesce(tonic, () => ( new Note(resolved.tonic))), resolved.variant);
|
|
3403
3403
|
}
|
|
3404
3404
|
/**
|
|
@@ -3440,7 +3440,7 @@ var Key = class _Key {
|
|
|
3440
3440
|
* @returns Ranked key matches (may be empty).
|
|
3441
3441
|
*/
|
|
3442
3442
|
static detectMatches(pitches, opts) {
|
|
3443
|
-
return
|
|
3443
|
+
return _chunkSGLEQVJHcjs.detectKey.call(void 0, pitches, opts).map((match) => _Key.#fromMatch(match));
|
|
3444
3444
|
}
|
|
3445
3445
|
/**
|
|
3446
3446
|
* The single best key interpretation of a pitch set.
|
|
@@ -3455,7 +3455,7 @@ var Key = class _Key {
|
|
|
3455
3455
|
* ```
|
|
3456
3456
|
*/
|
|
3457
3457
|
static detectBest(pitches, opts) {
|
|
3458
|
-
const best =
|
|
3458
|
+
const best = _chunkSGLEQVJHcjs.detectKeyBest.call(void 0, pitches, opts);
|
|
3459
3459
|
return best === null ? null : _Key.#fromMatch(best).key;
|
|
3460
3460
|
}
|
|
3461
3461
|
/**
|
|
@@ -3485,7 +3485,7 @@ var Key = class _Key {
|
|
|
3485
3485
|
}
|
|
3486
3486
|
/** Whether the scale has a minor third and no major third. */
|
|
3487
3487
|
get isMinor() {
|
|
3488
|
-
return
|
|
3488
|
+
return _chunkSGLEQVJHcjs.isMinorKey.call(void 0, this.#scale);
|
|
3489
3489
|
}
|
|
3490
3490
|
/**
|
|
3491
3491
|
* The key signature as a signed count of sharps (positive) or flats
|
|
@@ -3503,7 +3503,7 @@ var Key = class _Key {
|
|
|
3503
3503
|
* ```
|
|
3504
3504
|
*/
|
|
3505
3505
|
get fifths() {
|
|
3506
|
-
return
|
|
3506
|
+
return _chunk3R3QVKY5cjs.keySignatureFifths.call(void 0, this.#tonic.data, this.#scale);
|
|
3507
3507
|
}
|
|
3508
3508
|
/**
|
|
3509
3509
|
* The built-in scale this key's mode mask is, or undefined when no built-in
|
|
@@ -3527,7 +3527,7 @@ var Key = class _Key {
|
|
|
3527
3527
|
*/
|
|
3528
3528
|
get scaleName() {
|
|
3529
3529
|
const mask = this.#scale.modeMask12;
|
|
3530
|
-
return Object.keys(
|
|
3530
|
+
return Object.keys(_chunk3R3QVKY5cjs.NAMED_SCALES).find((name) => _chunk3R3QVKY5cjs.NAMED_SCALES[name] === mask);
|
|
3531
3531
|
}
|
|
3532
3532
|
/** A copy of the underlying plain key data. */
|
|
3533
3533
|
get data() {
|
|
@@ -3559,8 +3559,8 @@ var Key = class _Key {
|
|
|
3559
3559
|
* ```
|
|
3560
3560
|
*/
|
|
3561
3561
|
pitchClasses(opts) {
|
|
3562
|
-
const order = _optionalChain([opts, 'optionalAccess', _31 => _31.order]) === void 0 ? "degree" :
|
|
3563
|
-
return order === "ascending" ?
|
|
3562
|
+
const order = _optionalChain([opts, 'optionalAccess', _31 => _31.order]) === void 0 ? "degree" : _chunkS5BKZZGMcjs.assertOneOf.call(void 0, opts.order, ["degree", "ascending"], "pitch-class order");
|
|
3563
|
+
return order === "ascending" ? _chunk3R3QVKY5cjs.diatonicPitchClasses.call(void 0, this.#scale) : _chunk3R3QVKY5cjs.scaleTonesInDegreeOrder.call(void 0, this.#scale);
|
|
3564
3564
|
}
|
|
3565
3565
|
/**
|
|
3566
3566
|
* The kind of pitch organisation this key's scale belongs to: the
|
|
@@ -3584,7 +3584,7 @@ var Key = class _Key {
|
|
|
3584
3584
|
* ```
|
|
3585
3585
|
*/
|
|
3586
3586
|
system() {
|
|
3587
|
-
return
|
|
3587
|
+
return _chunk3R3QVKY5cjs.scaleSystemOf.call(void 0, this.#scale);
|
|
3588
3588
|
}
|
|
3589
3589
|
/**
|
|
3590
3590
|
* Whether functional (Roman-numeral) analysis describes this key.
|
|
@@ -3604,7 +3604,7 @@ var Key = class _Key {
|
|
|
3604
3604
|
* ```
|
|
3605
3605
|
*/
|
|
3606
3606
|
supportsFunctionalHarmony() {
|
|
3607
|
-
return
|
|
3607
|
+
return _chunk3R3QVKY5cjs.supportsFunctionalHarmony.call(void 0, this.#scale);
|
|
3608
3608
|
}
|
|
3609
3609
|
/**
|
|
3610
3610
|
* The relative key: for a plain major or minor key, the same key signature
|
|
@@ -3628,7 +3628,7 @@ var Key = class _Key {
|
|
|
3628
3628
|
* ```
|
|
3629
3629
|
*/
|
|
3630
3630
|
relative() {
|
|
3631
|
-
return _Key.#fromSpelled(
|
|
3631
|
+
return _Key.#fromSpelled(_chunk3R3QVKY5cjs.relativeKeyOf.call(void 0, this.#tonic.data, this.#scale));
|
|
3632
3632
|
}
|
|
3633
3633
|
/**
|
|
3634
3634
|
* The parallel key: the other mode on the same tonic, which keeps this key's
|
|
@@ -3642,7 +3642,7 @@ var Key = class _Key {
|
|
|
3642
3642
|
* ```
|
|
3643
3643
|
*/
|
|
3644
3644
|
parallel() {
|
|
3645
|
-
return _Key.#fromSpelled(
|
|
3645
|
+
return _Key.#fromSpelled(_chunk3R3QVKY5cjs.parallelKeyOf.call(void 0, this.#tonic.data, this.#scale));
|
|
3646
3646
|
}
|
|
3647
3647
|
/**
|
|
3648
3648
|
* The dominant key: the key a fifth above, in the mode this key's third names.
|
|
@@ -3659,7 +3659,7 @@ var Key = class _Key {
|
|
|
3659
3659
|
* ```
|
|
3660
3660
|
*/
|
|
3661
3661
|
dominantKey() {
|
|
3662
|
-
return _Key.#fromSpelled(
|
|
3662
|
+
return _Key.#fromSpelled(_chunk3R3QVKY5cjs.dominantKeyOf.call(void 0, this.#tonic.data, this.#scale));
|
|
3663
3663
|
}
|
|
3664
3664
|
/**
|
|
3665
3665
|
* The subdominant key: the key a fifth below, in the mode this key's third
|
|
@@ -3675,7 +3675,7 @@ var Key = class _Key {
|
|
|
3675
3675
|
* ```
|
|
3676
3676
|
*/
|
|
3677
3677
|
subdominantKey() {
|
|
3678
|
-
return _Key.#fromSpelled(
|
|
3678
|
+
return _Key.#fromSpelled(_chunk3R3QVKY5cjs.subdominantKeyOf.call(void 0, this.#tonic.data, this.#scale));
|
|
3679
3679
|
}
|
|
3680
3680
|
/**
|
|
3681
3681
|
* The same sounding key written the other way round the circle of fifths.
|
|
@@ -3693,7 +3693,7 @@ var Key = class _Key {
|
|
|
3693
3693
|
* ```
|
|
3694
3694
|
*/
|
|
3695
3695
|
enharmonic() {
|
|
3696
|
-
const other =
|
|
3696
|
+
const other = _chunk3R3QVKY5cjs.enharmonicKeyOf.call(void 0, this.#tonic.data, this.#scale);
|
|
3697
3697
|
return other === null ? null : _Key.#fromSpelled(other);
|
|
3698
3698
|
}
|
|
3699
3699
|
/**
|
|
@@ -3724,7 +3724,7 @@ var Key = class _Key {
|
|
|
3724
3724
|
* ```
|
|
3725
3725
|
*/
|
|
3726
3726
|
relatedKeys() {
|
|
3727
|
-
return
|
|
3727
|
+
return _chunk3R3QVKY5cjs.relatedKeysOf.call(void 0, this.#tonic.data, this.#scale).map(({ relation, ...spelled }) => ({
|
|
3728
3728
|
relation,
|
|
3729
3729
|
key: _Key.#fromSpelled(spelled)
|
|
3730
3730
|
}));
|
|
@@ -3751,7 +3751,7 @@ var Key = class _Key {
|
|
|
3751
3751
|
* ```
|
|
3752
3752
|
*/
|
|
3753
3753
|
relationTo(other) {
|
|
3754
|
-
return
|
|
3754
|
+
return _chunk3R3QVKY5cjs.keyRelationBetween.call(void 0, this.toJSON(), other.toJSON());
|
|
3755
3755
|
}
|
|
3756
3756
|
/**
|
|
3757
3757
|
* The chords a modulation from this key into another can pivot on.
|
|
@@ -3778,7 +3778,7 @@ var Key = class _Key {
|
|
|
3778
3778
|
*/
|
|
3779
3779
|
pivotsTo(other) {
|
|
3780
3780
|
assertKeyArgument(other, "key");
|
|
3781
|
-
return
|
|
3781
|
+
return _chunkSGLEQVJHcjs.pivotChords.call(void 0, this.#scale, other).map(({ chord, romanFrom, romanTo }) => ({
|
|
3782
3782
|
chord: new Chord(chord, this),
|
|
3783
3783
|
romanFrom,
|
|
3784
3784
|
romanTo
|
|
@@ -3800,7 +3800,7 @@ var Key = class _Key {
|
|
|
3800
3800
|
*/
|
|
3801
3801
|
degree(n) {
|
|
3802
3802
|
const notes = this.notes();
|
|
3803
|
-
|
|
3803
|
+
_chunkS5BKZZGMcjs.assertInteger.call(void 0, n, "degree", 1, notes.length);
|
|
3804
3804
|
return _nullishCoalesce(notes[n - 1], () => ( this.#tonic));
|
|
3805
3805
|
}
|
|
3806
3806
|
/**
|
|
@@ -3851,12 +3851,12 @@ var Key = class _Key {
|
|
|
3851
3851
|
*/
|
|
3852
3852
|
keyHavingTonicAsDegree(n, mode) {
|
|
3853
3853
|
const resolved = _nullishCoalesce(mode, () => ( (this.isMinor ? "minor" : "major")));
|
|
3854
|
-
const reference =
|
|
3855
|
-
|
|
3854
|
+
const reference = _chunk3R3QVKY5cjs.spellScale.call(void 0, REFERENCE_TONIC, resolved === "minor" ? _chunk3R3QVKY5cjs.minorKey.call(void 0, 0) : _chunk3R3QVKY5cjs.majorKey.call(void 0, 0));
|
|
3855
|
+
_chunkS5BKZZGMcjs.assertInteger.call(void 0, n, "degree", 1, reference.length);
|
|
3856
3856
|
const first = reference[0];
|
|
3857
|
-
const step =
|
|
3857
|
+
const step = _chunkS5BKZZGMcjs.spelledInterval.call(void 0, first, reference[n - 1]);
|
|
3858
3858
|
const tonic = new Note(
|
|
3859
|
-
|
|
3859
|
+
_chunkS5BKZZGMcjs.transposeByInterval.call(void 0, this.#tonic.data, {
|
|
3860
3860
|
number: step.number,
|
|
3861
3861
|
quality: step.quality,
|
|
3862
3862
|
// Negating a zero span yields -0, which compares unequal to 0.
|
|
@@ -3876,7 +3876,7 @@ var Key = class _Key {
|
|
|
3876
3876
|
*/
|
|
3877
3877
|
static #modeOn(mode, tonic) {
|
|
3878
3878
|
const rootPc = tonic.pitchClass;
|
|
3879
|
-
return new _Key(mode === "minor" ?
|
|
3879
|
+
return new _Key(mode === "minor" ? _chunk3R3QVKY5cjs.minorKey.call(void 0, rootPc) : _chunk3R3QVKY5cjs.majorKey.call(void 0, rootPc), tonic).#asWritten();
|
|
3880
3880
|
}
|
|
3881
3881
|
/**
|
|
3882
3882
|
* The mode a scale degree implies, read off its diatonic triad. Scales that
|
|
@@ -3887,7 +3887,7 @@ var Key = class _Key {
|
|
|
3887
3887
|
if (this.pitchClasses().length !== HEPTATONIC_DEGREES) {
|
|
3888
3888
|
return this.isMinor ? "minor" : "major";
|
|
3889
3889
|
}
|
|
3890
|
-
const { quality } =
|
|
3890
|
+
const { quality } = _chunk3R3QVKY5cjs.diatonicTriad.call(void 0, n, this.#scale);
|
|
3891
3891
|
return quality === "min" || quality === "dim" ? "minor" : "major";
|
|
3892
3892
|
}
|
|
3893
3893
|
/**
|
|
@@ -3911,10 +3911,10 @@ var Key = class _Key {
|
|
|
3911
3911
|
* ```
|
|
3912
3912
|
*/
|
|
3913
3913
|
transposeBy(interval) {
|
|
3914
|
-
const step =
|
|
3914
|
+
const step = _chunkS5BKZZGMcjs.toSpelledInterval.call(void 0, interval);
|
|
3915
3915
|
return new _Key(
|
|
3916
|
-
{ rootPc:
|
|
3917
|
-
new Note(
|
|
3916
|
+
{ rootPc: _chunkS5BKZZGMcjs.pitchClassOf.call(void 0, this.#scale.rootPc + step.semitones), modeMask12: this.#scale.modeMask12 },
|
|
3917
|
+
new Note(_chunkS5BKZZGMcjs.transposeByInterval.call(void 0, this.#tonic.data, step)),
|
|
3918
3918
|
this.#variant
|
|
3919
3919
|
);
|
|
3920
3920
|
}
|
|
@@ -3962,8 +3962,8 @@ var Key = class _Key {
|
|
|
3962
3962
|
* ```
|
|
3963
3963
|
*/
|
|
3964
3964
|
transpose(semitones) {
|
|
3965
|
-
|
|
3966
|
-
const rootPc =
|
|
3965
|
+
_chunkS5BKZZGMcjs.assertFiniteNumber.call(void 0, semitones, "semitones");
|
|
3966
|
+
const rootPc = _chunkS5BKZZGMcjs.pitchClassOf.call(void 0, this.#scale.rootPc + Math.round(semitones));
|
|
3967
3967
|
const scale = { rootPc, modeMask12: this.#scale.modeMask12 };
|
|
3968
3968
|
return new _Key(scale, this.#tonic.transpose(semitones), this.#variant).#asWritten();
|
|
3969
3969
|
}
|
|
@@ -3987,9 +3987,9 @@ var Key = class _Key {
|
|
|
3987
3987
|
if (this.#isWritten()) {
|
|
3988
3988
|
return this;
|
|
3989
3989
|
}
|
|
3990
|
-
const other =
|
|
3990
|
+
const other = _chunk3R3QVKY5cjs.enharmonicKeyOf.call(void 0, this.#tonic.data, this.#scale);
|
|
3991
3991
|
const respelled = other === null ? null : new Note(other.tonic);
|
|
3992
|
-
return respelled === null || respelled.pitchClass !==
|
|
3992
|
+
return respelled === null || respelled.pitchClass !== _chunkS5BKZZGMcjs.pitchClassOf.call(void 0, this.#scale.rootPc) ? this : new _Key(this.#scale, respelled, this.#variant);
|
|
3993
3993
|
}
|
|
3994
3994
|
/**
|
|
3995
3995
|
* Whether this key is spelled the way keys are actually written, which is
|
|
@@ -4003,7 +4003,7 @@ var Key = class _Key {
|
|
|
4003
4003
|
* drawn from the mode itself disagree.
|
|
4004
4004
|
*/
|
|
4005
4005
|
#isWritten() {
|
|
4006
|
-
return
|
|
4006
|
+
return _chunk3R3QVKY5cjs.isWrittenTonic.call(void 0, this.#tonic.data, this.#scale);
|
|
4007
4007
|
}
|
|
4008
4008
|
/**
|
|
4009
4009
|
* The key a transposing instrument's part is written in, for this key at
|
|
@@ -4039,7 +4039,7 @@ var Key = class _Key {
|
|
|
4039
4039
|
* ```
|
|
4040
4040
|
*/
|
|
4041
4041
|
forInstrument(instrument) {
|
|
4042
|
-
const tonic = new Note(
|
|
4042
|
+
const tonic = new Note(_chunk76ZBTRG2cjs.toWrittenPitch.call(void 0, this.#tonic.data, instrument));
|
|
4043
4043
|
return new _Key(
|
|
4044
4044
|
{ rootPc: tonic.pitchClass, modeMask12: this.#scale.modeMask12 },
|
|
4045
4045
|
tonic,
|
|
@@ -4052,7 +4052,7 @@ var Key = class _Key {
|
|
|
4052
4052
|
* @returns Spelled octave-less notes in scale-degree order.
|
|
4053
4053
|
*/
|
|
4054
4054
|
notes() {
|
|
4055
|
-
return
|
|
4055
|
+
return _chunk3R3QVKY5cjs.spellScale.call(void 0, this.#tonic.data, this.#scale).map((note) => new Note(note));
|
|
4056
4056
|
}
|
|
4057
4057
|
/**
|
|
4058
4058
|
* Alias of {@link Key.notes}.
|
|
@@ -4106,8 +4106,8 @@ var Key = class _Key {
|
|
|
4106
4106
|
* ```
|
|
4107
4107
|
*/
|
|
4108
4108
|
spellPitchClasses(pcs, tonic) {
|
|
4109
|
-
const anchor = tonic === void 0 ? this.#tonic.data :
|
|
4110
|
-
return
|
|
4109
|
+
const anchor = tonic === void 0 ? this.#tonic.data : _chunkS5BKZZGMcjs.toNoteData.call(void 0, tonic);
|
|
4110
|
+
return _chunk3R3QVKY5cjs.spellPitchClasses.call(void 0, [...pcs], anchor, this.#scale).map((note) => new Note(note));
|
|
4111
4111
|
}
|
|
4112
4112
|
/**
|
|
4113
4113
|
* Build a chord on a scale degree, carrying this key as context.
|
|
@@ -4126,7 +4126,7 @@ var Key = class _Key {
|
|
|
4126
4126
|
* an explicit `quality` for those.
|
|
4127
4127
|
*/
|
|
4128
4128
|
chord(degree, quality) {
|
|
4129
|
-
const data = quality === void 0 ?
|
|
4129
|
+
const data = quality === void 0 ? _chunk3R3QVKY5cjs.diatonicTriad.call(void 0, degree, this.#scale) : _chunk3R3QVKY5cjs.chordFromDegree.call(void 0, degree, quality, this.#scale);
|
|
4130
4130
|
return new Chord(data, this);
|
|
4131
4131
|
}
|
|
4132
4132
|
/**
|
|
@@ -4139,7 +4139,7 @@ var Key = class _Key {
|
|
|
4139
4139
|
* degrees. Use {@link Key.chord} with an explicit quality instead.
|
|
4140
4140
|
*/
|
|
4141
4141
|
diatonicTriad(degree) {
|
|
4142
|
-
return new Chord(
|
|
4142
|
+
return new Chord(_chunk3R3QVKY5cjs.diatonicTriad.call(void 0, degree, this.#scale), this);
|
|
4143
4143
|
}
|
|
4144
4144
|
/**
|
|
4145
4145
|
* The diatonic seventh chord on a scale degree, carrying this key as context.
|
|
@@ -4151,7 +4151,7 @@ var Key = class _Key {
|
|
|
4151
4151
|
* degrees. Use {@link Key.chord} with an explicit quality instead.
|
|
4152
4152
|
*/
|
|
4153
4153
|
diatonicSeventh(degree) {
|
|
4154
|
-
return new Chord(
|
|
4154
|
+
return new Chord(_chunk3R3QVKY5cjs.diatonicSeventh.call(void 0, degree, this.#scale), this);
|
|
4155
4155
|
}
|
|
4156
4156
|
/**
|
|
4157
4157
|
* Build the chord denoted by a Roman numeral in this key (including applied
|
|
@@ -4162,7 +4162,7 @@ var Key = class _Key {
|
|
|
4162
4162
|
* @throws If the numeral is not valid.
|
|
4163
4163
|
*/
|
|
4164
4164
|
roman(text) {
|
|
4165
|
-
return new Chord(
|
|
4165
|
+
return new Chord(_chunkSGLEQVJHcjs.romanToChord.call(void 0, text, this), this);
|
|
4166
4166
|
}
|
|
4167
4167
|
/**
|
|
4168
4168
|
* The augmented sixth chord of a kind, built in this key.
|
|
@@ -4183,7 +4183,7 @@ var Key = class _Key {
|
|
|
4183
4183
|
* ```
|
|
4184
4184
|
*/
|
|
4185
4185
|
augmentedSixth(kind) {
|
|
4186
|
-
return new Chord(
|
|
4186
|
+
return new Chord(_chunkSGLEQVJHcjs.augmentedSixthChord.call(void 0, kind, keyIdentity(this)), this);
|
|
4187
4187
|
}
|
|
4188
4188
|
/**
|
|
4189
4189
|
* Build a progression from Roman numerals in this key.
|
|
@@ -4216,7 +4216,7 @@ var Key = class _Key {
|
|
|
4216
4216
|
* @returns True if the pitch class is a scale tone.
|
|
4217
4217
|
*/
|
|
4218
4218
|
contains(x) {
|
|
4219
|
-
return
|
|
4219
|
+
return _chunk3R3QVKY5cjs.isScaleTone.call(void 0, typeof x === "number" ? x : x.pitchClass, this.#scale);
|
|
4220
4220
|
}
|
|
4221
4221
|
/**
|
|
4222
4222
|
* The nearest MIDI pitch whose pitch class is in the scale.
|
|
@@ -4235,7 +4235,7 @@ var Key = class _Key {
|
|
|
4235
4235
|
* ```
|
|
4236
4236
|
*/
|
|
4237
4237
|
nearestTone(pitch) {
|
|
4238
|
-
return
|
|
4238
|
+
return _chunk3R3QVKY5cjs.nearestScaleTone.call(void 0, pitch, this.#scale);
|
|
4239
4239
|
}
|
|
4240
4240
|
/**
|
|
4241
4241
|
* The scale degree a pitch sits on, counted from 1: the tonic is degree 1.
|
|
@@ -4253,7 +4253,7 @@ var Key = class _Key {
|
|
|
4253
4253
|
* ```
|
|
4254
4254
|
*/
|
|
4255
4255
|
degreeOf(pitch) {
|
|
4256
|
-
const degree =
|
|
4256
|
+
const degree = _chunk3R3QVKY5cjs.pitchToScaleDegree.call(void 0, pitch, this.#scale);
|
|
4257
4257
|
return degree === -1 ? null : degree;
|
|
4258
4258
|
}
|
|
4259
4259
|
/**
|
|
@@ -4300,7 +4300,7 @@ var Key = class _Key {
|
|
|
4300
4300
|
*/
|
|
4301
4301
|
toString(opts) {
|
|
4302
4302
|
if (_optionalChain([opts, 'optionalAccess', _32 => _32.system]) !== void 0 && opts.system !== "english") {
|
|
4303
|
-
return
|
|
4303
|
+
return _chunkS5BKZZGMcjs.formatKeyName.call(void 0,
|
|
4304
4304
|
{ tonic: this.#tonic.data, mode: this.isMinor ? "minor" : "major" },
|
|
4305
4305
|
opts
|
|
4306
4306
|
);
|
|
@@ -4317,13 +4317,13 @@ function toKey(value) {
|
|
|
4317
4317
|
if (typeof data === "object" && data !== null) {
|
|
4318
4318
|
const record = data;
|
|
4319
4319
|
if (record.scale === void 0) {
|
|
4320
|
-
const scale =
|
|
4320
|
+
const scale = _chunk3R3QVKY5cjs.toKeyScale.call(void 0, data);
|
|
4321
4321
|
return record.tonic === void 0 ? new Key(scale, spelledTonicFor(scale), record.variant) : new Key(scale, new Note(record.tonic), record.variant);
|
|
4322
4322
|
}
|
|
4323
|
-
return record.tonic === void 0 ? Key.of(
|
|
4323
|
+
return record.tonic === void 0 ? Key.of(_chunk3R3QVKY5cjs.toKeyScale.call(void 0, record.scale)) : Key.fromJSON(record);
|
|
4324
4324
|
}
|
|
4325
4325
|
}
|
|
4326
|
-
throw new (0,
|
|
4326
|
+
throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)(`key must be a key name or a key/scale; received ${typeof value}`);
|
|
4327
4327
|
}
|
|
4328
4328
|
function keyIdentity(key) {
|
|
4329
4329
|
return { scale: key.scale, tonic: key.tonic.data, variant: key.variant };
|
|
@@ -4351,7 +4351,7 @@ function copyMeters(meters) {
|
|
|
4351
4351
|
}
|
|
4352
4352
|
function copyTempo(tempo) {
|
|
4353
4353
|
assertDataObjects(tempo, "score tempo");
|
|
4354
|
-
|
|
4354
|
+
_chunkNM7UAMC3cjs.tempoAt.call(void 0, 0, tempo);
|
|
4355
4355
|
return tempo.map((event) => ({
|
|
4356
4356
|
startBeat: withoutNegativeZero(event.startBeat),
|
|
4357
4357
|
bpm: event.bpm
|
|
@@ -4363,7 +4363,7 @@ function copyScore(data) {
|
|
|
4363
4363
|
notes: orderNotes(data.notes, "score notes"),
|
|
4364
4364
|
// The map is validated by the same resolver every meter-aware entry point
|
|
4365
4365
|
// reads its options through, so a score accepts exactly what they accept.
|
|
4366
|
-
meters: copyMeters(
|
|
4366
|
+
meters: copyMeters(_chunkS5BKZZGMcjs.resolveMeters.call(void 0, { meters: data.meters }, "score meters")),
|
|
4367
4367
|
tempo: copyTempo(data.tempo)
|
|
4368
4368
|
};
|
|
4369
4369
|
if (data.key !== void 0) {
|
|
@@ -4396,7 +4396,7 @@ function statedKeyRegions(key, notes, totalBeats) {
|
|
|
4396
4396
|
function scoreData(notes, opts) {
|
|
4397
4397
|
const data = {
|
|
4398
4398
|
notes: [...assertDataArray(notes, "score notes")],
|
|
4399
|
-
meters:
|
|
4399
|
+
meters: _chunkS5BKZZGMcjs.resolveMeters.call(void 0, { meters: _optionalChain([opts, 'optionalAccess', _33 => _33.meters]) }, "score meters"),
|
|
4400
4400
|
tempo: tempoFrom(_optionalChain([opts, 'optionalAccess', _34 => _34.tempo]))
|
|
4401
4401
|
};
|
|
4402
4402
|
if (_optionalChain([opts, 'optionalAccess', _35 => _35.key]) !== void 0) {
|
|
@@ -4471,8 +4471,8 @@ var Score = class _Score {
|
|
|
4471
4471
|
static fromTicks(events, ppq, opts) {
|
|
4472
4472
|
const notes = assertDataObjects(events, "score notes").map((event) => ({
|
|
4473
4473
|
...event,
|
|
4474
|
-
startBeat:
|
|
4475
|
-
durationBeat:
|
|
4474
|
+
startBeat: _chunkNM7UAMC3cjs.ticksToBeats.call(void 0, event.startBeat, ppq),
|
|
4475
|
+
durationBeat: _chunkNM7UAMC3cjs.ticksToBeats.call(void 0, event.durationBeat, ppq)
|
|
4476
4476
|
}));
|
|
4477
4477
|
return new _Score(scoreData(notes, opts));
|
|
4478
4478
|
}
|
|
@@ -4521,8 +4521,8 @@ var Score = class _Score {
|
|
|
4521
4521
|
* @returns The score holding those notes.
|
|
4522
4522
|
*/
|
|
4523
4523
|
slice(fromBeat, toBeat) {
|
|
4524
|
-
|
|
4525
|
-
|
|
4524
|
+
_chunkS5BKZZGMcjs.assertFiniteNumber.call(void 0, fromBeat, "slice fromBeat");
|
|
4525
|
+
_chunkS5BKZZGMcjs.assertFiniteNumber.call(void 0, toBeat, "slice toBeat");
|
|
4526
4526
|
return this.#withNotes(
|
|
4527
4527
|
this.#data.notes.filter((note) => note.startBeat >= fromBeat && note.startBeat < toBeat)
|
|
4528
4528
|
);
|
|
@@ -4554,7 +4554,7 @@ var Score = class _Score {
|
|
|
4554
4554
|
* @returns The moved score.
|
|
4555
4555
|
*/
|
|
4556
4556
|
shift(beats) {
|
|
4557
|
-
|
|
4557
|
+
_chunkS5BKZZGMcjs.assertFiniteNumber.call(void 0, beats, "shift beats");
|
|
4558
4558
|
return this.#withNotes(
|
|
4559
4559
|
this.#data.notes.map((note) => ({ ...note, startBeat: note.startBeat + beats }))
|
|
4560
4560
|
);
|
|
@@ -4572,7 +4572,7 @@ var Score = class _Score {
|
|
|
4572
4572
|
* @throws If a note would leave the MIDI range.
|
|
4573
4573
|
*/
|
|
4574
4574
|
transpose(semitones) {
|
|
4575
|
-
|
|
4575
|
+
_chunkS5BKZZGMcjs.assertFiniteNumber.call(void 0, semitones, "transpose semitones");
|
|
4576
4576
|
return this.#moved(
|
|
4577
4577
|
this.#data.notes.map((note) => ({ ...note, pitch: note.pitch + semitones })),
|
|
4578
4578
|
(key) => key.transpose(semitones)
|
|
@@ -4592,7 +4592,7 @@ var Score = class _Score {
|
|
|
4592
4592
|
* @returns The transposed score.
|
|
4593
4593
|
*/
|
|
4594
4594
|
transposeBy(interval) {
|
|
4595
|
-
const step =
|
|
4595
|
+
const step = _chunkS5BKZZGMcjs.toSpelledInterval.call(void 0, interval);
|
|
4596
4596
|
return this.#moved(
|
|
4597
4597
|
this.#data.notes.map((note) => ({ ...note, pitch: note.pitch + step.semitones })),
|
|
4598
4598
|
// Moved by the interval rather than by its semitone count, so a key taken
|
|
@@ -4603,7 +4603,7 @@ var Score = class _Score {
|
|
|
4603
4603
|
}
|
|
4604
4604
|
/** The same notes read against a different meter. */
|
|
4605
4605
|
withMeters(meters) {
|
|
4606
|
-
return new _Score({ ...this.#data, meters:
|
|
4606
|
+
return new _Score({ ...this.#data, meters: _chunkS5BKZZGMcjs.resolveMeters.call(void 0, { meters }, "score meters") });
|
|
4607
4607
|
}
|
|
4608
4608
|
/** The same notes read against a different tempo. */
|
|
4609
4609
|
withTempo(tempo) {
|
|
@@ -4632,7 +4632,7 @@ var Score = class _Score {
|
|
|
4632
4632
|
* ```
|
|
4633
4633
|
*/
|
|
4634
4634
|
quantize(grid) {
|
|
4635
|
-
|
|
4635
|
+
_chunkS5BKZZGMcjs.assertRange.call(void 0, grid, Number.MIN_VALUE, Number.MAX_SAFE_INTEGER, "quantize grid");
|
|
4636
4636
|
return this.#withNotes(
|
|
4637
4637
|
this.#data.notes.map((note) => ({
|
|
4638
4638
|
...note,
|
|
@@ -4653,7 +4653,7 @@ var Score = class _Score {
|
|
|
4653
4653
|
* @returns The humanized score.
|
|
4654
4654
|
*/
|
|
4655
4655
|
humanize(opts) {
|
|
4656
|
-
return this.#withNotes(
|
|
4656
|
+
return this.#withNotes(_chunkJ7FHVZIIcjs.humanize.call(void 0, this.#data.notes, { ts: this.meterAt(0), ...opts }));
|
|
4657
4657
|
}
|
|
4658
4658
|
/**
|
|
4659
4659
|
* The notes with ornaments added.
|
|
@@ -4666,7 +4666,7 @@ var Score = class _Score {
|
|
|
4666
4666
|
* @returns The ornamented score.
|
|
4667
4667
|
*/
|
|
4668
4668
|
ornament(opts) {
|
|
4669
|
-
return this.#withNotes(
|
|
4669
|
+
return this.#withNotes(_chunkJ7FHVZIIcjs.ornament.call(void 0, this.#data.notes, { ts: this.meterAt(0), ...opts }));
|
|
4670
4670
|
}
|
|
4671
4671
|
/**
|
|
4672
4672
|
* The notes placed on a groove template's slots.
|
|
@@ -4680,7 +4680,7 @@ var Score = class _Score {
|
|
|
4680
4680
|
* @throws If the template was extracted under another meter.
|
|
4681
4681
|
*/
|
|
4682
4682
|
groove(template) {
|
|
4683
|
-
return this.#withNotes(
|
|
4683
|
+
return this.#withNotes(_chunkJ7FHVZIIcjs.applyGrooveTemplate.call(void 0, this.#data.notes, template, this.meterAt(0)));
|
|
4684
4684
|
}
|
|
4685
4685
|
/**
|
|
4686
4686
|
* The feel of the score's own timing, as a template another score can take on.
|
|
@@ -4704,7 +4704,7 @@ var Score = class _Score {
|
|
|
4704
4704
|
* ```
|
|
4705
4705
|
*/
|
|
4706
4706
|
grooveTemplate(subdivision) {
|
|
4707
|
-
return
|
|
4707
|
+
return _chunkJ7FHVZIIcjs.extractGrooveTemplate.call(void 0, this.#data.notes, this.meterAt(0), subdivision);
|
|
4708
4708
|
}
|
|
4709
4709
|
/**
|
|
4710
4710
|
* The harmony the notes spell out, in time.
|
|
@@ -4717,7 +4717,7 @@ var Score = class _Score {
|
|
|
4717
4717
|
* and how sure it is of each segment.
|
|
4718
4718
|
*/
|
|
4719
4719
|
timeline(opts) {
|
|
4720
|
-
const result = opts === void 0 ? this.#chordAnalysis() :
|
|
4720
|
+
const result = opts === void 0 ? this.#chordAnalysis() : _chunkSGLEQVJHcjs.chordTimelineFromNotes.call(void 0, this.#data.notes, this.#analysisOptions(opts));
|
|
4721
4721
|
return Timeline.fromData({
|
|
4722
4722
|
segments: result.timeline.segments,
|
|
4723
4723
|
totalBeats: _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _36 => _36.totalBeats]), () => ( this.totalBeats)),
|
|
@@ -4739,7 +4739,7 @@ var Score = class _Score {
|
|
|
4739
4739
|
if (this.#key !== void 0) {
|
|
4740
4740
|
return this.#key;
|
|
4741
4741
|
}
|
|
4742
|
-
const prevailing =
|
|
4742
|
+
const prevailing = _chunkSGLEQVJHcjs.prevailingKeyOf.call(void 0, this.#keyRegions());
|
|
4743
4743
|
return prevailing === null ? void 0 : toKey(prevailing);
|
|
4744
4744
|
}
|
|
4745
4745
|
/**
|
|
@@ -4760,7 +4760,7 @@ var Score = class _Score {
|
|
|
4760
4760
|
if (this.#key !== void 0) {
|
|
4761
4761
|
return statedKeyRegions(this.#key, this.#data.notes, _nullishCoalesce(opts.totalBeats, () => ( this.totalBeats)));
|
|
4762
4762
|
}
|
|
4763
|
-
return
|
|
4763
|
+
return _chunkSGLEQVJHcjs.keyTimelineFromNotes.call(void 0, this.#data.notes, { meters: this.#data.meters, ...opts });
|
|
4764
4764
|
}
|
|
4765
4765
|
return this.#keyRegions().map(copyKeyRegion);
|
|
4766
4766
|
}
|
|
@@ -4788,7 +4788,7 @@ var Score = class _Score {
|
|
|
4788
4788
|
* ```
|
|
4789
4789
|
*/
|
|
4790
4790
|
detectKeys(opts) {
|
|
4791
|
-
return
|
|
4791
|
+
return _chunkSGLEQVJHcjs.detectKeyFromNotes.call(void 0, this.#data.notes, opts).map(detectedKeyMatch);
|
|
4792
4792
|
}
|
|
4793
4793
|
/**
|
|
4794
4794
|
* The phrases the notes fall into.
|
|
@@ -4800,7 +4800,7 @@ var Score = class _Score {
|
|
|
4800
4800
|
* @returns The phrases, in time order.
|
|
4801
4801
|
*/
|
|
4802
4802
|
phrases(opts) {
|
|
4803
|
-
return
|
|
4803
|
+
return _chunkHPVSH7SFcjs.phrasesFromTimeline.call(void 0, this.#chordTimeline(), this.#data.notes, {
|
|
4804
4804
|
meters: this.#data.meters,
|
|
4805
4805
|
...this.#key === void 0 ? {} : { key: keyIdentity(this.#key) },
|
|
4806
4806
|
...opts
|
|
@@ -4820,7 +4820,7 @@ var Score = class _Score {
|
|
|
4820
4820
|
* @returns The cadences, heaviest first; ties keep the earlier one.
|
|
4821
4821
|
*/
|
|
4822
4822
|
structuralCadences(opts) {
|
|
4823
|
-
return
|
|
4823
|
+
return _chunkHPVSH7SFcjs.structuralCadences.call(void 0, this.phrases(opts));
|
|
4824
4824
|
}
|
|
4825
4825
|
/**
|
|
4826
4826
|
* The sections the score divides into.
|
|
@@ -4829,7 +4829,7 @@ var Score = class _Score {
|
|
|
4829
4829
|
* @returns The sections, in time order.
|
|
4830
4830
|
*/
|
|
4831
4831
|
sections(opts) {
|
|
4832
|
-
return
|
|
4832
|
+
return _chunkHPVSH7SFcjs.sectionsFromNotes.call(void 0, this.#data.notes, { meters: this.#data.meters, ...opts });
|
|
4833
4833
|
}
|
|
4834
4834
|
/**
|
|
4835
4835
|
* The bar-level pulse above the meter.
|
|
@@ -4842,7 +4842,7 @@ var Score = class _Score {
|
|
|
4842
4842
|
* @returns The grouping, its downbeats, a confidence, and a rationale.
|
|
4843
4843
|
*/
|
|
4844
4844
|
hypermeter(opts) {
|
|
4845
|
-
return
|
|
4845
|
+
return _chunkHPVSH7SFcjs.hypermeter.call(void 0, this.#data.notes, this.#data.meters, {
|
|
4846
4846
|
cadenceBeats: this.#cadenceBeats(),
|
|
4847
4847
|
...opts
|
|
4848
4848
|
});
|
|
@@ -4884,7 +4884,7 @@ var Score = class _Score {
|
|
|
4884
4884
|
* ```
|
|
4885
4885
|
*/
|
|
4886
4886
|
motifs(opts) {
|
|
4887
|
-
return
|
|
4887
|
+
return _chunkHPVSH7SFcjs.extractMotifs.call(void 0, this.#data.notes, opts);
|
|
4888
4888
|
}
|
|
4889
4889
|
/**
|
|
4890
4890
|
* The shape the melody traces.
|
|
@@ -4896,7 +4896,7 @@ var Score = class _Score {
|
|
|
4896
4896
|
* answered for; {@link Score.voices} is what reads the polyphony as polyphony.
|
|
4897
4897
|
*/
|
|
4898
4898
|
contour() {
|
|
4899
|
-
return
|
|
4899
|
+
return _chunkHPVSH7SFcjs.melodicContour.call(void 0, this.#data.notes);
|
|
4900
4900
|
}
|
|
4901
4901
|
/**
|
|
4902
4902
|
* Each note's role in the harmony sounding under it.
|
|
@@ -4920,7 +4920,7 @@ var Score = class _Score {
|
|
|
4920
4920
|
*/
|
|
4921
4921
|
voices(key) {
|
|
4922
4922
|
const timeline = this.#chordTimeline();
|
|
4923
|
-
return
|
|
4923
|
+
return _chunkHPVSH7SFcjs.analyzePolyphony.call(void 0, this.#data.notes, timeline.at, this.#keyContext(key));
|
|
4924
4924
|
}
|
|
4925
4925
|
/**
|
|
4926
4926
|
* The notes carrying the ids the voice analysis reports them back under.
|
|
@@ -4934,7 +4934,7 @@ var Score = class _Score {
|
|
|
4934
4934
|
* @returns One voice note per note, in the score's own time order.
|
|
4935
4935
|
*/
|
|
4936
4936
|
voiceNotes() {
|
|
4937
|
-
return
|
|
4937
|
+
return _chunkSGLEQVJHcjs.toVoiceNotes.call(void 0, this.#data.notes);
|
|
4938
4938
|
}
|
|
4939
4939
|
/**
|
|
4940
4940
|
* Whether an instrument can play the score, and what makes it hard.
|
|
@@ -4958,14 +4958,14 @@ var Score = class _Score {
|
|
|
4958
4958
|
* ```
|
|
4959
4959
|
*/
|
|
4960
4960
|
playability(instrument) {
|
|
4961
|
-
const profile =
|
|
4961
|
+
const profile = _chunkCGBADIO5cjs.toInstrumentProfile.call(void 0, instrument);
|
|
4962
4962
|
const tempo = this.#data.tempo;
|
|
4963
|
-
const openingBpm =
|
|
4963
|
+
const openingBpm = _chunkNM7UAMC3cjs.tempoAt.call(void 0, 0, tempo);
|
|
4964
4964
|
if (tempo.length < 2) {
|
|
4965
|
-
return
|
|
4965
|
+
return _chunkCGBADIO5cjs.playability.call(void 0, this.#data.notes, profile, openingBpm);
|
|
4966
4966
|
}
|
|
4967
|
-
const played =
|
|
4968
|
-
const evenly =
|
|
4967
|
+
const played = _chunkNM7UAMC3cjs.tempoReader.call(void 0, tempo);
|
|
4968
|
+
const evenly = _chunkNM7UAMC3cjs.tempoReader.call(void 0, [{ startBeat: 0, bpm: openingBpm }]);
|
|
4969
4969
|
const restate = (beat) => evenly.beatAt(played.secondsAt(beat));
|
|
4970
4970
|
const scoreBeats = /* @__PURE__ */ new Map();
|
|
4971
4971
|
const evenlyPaced = this.#data.notes.map((note) => {
|
|
@@ -4977,7 +4977,7 @@ var Score = class _Score {
|
|
|
4977
4977
|
durationBeat: restate(note.startBeat + note.durationBeat) - startBeat
|
|
4978
4978
|
};
|
|
4979
4979
|
});
|
|
4980
|
-
const report =
|
|
4980
|
+
const report = _chunkCGBADIO5cjs.playability.call(void 0, evenlyPaced, profile, openingBpm);
|
|
4981
4981
|
return {
|
|
4982
4982
|
...report,
|
|
4983
4983
|
issues: report.issues.map((issue) => ({
|
|
@@ -4993,7 +4993,7 @@ var Score = class _Score {
|
|
|
4993
4993
|
* @returns The index.
|
|
4994
4994
|
*/
|
|
4995
4995
|
index(opts) {
|
|
4996
|
-
return
|
|
4996
|
+
return _chunk35NBV2FTcjs.createNoteEventIndex.call(void 0, this.#data.notes, {
|
|
4997
4997
|
allowNonPositiveDuration: true,
|
|
4998
4998
|
name: "score notes",
|
|
4999
4999
|
...opts
|
|
@@ -5010,7 +5010,7 @@ var Score = class _Score {
|
|
|
5010
5010
|
* @returns Elapsed seconds from the tempo map's origin.
|
|
5011
5011
|
*/
|
|
5012
5012
|
secondsAt(beat) {
|
|
5013
|
-
return
|
|
5013
|
+
return _chunkNM7UAMC3cjs.beatsToSeconds.call(void 0, beat, this.#data.tempo);
|
|
5014
5014
|
}
|
|
5015
5015
|
/**
|
|
5016
5016
|
* Where a beat falls in bars, read through the meter map.
|
|
@@ -5020,7 +5020,7 @@ var Score = class _Score {
|
|
|
5020
5020
|
* reports bar -1.
|
|
5021
5021
|
*/
|
|
5022
5022
|
barAt(beat) {
|
|
5023
|
-
return
|
|
5023
|
+
return _chunkS5BKZZGMcjs.beatToBarPosition.call(void 0, beat, this.#data.meters);
|
|
5024
5024
|
}
|
|
5025
5025
|
/**
|
|
5026
5026
|
* The time signature sounding at a beat.
|
|
@@ -5029,7 +5029,7 @@ var Score = class _Score {
|
|
|
5029
5029
|
* @returns The signature in force there.
|
|
5030
5030
|
*/
|
|
5031
5031
|
meterAt(beat) {
|
|
5032
|
-
return
|
|
5032
|
+
return _chunkS5BKZZGMcjs.meterAt.call(void 0, beat, this.#data.meters);
|
|
5033
5033
|
}
|
|
5034
5034
|
/**
|
|
5035
5035
|
* The score's beats as MIDI ticks, for a writer that counts in them.
|
|
@@ -5040,8 +5040,8 @@ var Score = class _Score {
|
|
|
5040
5040
|
toTicks(ppq) {
|
|
5041
5041
|
return this.#data.notes.map((note) => ({
|
|
5042
5042
|
...note,
|
|
5043
|
-
startBeat:
|
|
5044
|
-
durationBeat:
|
|
5043
|
+
startBeat: _chunkNM7UAMC3cjs.beatsToTicks.call(void 0, note.startBeat, ppq),
|
|
5044
|
+
durationBeat: _chunkNM7UAMC3cjs.beatsToTicks.call(void 0, note.durationBeat, ppq)
|
|
5045
5045
|
}));
|
|
5046
5046
|
}
|
|
5047
5047
|
/**
|
|
@@ -5114,7 +5114,7 @@ var Score = class _Score {
|
|
|
5114
5114
|
* Score.timeline} hands all three to the class it builds.
|
|
5115
5115
|
*/
|
|
5116
5116
|
#chordAnalysis() {
|
|
5117
|
-
const analysis = _nullishCoalesce(this.#chords, () => (
|
|
5117
|
+
const analysis = _nullishCoalesce(this.#chords, () => ( _chunkSGLEQVJHcjs.chordTimelineFromNotes.call(void 0, this.#data.notes, this.#analysisOptions())));
|
|
5118
5118
|
this.#chords = analysis;
|
|
5119
5119
|
return analysis;
|
|
5120
5120
|
}
|
|
@@ -5125,13 +5125,13 @@ var Score = class _Score {
|
|
|
5125
5125
|
* Kept on first reading for the same reason the chord timeline is.
|
|
5126
5126
|
*/
|
|
5127
5127
|
#keyRegions() {
|
|
5128
|
-
const regions = _nullishCoalesce(this.#regions, () => ( (this.#key === void 0 ?
|
|
5128
|
+
const regions = _nullishCoalesce(this.#regions, () => ( (this.#key === void 0 ? _chunkSGLEQVJHcjs.keyTimelineFromNotes.call(void 0, this.#data.notes, { meters: this.#data.meters }) : statedKeyRegions(this.#key, this.#data.notes, this.totalBeats))));
|
|
5129
5129
|
this.#regions = regions;
|
|
5130
5130
|
return regions;
|
|
5131
5131
|
}
|
|
5132
5132
|
/** Where the score's own harmony closes, as beats. */
|
|
5133
5133
|
#cadenceBeats() {
|
|
5134
|
-
return
|
|
5134
|
+
return _chunkSGLEQVJHcjs.detectCadences.call(void 0, this.#chordTimeline(), this.#keyContext(void 0)).map(
|
|
5135
5135
|
(hit) => hit.atBeat
|
|
5136
5136
|
);
|
|
5137
5137
|
}
|
|
@@ -5156,9 +5156,9 @@ var Score = class _Score {
|
|
|
5156
5156
|
return keyIdentity(this.#key);
|
|
5157
5157
|
}
|
|
5158
5158
|
const regions = this.#keyRegions();
|
|
5159
|
-
const prevailing = _nullishCoalesce(
|
|
5160
|
-
const keyAt =
|
|
5161
|
-
return (beat) =>
|
|
5159
|
+
const prevailing = _nullishCoalesce(_chunkSGLEQVJHcjs.prevailingKeyOf.call(void 0, regions), () => ( keyIdentity(Key.major("C"))));
|
|
5160
|
+
const keyAt = _chunkSGLEQVJHcjs.keyLookup.call(void 0, regions, prevailing);
|
|
5161
|
+
return (beat) => _chunk3R3QVKY5cjs.scaleOf.call(void 0, keyAt(beat));
|
|
5162
5162
|
}
|
|
5163
5163
|
};
|
|
5164
5164
|
function sameNote(note, other) {
|
|
@@ -5194,7 +5194,7 @@ function copyTrack(track, index, budget) {
|
|
|
5194
5194
|
copy.name = track.name;
|
|
5195
5195
|
}
|
|
5196
5196
|
if (track.role !== void 0) {
|
|
5197
|
-
copy.role =
|
|
5197
|
+
copy.role = _chunkHPVSH7SFcjs.trackRoleOf.call(void 0, track.role, `tracks[${index}].role`);
|
|
5198
5198
|
}
|
|
5199
5199
|
return copy;
|
|
5200
5200
|
}
|
|
@@ -5215,15 +5215,15 @@ function copySettings(settings, trackCount) {
|
|
|
5215
5215
|
}
|
|
5216
5216
|
assertDataObject(settings, "arrangement settings");
|
|
5217
5217
|
const copy = {};
|
|
5218
|
-
const meters =
|
|
5218
|
+
const meters = _chunkS5BKZZGMcjs.resolveMeters.call(void 0, { ts: settings.ts, meters: settings.meters }, "arrangement meters");
|
|
5219
5219
|
if (settings.ts !== void 0) {
|
|
5220
|
-
copy.ts = copyPlain(
|
|
5220
|
+
copy.ts = copyPlain(_chunkS5BKZZGMcjs.toMeterData.call(void 0, settings.ts, "arrangement ts"), "arrangement ts");
|
|
5221
5221
|
}
|
|
5222
5222
|
if (settings.meters !== void 0) {
|
|
5223
5223
|
copy.meters = copyPlain(meters, "arrangement meters");
|
|
5224
5224
|
}
|
|
5225
5225
|
if (settings.key !== void 0) {
|
|
5226
|
-
copy.key =
|
|
5226
|
+
copy.key = _chunk3R3QVKY5cjs.resolveKey.call(void 0, settings.key);
|
|
5227
5227
|
}
|
|
5228
5228
|
if (settings.keys !== void 0) {
|
|
5229
5229
|
copy.keys = copyKeyRegions(settings.keys);
|
|
@@ -5236,11 +5236,11 @@ function copySettings(settings, trackCount) {
|
|
|
5236
5236
|
settings.harmonyTracks,
|
|
5237
5237
|
"arrangement harmonyTracks"
|
|
5238
5238
|
).map(
|
|
5239
|
-
(track, index) =>
|
|
5239
|
+
(track, index) => _chunkS5BKZZGMcjs.assertInteger.call(void 0, track, `arrangement harmonyTracks[${index}]`, 0, trackCount - 1)
|
|
5240
5240
|
);
|
|
5241
5241
|
}
|
|
5242
5242
|
if (settings.minSeverity !== void 0) {
|
|
5243
|
-
copy.minSeverity =
|
|
5243
|
+
copy.minSeverity = _chunkS5BKZZGMcjs.assertInteger.call(void 0,
|
|
5244
5244
|
settings.minSeverity,
|
|
5245
5245
|
"arrangement minSeverity",
|
|
5246
5246
|
0 /* Safe */,
|
|
@@ -5248,7 +5248,7 @@ function copySettings(settings, trackCount) {
|
|
|
5248
5248
|
);
|
|
5249
5249
|
}
|
|
5250
5250
|
if (settings.pickupBeats !== void 0) {
|
|
5251
|
-
copy.pickupBeats =
|
|
5251
|
+
copy.pickupBeats = _chunkS5BKZZGMcjs.assertRange.call(void 0,
|
|
5252
5252
|
settings.pickupBeats,
|
|
5253
5253
|
0,
|
|
5254
5254
|
Number.MAX_SAFE_INTEGER,
|
|
@@ -5256,7 +5256,7 @@ function copySettings(settings, trackCount) {
|
|
|
5256
5256
|
);
|
|
5257
5257
|
}
|
|
5258
5258
|
if (settings.harmonicRhythm !== void 0) {
|
|
5259
|
-
copy.harmonicRhythm =
|
|
5259
|
+
copy.harmonicRhythm = _chunkS5BKZZGMcjs.assertRange.call(void 0,
|
|
5260
5260
|
settings.harmonicRhythm,
|
|
5261
5261
|
Number.MIN_VALUE,
|
|
5262
5262
|
Number.MAX_SAFE_INTEGER,
|
|
@@ -5267,7 +5267,7 @@ function copySettings(settings, trackCount) {
|
|
|
5267
5267
|
copy.profile = settings.profile;
|
|
5268
5268
|
}
|
|
5269
5269
|
if (settings.budget !== void 0) {
|
|
5270
|
-
copy.budget =
|
|
5270
|
+
copy.budget = _chunkS5BKZZGMcjs.assertPositiveInt.call(void 0, settings.budget, "arrangement budget", Number.MAX_SAFE_INTEGER);
|
|
5271
5271
|
}
|
|
5272
5272
|
return Object.keys(copy).length === 0 ? void 0 : copy;
|
|
5273
5273
|
}
|
|
@@ -5297,10 +5297,10 @@ function settingsFrom(setup) {
|
|
|
5297
5297
|
const { key, meters, timeline, ...rest } = setup;
|
|
5298
5298
|
const settings = { ...rest };
|
|
5299
5299
|
if (key !== void 0) {
|
|
5300
|
-
settings.key =
|
|
5300
|
+
settings.key = _chunk3R3QVKY5cjs.resolveKey.call(void 0, key);
|
|
5301
5301
|
}
|
|
5302
5302
|
if (meters !== void 0) {
|
|
5303
|
-
settings.meters =
|
|
5303
|
+
settings.meters = _chunkS5BKZZGMcjs.resolveMeters.call(void 0, { meters }, "arrangement meters");
|
|
5304
5304
|
}
|
|
5305
5305
|
if (timeline !== void 0) {
|
|
5306
5306
|
assertDataObject(timeline, "arrangement timeline");
|
|
@@ -5318,10 +5318,10 @@ function analysisOptionsOf(setup) {
|
|
|
5318
5318
|
const { key, meters, ...rest } = setup;
|
|
5319
5319
|
const opts = { ...rest };
|
|
5320
5320
|
if (key !== void 0) {
|
|
5321
|
-
opts.key =
|
|
5321
|
+
opts.key = _chunk3R3QVKY5cjs.resolveKey.call(void 0, key);
|
|
5322
5322
|
}
|
|
5323
5323
|
if (meters !== void 0) {
|
|
5324
|
-
opts.meters =
|
|
5324
|
+
opts.meters = _chunkS5BKZZGMcjs.resolveMeters.call(void 0, { meters }, "arrangement meters");
|
|
5325
5325
|
}
|
|
5326
5326
|
return opts;
|
|
5327
5327
|
}
|
|
@@ -5488,7 +5488,7 @@ var Arrangement = class _Arrangement {
|
|
|
5488
5488
|
* @returns One tension reading per sampled beat, in beat order.
|
|
5489
5489
|
*/
|
|
5490
5490
|
tension(opts) {
|
|
5491
|
-
return
|
|
5491
|
+
return _chunkHPVSH7SFcjs.tensionCurveFrom.call(void 0,
|
|
5492
5492
|
[...this.#data.tracks],
|
|
5493
5493
|
this.#session().analysis,
|
|
5494
5494
|
this.#layered(analysisOptionsOf(opts))
|
|
@@ -5514,7 +5514,7 @@ var Arrangement = class _Arrangement {
|
|
|
5514
5514
|
* tracks exceed the budget.
|
|
5515
5515
|
*/
|
|
5516
5516
|
analyze(opts) {
|
|
5517
|
-
return
|
|
5517
|
+
return _chunkHPVSH7SFcjs.analyzeArrangement.call(void 0, [...this.#data.tracks], this.#layered(analysisOptionsOf(opts)));
|
|
5518
5518
|
}
|
|
5519
5519
|
/**
|
|
5520
5520
|
* The harmony the tracks spell out together, in time.
|
|
@@ -5556,7 +5556,7 @@ var Arrangement = class _Arrangement {
|
|
|
5556
5556
|
}
|
|
5557
5557
|
/** The open reading, analysing the tracks on the first call. */
|
|
5558
5558
|
#session() {
|
|
5559
|
-
const open = _nullishCoalesce(this.#open, () => (
|
|
5559
|
+
const open = _nullishCoalesce(this.#open, () => ( _chunkHPVSH7SFcjs.createArrangementSession.call(void 0, [...this.#data.tracks], this.#analysisOptions())));
|
|
5560
5560
|
this.#open = open;
|
|
5561
5561
|
return open;
|
|
5562
5562
|
}
|
|
@@ -5651,7 +5651,7 @@ function copyProfile(profile) {
|
|
|
5651
5651
|
return percussion;
|
|
5652
5652
|
}
|
|
5653
5653
|
function checkedProfile(profile) {
|
|
5654
|
-
return copyProfile(
|
|
5654
|
+
return copyProfile(_chunkCGBADIO5cjs.toInstrumentProfile.call(void 0, profile));
|
|
5655
5655
|
}
|
|
5656
5656
|
var Instrument = class _Instrument {
|
|
5657
5657
|
#profile;
|
|
@@ -5687,7 +5687,7 @@ var Instrument = class _Instrument {
|
|
|
5687
5687
|
* @returns The instrument.
|
|
5688
5688
|
*/
|
|
5689
5689
|
static guitar() {
|
|
5690
|
-
return _Instrument.of(
|
|
5690
|
+
return _Instrument.of(_chunkCGBADIO5cjs.GUITAR_STANDARD);
|
|
5691
5691
|
}
|
|
5692
5692
|
/**
|
|
5693
5693
|
* Six-string guitar in drop D: the lowest string down a tone to D2, the rest
|
|
@@ -5696,7 +5696,7 @@ var Instrument = class _Instrument {
|
|
|
5696
5696
|
* @returns The instrument.
|
|
5697
5697
|
*/
|
|
5698
5698
|
static guitarDropD() {
|
|
5699
|
-
return _Instrument.of(
|
|
5699
|
+
return _Instrument.of(_chunkCGBADIO5cjs.GUITAR_DROP_D);
|
|
5700
5700
|
}
|
|
5701
5701
|
/**
|
|
5702
5702
|
* Electric bass in standard tuning: E1 A1 D2 G2.
|
|
@@ -5704,7 +5704,7 @@ var Instrument = class _Instrument {
|
|
|
5704
5704
|
* @returns The instrument.
|
|
5705
5705
|
*/
|
|
5706
5706
|
static bass4() {
|
|
5707
|
-
return _Instrument.of(
|
|
5707
|
+
return _Instrument.of(_chunkCGBADIO5cjs.BASS_4_STRING);
|
|
5708
5708
|
}
|
|
5709
5709
|
/**
|
|
5710
5710
|
* Five-string bass with the low B: B0 E1 A1 D2 G2.
|
|
@@ -5717,7 +5717,7 @@ var Instrument = class _Instrument {
|
|
|
5717
5717
|
* ```
|
|
5718
5718
|
*/
|
|
5719
5719
|
static bass5() {
|
|
5720
|
-
return _Instrument.of(
|
|
5720
|
+
return _Instrument.of(_chunkCGBADIO5cjs.BASS_5_STRING);
|
|
5721
5721
|
}
|
|
5722
5722
|
/**
|
|
5723
5723
|
* Rebuild an instrument from the plain profile {@link Instrument.data} hands
|
|
@@ -5775,7 +5775,7 @@ var Instrument = class _Instrument {
|
|
|
5775
5775
|
* ```
|
|
5776
5776
|
*/
|
|
5777
5777
|
range() {
|
|
5778
|
-
return
|
|
5778
|
+
return _chunkCGBADIO5cjs.rangeIn.call(void 0, this.#profile);
|
|
5779
5779
|
}
|
|
5780
5780
|
/**
|
|
5781
5781
|
* Whether the instrument has this pitch at all.
|
|
@@ -5785,8 +5785,8 @@ var Instrument = class _Instrument {
|
|
|
5785
5785
|
* produces it.
|
|
5786
5786
|
*/
|
|
5787
5787
|
canSound(pitch) {
|
|
5788
|
-
|
|
5789
|
-
return
|
|
5788
|
+
_chunkS5BKZZGMcjs.assertMidiPitch.call(void 0, pitch, "pitch");
|
|
5789
|
+
return _chunkCGBADIO5cjs.soundsIn.call(void 0, this.#profile, pitch);
|
|
5790
5790
|
}
|
|
5791
5791
|
/**
|
|
5792
5792
|
* Every position on the neck that sounds a pitch, lowest string first.
|
|
@@ -5798,10 +5798,10 @@ var Instrument = class _Instrument {
|
|
|
5798
5798
|
fingerings(pitch) {
|
|
5799
5799
|
const profile = this.#profile;
|
|
5800
5800
|
if (profile.kind !== "stringed") {
|
|
5801
|
-
throw new (0,
|
|
5801
|
+
throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)(`${profile.name} has no strings to finger`);
|
|
5802
5802
|
}
|
|
5803
|
-
|
|
5804
|
-
return
|
|
5803
|
+
_chunkS5BKZZGMcjs.assertMidiPitch.call(void 0, pitch, "pitch");
|
|
5804
|
+
return _chunkCGBADIO5cjs.fingeringsIn.call(void 0, profile, pitch);
|
|
5805
5805
|
}
|
|
5806
5806
|
/**
|
|
5807
5807
|
* Move a pitch by whole octaves until the instrument can sound it, which is
|
|
@@ -5818,8 +5818,8 @@ var Instrument = class _Instrument {
|
|
|
5818
5818
|
* ```
|
|
5819
5819
|
*/
|
|
5820
5820
|
foldIntoRange(pitch) {
|
|
5821
|
-
|
|
5822
|
-
return
|
|
5821
|
+
_chunkS5BKZZGMcjs.assertMidiPitch.call(void 0, pitch, "pitch");
|
|
5822
|
+
return _chunkCGBADIO5cjs.foldIn.call(void 0, pitch, this.#profile);
|
|
5823
5823
|
}
|
|
5824
5824
|
/**
|
|
5825
5825
|
* The pitch this instrument sounds for a note written in its part.
|
|
@@ -5851,7 +5851,7 @@ var Instrument = class _Instrument {
|
|
|
5851
5851
|
* ```
|
|
5852
5852
|
*/
|
|
5853
5853
|
soundingPitch(note, transposition = this.#profile.name) {
|
|
5854
|
-
return new Note(
|
|
5854
|
+
return new Note(_chunk76ZBTRG2cjs.toSoundingPitch.call(void 0, _chunkS5BKZZGMcjs.toNoteData.call(void 0, note), transposition));
|
|
5855
5855
|
}
|
|
5856
5856
|
/**
|
|
5857
5857
|
* Judge whether a passage can be played on this instrument, and how hard it
|
|
@@ -5877,7 +5877,7 @@ var Instrument = class _Instrument {
|
|
|
5877
5877
|
* ```
|
|
5878
5878
|
*/
|
|
5879
5879
|
playability(notes, bpm) {
|
|
5880
|
-
return
|
|
5880
|
+
return _chunkCGBADIO5cjs.playability.call(void 0, notes, this.#profile, bpm);
|
|
5881
5881
|
}
|
|
5882
5882
|
/**
|
|
5883
5883
|
* Whether another instrument is described identically.
|
|
@@ -5937,7 +5937,7 @@ function copyComplexity(complexity) {
|
|
|
5937
5937
|
for (const dial of ["rhythmic", "harmonic", "ornament", "difficulty"]) {
|
|
5938
5938
|
const value = complexity[dial];
|
|
5939
5939
|
if (value !== void 0) {
|
|
5940
|
-
copy[dial] =
|
|
5940
|
+
copy[dial] = _chunkS5BKZZGMcjs.assertFiniteNumber.call(void 0, value, `composer complexity ${dial}`);
|
|
5941
5941
|
}
|
|
5942
5942
|
}
|
|
5943
5943
|
return copy;
|
|
@@ -5953,10 +5953,10 @@ function copyInstruments(instruments) {
|
|
|
5953
5953
|
function copyOptions(options) {
|
|
5954
5954
|
assertDataObject(options, "composer options");
|
|
5955
5955
|
const copy = {
|
|
5956
|
-
meters:
|
|
5956
|
+
meters: _chunkS5BKZZGMcjs.resolveMeters.call(void 0, { meters: options.meters }, "composer meters")
|
|
5957
5957
|
};
|
|
5958
5958
|
if (options.key !== void 0) {
|
|
5959
|
-
copy.key =
|
|
5959
|
+
copy.key = _chunk3R3QVKY5cjs.resolveKey.call(void 0, options.key);
|
|
5960
5960
|
}
|
|
5961
5961
|
if (options.bpm !== void 0) {
|
|
5962
5962
|
copy.bpm = options.bpm;
|
|
@@ -5982,7 +5982,7 @@ function copyOptions(options) {
|
|
|
5982
5982
|
if (options.rng !== void 0) {
|
|
5983
5983
|
copy.rng = options.rng;
|
|
5984
5984
|
}
|
|
5985
|
-
const resolved =
|
|
5985
|
+
const resolved = _chunkJ7FHVZIIcjs.resolveContext.call(void 0, contextOf(copy));
|
|
5986
5986
|
copy.seed = resolved.seed;
|
|
5987
5987
|
copy.algorithmVersion = resolved.algorithmVersion;
|
|
5988
5988
|
return copy;
|
|
@@ -6039,8 +6039,8 @@ var Composer = class _Composer {
|
|
|
6039
6039
|
*/
|
|
6040
6040
|
constructor(options) {
|
|
6041
6041
|
this.#options = copyOptions(options);
|
|
6042
|
-
this.#meters =
|
|
6043
|
-
this.#key = this.#options.key === void 0 ? void 0 :
|
|
6042
|
+
this.#meters = _chunkS5BKZZGMcjs.resolveMeters.call(void 0, { meters: this.#options.meters }, "composer meters");
|
|
6043
|
+
this.#key = this.#options.key === void 0 ? void 0 : _chunk3R3QVKY5cjs.resolveKey.call(void 0, this.#options.key);
|
|
6044
6044
|
}
|
|
6045
6045
|
/**
|
|
6046
6046
|
* Start from a set of settings.
|
|
@@ -6097,8 +6097,8 @@ var Composer = class _Composer {
|
|
|
6097
6097
|
progression(opts) {
|
|
6098
6098
|
const key = this.#requireKey("progression");
|
|
6099
6099
|
const ts = this.#unchangingMeter("progression");
|
|
6100
|
-
const chords =
|
|
6101
|
-
return Timeline.fromChords(chords, opts.bars *
|
|
6100
|
+
const chords = _chunkJ7FHVZIIcjs.generateProgression.call(void 0, { ...opts, key, ts, ctx: this.context });
|
|
6101
|
+
return Timeline.fromChords(chords, opts.bars * _chunkS5BKZZGMcjs.beatsPerBar.call(void 0, ts), key);
|
|
6102
6102
|
}
|
|
6103
6103
|
/**
|
|
6104
6104
|
* A drum part.
|
|
@@ -6117,7 +6117,7 @@ var Composer = class _Composer {
|
|
|
6117
6117
|
* request is refused rather than answered with 4/4 bars over the change.
|
|
6118
6118
|
*/
|
|
6119
6119
|
drums(opts) {
|
|
6120
|
-
const hits =
|
|
6120
|
+
const hits = _chunkJ7FHVZIIcjs.generateDrums.call(void 0, { ...opts, ts: this.#unchangingMeter("drums"), ctx: this.context });
|
|
6121
6121
|
return Score.of(hits, this.#scoreOptions());
|
|
6122
6122
|
}
|
|
6123
6123
|
/**
|
|
@@ -6144,9 +6144,9 @@ var Composer = class _Composer {
|
|
|
6144
6144
|
const segments = Array.isArray(source) ? source : source.segments;
|
|
6145
6145
|
const key = this.#requireKey("bass");
|
|
6146
6146
|
const { instrument, ...rest } = _nullishCoalesce(opts, () => ( {}));
|
|
6147
|
-
const notes =
|
|
6147
|
+
const notes = _chunkJ7FHVZIIcjs.generateBassLine.call(void 0, {
|
|
6148
6148
|
...rest,
|
|
6149
|
-
...instrument === void 0 ? {} : { instrument:
|
|
6149
|
+
...instrument === void 0 ? {} : { instrument: _chunkCGBADIO5cjs.toStringedProfile.call(void 0, instrument, "bass instrument") },
|
|
6150
6150
|
segments,
|
|
6151
6151
|
key,
|
|
6152
6152
|
ts: this.#openingMeter(),
|
|
@@ -6176,7 +6176,7 @@ var Composer = class _Composer {
|
|
|
6176
6176
|
counterMelody(melody, opts) {
|
|
6177
6177
|
const key = this.#requireKey("counterMelody");
|
|
6178
6178
|
const { timeline, ...rest } = _nullishCoalesce(opts, () => ( {}));
|
|
6179
|
-
const notes =
|
|
6179
|
+
const notes = _chunkJ7FHVZIIcjs.generateCounterMelody.call(void 0, {
|
|
6180
6180
|
...rest,
|
|
6181
6181
|
...timeline === void 0 ? {} : { timeline: toChordTimeline(timeline) },
|
|
6182
6182
|
melody: melody.notes,
|
|
@@ -6207,7 +6207,7 @@ var Composer = class _Composer {
|
|
|
6207
6207
|
* ```
|
|
6208
6208
|
*/
|
|
6209
6209
|
harmonize(melody, opts) {
|
|
6210
|
-
const result =
|
|
6210
|
+
const result = _chunkJ7FHVZIIcjs.harmonizeMelody.call(void 0, {
|
|
6211
6211
|
...opts,
|
|
6212
6212
|
melody: melody.notes,
|
|
6213
6213
|
...this.#key === void 0 ? {} : { key: this.#key },
|
|
@@ -6218,7 +6218,7 @@ var Composer = class _Composer {
|
|
|
6218
6218
|
const totalBeats = harmonizedSpan(
|
|
6219
6219
|
moved.totalBeats,
|
|
6220
6220
|
result.chords,
|
|
6221
|
-
|
|
6221
|
+
_chunkS5BKZZGMcjs.beatsPerBar.call(void 0, this.#openingMeter())
|
|
6222
6222
|
);
|
|
6223
6223
|
return {
|
|
6224
6224
|
chords: Timeline.fromChords(result.chords, totalBeats, result.key),
|
|
@@ -6280,7 +6280,7 @@ var Composer = class _Composer {
|
|
|
6280
6280
|
*/
|
|
6281
6281
|
#requireKey(part) {
|
|
6282
6282
|
if (this.#key === void 0) {
|
|
6283
|
-
throw new (0,
|
|
6283
|
+
throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)(
|
|
6284
6284
|
`composer ${part} needs a key for the part it writes; the composer names none \u2014 give it one, or take the key harmonize reads off a melody and pass it on with with({ key })`
|
|
6285
6285
|
);
|
|
6286
6286
|
}
|
|
@@ -6294,7 +6294,7 @@ var Composer = class _Composer {
|
|
|
6294
6294
|
* reading {@link Score.humanize} and its siblings take.
|
|
6295
6295
|
*/
|
|
6296
6296
|
#openingMeter() {
|
|
6297
|
-
return
|
|
6297
|
+
return _chunkS5BKZZGMcjs.meterAt.call(void 0, 0, this.#meters);
|
|
6298
6298
|
}
|
|
6299
6299
|
/**
|
|
6300
6300
|
* The one signature a part laid out in bars is written against.
|
|
@@ -6306,7 +6306,7 @@ var Composer = class _Composer {
|
|
|
6306
6306
|
*/
|
|
6307
6307
|
#unchangingMeter(part) {
|
|
6308
6308
|
if (this.#meters.length > 1) {
|
|
6309
|
-
throw new (0,
|
|
6309
|
+
throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)(
|
|
6310
6310
|
`composer ${part} needs one meter for the whole part; the composer changes meter`
|
|
6311
6311
|
);
|
|
6312
6312
|
}
|
|
@@ -6327,7 +6327,7 @@ var Composer = class _Composer {
|
|
|
6327
6327
|
|
|
6328
6328
|
// src/model/duration.ts
|
|
6329
6329
|
function copyDuration(value) {
|
|
6330
|
-
|
|
6330
|
+
_chunkNM7UAMC3cjs.durationToBeats.call(void 0, value);
|
|
6331
6331
|
if (typeof value === "string") {
|
|
6332
6332
|
return { base: value, dots: 0 };
|
|
6333
6333
|
}
|
|
@@ -6378,7 +6378,7 @@ var Duration = class _Duration {
|
|
|
6378
6378
|
* {@link Duration.tieChain} for those.
|
|
6379
6379
|
*/
|
|
6380
6380
|
static ofBeats(beats, options = {}) {
|
|
6381
|
-
return new _Duration(
|
|
6381
|
+
return new _Duration(_chunkNM7UAMC3cjs.beatsToDuration.call(void 0, beats, options));
|
|
6382
6382
|
}
|
|
6383
6383
|
/**
|
|
6384
6384
|
* Spell a length in beats as a chain of tied durations.
|
|
@@ -6402,7 +6402,7 @@ var Duration = class _Duration {
|
|
|
6402
6402
|
* ```
|
|
6403
6403
|
*/
|
|
6404
6404
|
static tieChain(beats, options = {}) {
|
|
6405
|
-
return
|
|
6405
|
+
return _chunkNM7UAMC3cjs.beatsToTiedDurations.call(void 0, beats, options).map((spelled) => new _Duration(spelled));
|
|
6406
6406
|
}
|
|
6407
6407
|
/**
|
|
6408
6408
|
* Wrap a plain duration, or a bare base value as shorthand for an undotted
|
|
@@ -6466,7 +6466,7 @@ var Duration = class _Duration {
|
|
|
6466
6466
|
* ```
|
|
6467
6467
|
*/
|
|
6468
6468
|
beats(options = {}) {
|
|
6469
|
-
return
|
|
6469
|
+
return _chunkNM7UAMC3cjs.durationToBeats.call(void 0, this.toJSON(), options);
|
|
6470
6470
|
}
|
|
6471
6471
|
/**
|
|
6472
6472
|
* Whether another duration is written identically.
|
|
@@ -6547,7 +6547,7 @@ var Meter = class _Meter {
|
|
|
6547
6547
|
* is ordinary, such as a meter field read on every keystroke.
|
|
6548
6548
|
*/
|
|
6549
6549
|
static parse(text) {
|
|
6550
|
-
return new _Meter(
|
|
6550
|
+
return new _Meter(_chunkS5BKZZGMcjs.parseTimeSignature.call(void 0, text));
|
|
6551
6551
|
}
|
|
6552
6552
|
/**
|
|
6553
6553
|
* Parse a time signature, reporting failure instead of throwing it.
|
|
@@ -6566,7 +6566,7 @@ var Meter = class _Meter {
|
|
|
6566
6566
|
* ```
|
|
6567
6567
|
*/
|
|
6568
6568
|
static tryParse(text) {
|
|
6569
|
-
const parsed =
|
|
6569
|
+
const parsed = _chunkS5BKZZGMcjs.tryParseTimeSignature.call(void 0, text);
|
|
6570
6570
|
return parsed.ok ? { ok: true, value: new _Meter(parsed.value) } : parsed;
|
|
6571
6571
|
}
|
|
6572
6572
|
/**
|
|
@@ -6611,22 +6611,22 @@ var Meter = class _Meter {
|
|
|
6611
6611
|
* neither is a signature whose grouping selects the additive reading.
|
|
6612
6612
|
*/
|
|
6613
6613
|
get isCompound() {
|
|
6614
|
-
return
|
|
6614
|
+
return _chunkS5BKZZGMcjs.isCompound.call(void 0, this.#ts);
|
|
6615
6615
|
}
|
|
6616
6616
|
/** Length of a bar in quarter-note beats. */
|
|
6617
6617
|
get beatsPerBar() {
|
|
6618
|
-
return
|
|
6618
|
+
return _chunkS5BKZZGMcjs.beatsPerBar.call(void 0, this.#ts);
|
|
6619
6619
|
}
|
|
6620
6620
|
/** Main pulses (felt beats) in a bar: 2 in 6/8, 4 in 4/4. */
|
|
6621
6621
|
get pulsesPerBar() {
|
|
6622
|
-
return
|
|
6622
|
+
return _chunkS5BKZZGMcjs.pulsesPerBar.call(void 0, this.#ts);
|
|
6623
6623
|
}
|
|
6624
6624
|
/**
|
|
6625
6625
|
* Length of one felt beat in quarter-note beats: a quarter note in simple
|
|
6626
6626
|
* meters, a dotted quarter in compound ones.
|
|
6627
6627
|
*/
|
|
6628
6628
|
get pulseBeats() {
|
|
6629
|
-
return
|
|
6629
|
+
return _chunkS5BKZZGMcjs.pulseBeats.call(void 0, this.#ts);
|
|
6630
6630
|
}
|
|
6631
6631
|
/**
|
|
6632
6632
|
* Render the signature as `'n/d'`, or as `'a+b+c/d'` when it carries an
|
|
@@ -6649,7 +6649,7 @@ var Meter = class _Meter {
|
|
|
6649
6649
|
* ```
|
|
6650
6650
|
*/
|
|
6651
6651
|
format(opts = {}) {
|
|
6652
|
-
return
|
|
6652
|
+
return _chunkS5BKZZGMcjs.formatTimeSignature.call(void 0, this.#ts, opts);
|
|
6653
6653
|
}
|
|
6654
6654
|
/**
|
|
6655
6655
|
* Metric weight of a position within its bar, on a 0–3 scale: 3 the
|
|
@@ -6662,7 +6662,7 @@ var Meter = class _Meter {
|
|
|
6662
6662
|
* @throws If the position is not finite.
|
|
6663
6663
|
*/
|
|
6664
6664
|
weightAt(beatInQuarters) {
|
|
6665
|
-
return
|
|
6665
|
+
return _chunkS5BKZZGMcjs.metricWeight.call(void 0, beatInQuarters, this.#ts);
|
|
6666
6666
|
}
|
|
6667
6667
|
/**
|
|
6668
6668
|
* Whether a position is metrically accented — a downbeat or a secondary
|
|
@@ -6673,7 +6673,7 @@ var Meter = class _Meter {
|
|
|
6673
6673
|
* @throws If the position is not finite.
|
|
6674
6674
|
*/
|
|
6675
6675
|
isStrongBeat(beatInQuarters) {
|
|
6676
|
-
return
|
|
6676
|
+
return _chunkS5BKZZGMcjs.isStrongBeat.call(void 0, beatInQuarters, this.#ts);
|
|
6677
6677
|
}
|
|
6678
6678
|
/**
|
|
6679
6679
|
* Convert a position in quarter-note beats to a bar index and in-bar offset.
|
|
@@ -6683,7 +6683,7 @@ var Meter = class _Meter {
|
|
|
6683
6683
|
* @throws If the position is not finite.
|
|
6684
6684
|
*/
|
|
6685
6685
|
barPositionAt(beatInQuarters) {
|
|
6686
|
-
return
|
|
6686
|
+
return _chunkS5BKZZGMcjs.beatToBarPosition.call(void 0, beatInQuarters, this.#ts);
|
|
6687
6687
|
}
|
|
6688
6688
|
/**
|
|
6689
6689
|
* Render a position as the `bar.beat` a DAW or a score shows: 1-based bar,
|
|
@@ -6706,7 +6706,7 @@ var Meter = class _Meter {
|
|
|
6706
6706
|
* ```
|
|
6707
6707
|
*/
|
|
6708
6708
|
formatPosition(beatInQuarters, decimals = 2) {
|
|
6709
|
-
return
|
|
6709
|
+
return _chunkS5BKZZGMcjs.formatBarPosition.call(void 0, beatInQuarters, this.#ts, decimals);
|
|
6710
6710
|
}
|
|
6711
6711
|
/**
|
|
6712
6712
|
* Subdivide a span into equal tuplet durations — an eighth-note triplet is
|
|
@@ -6718,7 +6718,7 @@ var Meter = class _Meter {
|
|
|
6718
6718
|
* @throws If the span is negative or `count` is not a positive integer.
|
|
6719
6719
|
*/
|
|
6720
6720
|
tuplet(totalBeats, count) {
|
|
6721
|
-
return
|
|
6721
|
+
return _chunkS5BKZZGMcjs.tuplet.call(void 0, totalBeats, count);
|
|
6722
6722
|
}
|
|
6723
6723
|
/**
|
|
6724
6724
|
* Whether another meter is the same signature, grouping included.
|
|
@@ -6775,7 +6775,7 @@ function copyCell(cell) {
|
|
|
6775
6775
|
return { notes: assertNoteEventArray(cell.notes, "motif notes").map(copyNote2) };
|
|
6776
6776
|
}
|
|
6777
6777
|
function chordFrom(chord) {
|
|
6778
|
-
return chord === void 0 || chord === null ? chord :
|
|
6778
|
+
return chord === void 0 || chord === null ? chord : _chunk3R3QVKY5cjs.toChordData.call(void 0, chord);
|
|
6779
6779
|
}
|
|
6780
6780
|
var Motif = class _Motif {
|
|
6781
6781
|
#cell;
|
|
@@ -6807,7 +6807,7 @@ var Motif = class _Motif {
|
|
|
6807
6807
|
* ```
|
|
6808
6808
|
*/
|
|
6809
6809
|
static generate(opts) {
|
|
6810
|
-
return new _Motif(
|
|
6810
|
+
return new _Motif(_chunkJ7FHVZIIcjs.generateMotif.call(void 0, { ...opts, chord: chordFrom(opts.chord) }));
|
|
6811
6811
|
}
|
|
6812
6812
|
/**
|
|
6813
6813
|
* Read a run of notes as a motif.
|
|
@@ -6837,7 +6837,7 @@ var Motif = class _Motif {
|
|
|
6837
6837
|
}
|
|
6838
6838
|
/** Where the cell stops sounding, measured from its own first onset. */
|
|
6839
6839
|
get totalBeats() {
|
|
6840
|
-
return
|
|
6840
|
+
return _chunkJ7FHVZIIcjs.cellSpan.call(void 0, this.#cell);
|
|
6841
6841
|
}
|
|
6842
6842
|
/** A copy of the underlying plain cell. */
|
|
6843
6843
|
get data() {
|
|
@@ -6874,7 +6874,7 @@ var Motif = class _Motif {
|
|
|
6874
6874
|
* ```
|
|
6875
6875
|
*/
|
|
6876
6876
|
transform(kind, amount, key) {
|
|
6877
|
-
return new _Motif(
|
|
6877
|
+
return new _Motif(_chunkJ7FHVZIIcjs.transformMotif.call(void 0, this.#cell, kind, amount, key));
|
|
6878
6878
|
}
|
|
6879
6879
|
/**
|
|
6880
6880
|
* The cell laid across a span and snapped to the harmony under it.
|
|
@@ -6896,7 +6896,7 @@ var Motif = class _Motif {
|
|
|
6896
6896
|
*/
|
|
6897
6897
|
develop(timeline, key, bars, ts) {
|
|
6898
6898
|
const chords = "chordTimeline" in timeline ? timeline.chordTimeline : timeline;
|
|
6899
|
-
return new _Motif(
|
|
6899
|
+
return new _Motif(_chunkJ7FHVZIIcjs.developMotif.call(void 0, this.#cell, chords, key, bars, ts));
|
|
6900
6900
|
}
|
|
6901
6901
|
/**
|
|
6902
6902
|
* How this motif stands to another: the transformation that turns one into
|
|
@@ -6910,7 +6910,7 @@ var Motif = class _Motif {
|
|
|
6910
6910
|
* @returns The relation, or null when the two stand in none.
|
|
6911
6911
|
*/
|
|
6912
6912
|
relateTo(other, key) {
|
|
6913
|
-
return
|
|
6913
|
+
return _chunkHPVSH7SFcjs.relateMotifs.call(void 0, _chunkHPVSH7SFcjs.motifFromNotes.call(void 0, this.#cell.notes), _chunkHPVSH7SFcjs.motifFromNotes.call(void 0, other.notes), key);
|
|
6914
6914
|
}
|
|
6915
6915
|
/**
|
|
6916
6916
|
* How alike two lines are, in [0, 1].
|
|
@@ -6923,7 +6923,7 @@ var Motif = class _Motif {
|
|
|
6923
6923
|
* @returns The likeness: 1 for the same line, a transposition of it included.
|
|
6924
6924
|
*/
|
|
6925
6925
|
similarityTo(other) {
|
|
6926
|
-
return
|
|
6926
|
+
return _chunkHPVSH7SFcjs.melodicSimilarity.call(void 0, this.#cell.notes, other.notes);
|
|
6927
6927
|
}
|
|
6928
6928
|
/**
|
|
6929
6929
|
* The cell as a score, so it reaches the rest of the class API.
|
|
@@ -6933,7 +6933,7 @@ var Motif = class _Motif {
|
|
|
6933
6933
|
* @returns The score holding the cell.
|
|
6934
6934
|
*/
|
|
6935
6935
|
toScore(opts) {
|
|
6936
|
-
return Score.of(
|
|
6936
|
+
return Score.of(_chunkJ7FHVZIIcjs.motifToNoteEvents.call(void 0, this.#cell), opts);
|
|
6937
6937
|
}
|
|
6938
6938
|
/**
|
|
6939
6939
|
* Whether another motif holds the same notes in the same order.
|
|
@@ -6966,10 +6966,10 @@ var PART = "rhythm";
|
|
|
6966
6966
|
function copyEvent(event, name) {
|
|
6967
6967
|
return {
|
|
6968
6968
|
position: withoutNegativeZero(
|
|
6969
|
-
|
|
6969
|
+
_chunkS5BKZZGMcjs.assertRange.call(void 0, event.position, 0, Number.MAX_SAFE_INTEGER, `${name}.position`)
|
|
6970
6970
|
),
|
|
6971
6971
|
duration: withoutNegativeZero(
|
|
6972
|
-
|
|
6972
|
+
_chunkS5BKZZGMcjs.assertRange.call(void 0, event.duration, 0, Number.MAX_SAFE_INTEGER, `${name}.duration`)
|
|
6973
6973
|
)
|
|
6974
6974
|
};
|
|
6975
6975
|
}
|
|
@@ -6988,13 +6988,13 @@ function spanOf(events) {
|
|
|
6988
6988
|
}
|
|
6989
6989
|
function toGrid(events) {
|
|
6990
6990
|
return events.map((event) => ({
|
|
6991
|
-
step: event.position /
|
|
6991
|
+
step: event.position / _chunkJ7FHVZIIcjs.STEP_BEATS,
|
|
6992
6992
|
velocity: GRID_VELOCITY,
|
|
6993
6993
|
source: event
|
|
6994
6994
|
}));
|
|
6995
6995
|
}
|
|
6996
6996
|
function fromGrid(events, spanBeats) {
|
|
6997
|
-
const positions = [...new Set(events.map((event) => event.step *
|
|
6997
|
+
const positions = [...new Set(events.map((event) => event.step * _chunkJ7FHVZIIcjs.STEP_BEATS))].sort(
|
|
6998
6998
|
(a, b) => a - b
|
|
6999
6999
|
);
|
|
7000
7000
|
return positions.map((position, index) => ({
|
|
@@ -7034,8 +7034,8 @@ var Rhythm = class _Rhythm {
|
|
|
7034
7034
|
* ```
|
|
7035
7035
|
*/
|
|
7036
7036
|
static generate(ts, opts) {
|
|
7037
|
-
const meter =
|
|
7038
|
-
return new _Rhythm({ events:
|
|
7037
|
+
const meter = _chunkS5BKZZGMcjs.meterAt.call(void 0, 0, _chunkS5BKZZGMcjs.toMeterData.call(void 0, ts, "ts"));
|
|
7038
|
+
return new _Rhythm({ events: _chunkJ7FHVZIIcjs.generateRhythm.call(void 0, meter, opts), ts: meter });
|
|
7039
7039
|
}
|
|
7040
7040
|
/**
|
|
7041
7041
|
* Build a pattern from onsets that already exist.
|
|
@@ -7055,7 +7055,7 @@ var Rhythm = class _Rhythm {
|
|
|
7055
7055
|
static of(events, ts) {
|
|
7056
7056
|
return new _Rhythm({
|
|
7057
7057
|
events: [...assertDataArray(events, "rhythm events")],
|
|
7058
|
-
ts:
|
|
7058
|
+
ts: _chunkS5BKZZGMcjs.meterAt.call(void 0, 0, _chunkS5BKZZGMcjs.toMeterData.call(void 0, ts, "ts"))
|
|
7059
7059
|
});
|
|
7060
7060
|
}
|
|
7061
7061
|
/** Rebuild a pattern from the plain data {@link Rhythm.data} hands out. */
|
|
@@ -7091,7 +7091,7 @@ var Rhythm = class _Rhythm {
|
|
|
7091
7091
|
* @returns The onset count divided by the number of bars it spans.
|
|
7092
7092
|
*/
|
|
7093
7093
|
density() {
|
|
7094
|
-
return
|
|
7094
|
+
return _chunkJ7FHVZIIcjs.rhythmDensity.call(void 0, this.#data.events, this.#data.ts);
|
|
7095
7095
|
}
|
|
7096
7096
|
/**
|
|
7097
7097
|
* Drop the onsets carrying the least of the metre.
|
|
@@ -7106,7 +7106,7 @@ var Rhythm = class _Rhythm {
|
|
|
7106
7106
|
* @throws If the amount is outside [0, 1].
|
|
7107
7107
|
*/
|
|
7108
7108
|
thin(amount) {
|
|
7109
|
-
return this.#withGrid(
|
|
7109
|
+
return this.#withGrid(_chunkJ7FHVZIIcjs.thin.call(void 0, toGrid(this.#data.events), amount, this.#data.ts));
|
|
7110
7110
|
}
|
|
7111
7111
|
/**
|
|
7112
7112
|
* Anticipate beats, one sixteenth early.
|
|
@@ -7125,10 +7125,10 @@ var Rhythm = class _Rhythm {
|
|
|
7125
7125
|
*/
|
|
7126
7126
|
syncopate(amount, ctx) {
|
|
7127
7127
|
return this.#withGrid(
|
|
7128
|
-
|
|
7128
|
+
_chunkJ7FHVZIIcjs.syncopate.call(void 0,
|
|
7129
7129
|
toGrid(this.#data.events),
|
|
7130
7130
|
{ amount, ts: this.#data.ts },
|
|
7131
|
-
|
|
7131
|
+
_chunkJ7FHVZIIcjs.resolveContext.call(void 0, ctx).part(PART)
|
|
7132
7132
|
)
|
|
7133
7133
|
);
|
|
7134
7134
|
}
|
|
@@ -7140,7 +7140,7 @@ var Rhythm = class _Rhythm {
|
|
|
7140
7140
|
* @returns The compressed pattern.
|
|
7141
7141
|
*/
|
|
7142
7142
|
doubleTime() {
|
|
7143
|
-
return this.#withGrid(
|
|
7143
|
+
return this.#withGrid(_chunkJ7FHVZIIcjs.doubleTime.call(void 0, toGrid(this.#data.events), this.#spanSteps()));
|
|
7144
7144
|
}
|
|
7145
7145
|
/**
|
|
7146
7146
|
* Stretch the pattern to twice its length: everything falls half as often.
|
|
@@ -7151,7 +7151,7 @@ var Rhythm = class _Rhythm {
|
|
|
7151
7151
|
* @returns The stretched pattern.
|
|
7152
7152
|
*/
|
|
7153
7153
|
halfTime() {
|
|
7154
|
-
return this.#withGrid(
|
|
7154
|
+
return this.#withGrid(_chunkJ7FHVZIIcjs.halfTime.call(void 0, toGrid(this.#data.events), this.#spanSteps()));
|
|
7155
7155
|
}
|
|
7156
7156
|
/**
|
|
7157
7157
|
* Keep as much decoration as the ornament dial asks for.
|
|
@@ -7168,11 +7168,11 @@ var Rhythm = class _Rhythm {
|
|
|
7168
7168
|
*/
|
|
7169
7169
|
ornamentBy(isOrnament, amount, ctx) {
|
|
7170
7170
|
return this.#withGrid(
|
|
7171
|
-
|
|
7171
|
+
_chunkJ7FHVZIIcjs.ornamentBy.call(void 0,
|
|
7172
7172
|
toGrid(this.#data.events),
|
|
7173
7173
|
(grid) => isOrnament(grid.source),
|
|
7174
7174
|
amount,
|
|
7175
|
-
|
|
7175
|
+
_chunkJ7FHVZIIcjs.resolveContext.call(void 0, ctx).part(PART)
|
|
7176
7176
|
)
|
|
7177
7177
|
);
|
|
7178
7178
|
}
|
|
@@ -7192,7 +7192,7 @@ var Rhythm = class _Rhythm {
|
|
|
7192
7192
|
* @throws If a dial is outside [0, 1].
|
|
7193
7193
|
*/
|
|
7194
7194
|
deform(opts, ctx) {
|
|
7195
|
-
const resolved =
|
|
7195
|
+
const resolved = _chunkJ7FHVZIIcjs.resolveContext.call(void 0, ctx);
|
|
7196
7196
|
const isOrnament = _optionalChain([opts, 'optionalAccess', _55 => _55.isOrnament]);
|
|
7197
7197
|
const options = {
|
|
7198
7198
|
rhythmic: resolved.rhythmic,
|
|
@@ -7205,7 +7205,7 @@ var Rhythm = class _Rhythm {
|
|
|
7205
7205
|
// grid event the rule reads, so the field is named back here.
|
|
7206
7206
|
isOrnament: isOrnament === void 0 ? void 0 : (grid) => isOrnament(grid.source)
|
|
7207
7207
|
};
|
|
7208
|
-
return this.#withGrid(
|
|
7208
|
+
return this.#withGrid(_chunkJ7FHVZIIcjs.deform.call(void 0, toGrid(this.#data.events), options, resolved.part(PART)));
|
|
7209
7209
|
}
|
|
7210
7210
|
/**
|
|
7211
7211
|
* Whether one player can sustain the pattern at the context's tempo.
|
|
@@ -7219,8 +7219,8 @@ var Rhythm = class _Rhythm {
|
|
|
7219
7219
|
* @returns True when the pattern is inside the ceiling.
|
|
7220
7220
|
*/
|
|
7221
7221
|
withinCeiling(ctx) {
|
|
7222
|
-
const resolved =
|
|
7223
|
-
return
|
|
7222
|
+
const resolved = _chunkJ7FHVZIIcjs.resolveContext.call(void 0, ctx);
|
|
7223
|
+
return _chunkJ7FHVZIIcjs.withinCeiling.call(void 0, toGrid(this.#data.events), resolved.bpm, resolved.difficulty);
|
|
7224
7224
|
}
|
|
7225
7225
|
/**
|
|
7226
7226
|
* The pattern as sounding notes at one pitch, in its own meter.
|
|
@@ -7244,7 +7244,7 @@ var Rhythm = class _Rhythm {
|
|
|
7244
7244
|
* ```
|
|
7245
7245
|
*/
|
|
7246
7246
|
toScore(pitch, velocity) {
|
|
7247
|
-
return Score.of(
|
|
7247
|
+
return Score.of(_chunkJ7FHVZIIcjs.rhythmToNoteEvents.call(void 0, this.#data.events, pitch, velocity), {
|
|
7248
7248
|
meters: this.#data.ts
|
|
7249
7249
|
});
|
|
7250
7250
|
}
|
|
@@ -7268,7 +7268,7 @@ var Rhythm = class _Rhythm {
|
|
|
7268
7268
|
}
|
|
7269
7269
|
/** The pattern's span as a count of sixteenths, for the transforms. */
|
|
7270
7270
|
#spanSteps() {
|
|
7271
|
-
return spanOf(this.#data.events) /
|
|
7271
|
+
return spanOf(this.#data.events) / _chunkJ7FHVZIIcjs.STEP_BEATS;
|
|
7272
7272
|
}
|
|
7273
7273
|
/** The same meter carrying the onsets a transform returned. */
|
|
7274
7274
|
#withGrid(events) {
|
|
@@ -7293,7 +7293,7 @@ var MIN_BPM = 0.1;
|
|
|
7293
7293
|
var Tempo = class _Tempo {
|
|
7294
7294
|
#bpm;
|
|
7295
7295
|
constructor(bpm) {
|
|
7296
|
-
this.#bpm =
|
|
7296
|
+
this.#bpm = _chunkS5BKZZGMcjs.assertRange.call(void 0, bpm, MIN_BPM, MAX_BPM, "bpm");
|
|
7297
7297
|
}
|
|
7298
7298
|
/**
|
|
7299
7299
|
* The one-event tempo map every conversion here is measured against.
|
|
@@ -7353,7 +7353,7 @@ var Tempo = class _Tempo {
|
|
|
7353
7353
|
* @throws If the position is not finite.
|
|
7354
7354
|
*/
|
|
7355
7355
|
secondsAt(beat) {
|
|
7356
|
-
return
|
|
7356
|
+
return _chunkNM7UAMC3cjs.beatsToSeconds.call(void 0, beat, this.#map);
|
|
7357
7357
|
}
|
|
7358
7358
|
/**
|
|
7359
7359
|
* The position reached after a number of seconds — the inverse of
|
|
@@ -7370,7 +7370,7 @@ var Tempo = class _Tempo {
|
|
|
7370
7370
|
* ```
|
|
7371
7371
|
*/
|
|
7372
7372
|
beatAtSeconds(seconds) {
|
|
7373
|
-
return
|
|
7373
|
+
return _chunkNM7UAMC3cjs.secondsToBeats.call(void 0, seconds, this.#map);
|
|
7374
7374
|
}
|
|
7375
7375
|
/**
|
|
7376
7376
|
* Duration in seconds of a span of beats.
|
|
@@ -7383,7 +7383,7 @@ var Tempo = class _Tempo {
|
|
|
7383
7383
|
* @throws If the length is negative or not finite.
|
|
7384
7384
|
*/
|
|
7385
7385
|
secondsOf(lengthBeats) {
|
|
7386
|
-
return
|
|
7386
|
+
return _chunkNM7UAMC3cjs.durationToSeconds.call(void 0, 0, lengthBeats, this.#map);
|
|
7387
7387
|
}
|
|
7388
7388
|
/**
|
|
7389
7389
|
* Convert quarter-note beats to MIDI ticks, rounded to the nearest tick.
|
|
@@ -7394,7 +7394,7 @@ var Tempo = class _Tempo {
|
|
|
7394
7394
|
* @throws If the position is not finite or `ppq` is not a positive integer.
|
|
7395
7395
|
*/
|
|
7396
7396
|
ticksAt(beat, ppq) {
|
|
7397
|
-
return
|
|
7397
|
+
return _chunkNM7UAMC3cjs.beatsToTicks.call(void 0, beat, ppq);
|
|
7398
7398
|
}
|
|
7399
7399
|
/**
|
|
7400
7400
|
* Convert MIDI ticks to quarter-note beats.
|
|
@@ -7405,7 +7405,7 @@ var Tempo = class _Tempo {
|
|
|
7405
7405
|
* @throws If `ticks` is not an integer or `ppq` is not a positive integer.
|
|
7406
7406
|
*/
|
|
7407
7407
|
beatAtTicks(ticks, ppq) {
|
|
7408
|
-
return
|
|
7408
|
+
return _chunkNM7UAMC3cjs.ticksToBeats.call(void 0, ticks, ppq);
|
|
7409
7409
|
}
|
|
7410
7410
|
/**
|
|
7411
7411
|
* Whether another tempo carries the same marking.
|
|
@@ -7465,10 +7465,10 @@ var Tuning = class _Tuning {
|
|
|
7465
7465
|
*/
|
|
7466
7466
|
static of(table) {
|
|
7467
7467
|
const given = assertDataObject(table, "tuning table");
|
|
7468
|
-
|
|
7469
|
-
|
|
7470
|
-
|
|
7471
|
-
return new _Tuning(
|
|
7468
|
+
_chunkS5BKZZGMcjs.assertFiniteNumber.call(void 0, given.divisions, "tuning table.divisions");
|
|
7469
|
+
_chunkS5BKZZGMcjs.assertFiniteNumber.call(void 0, given.refFreq, "tuning table.refFreq");
|
|
7470
|
+
_chunkS5BKZZGMcjs.assertFiniteNumber.call(void 0, given.refStep, "tuning table.refStep");
|
|
7471
|
+
return new _Tuning(_chunkNM7UAMC3cjs.edo.call(void 0, given.divisions, given.refFreq, given.refStep));
|
|
7472
7472
|
}
|
|
7473
7473
|
/**
|
|
7474
7474
|
* Build an equal temperament with `divisions` divisions of the octave.
|
|
@@ -7489,7 +7489,7 @@ var Tuning = class _Tuning {
|
|
|
7489
7489
|
* ```
|
|
7490
7490
|
*/
|
|
7491
7491
|
static edo(divisions, refFreq, refStep) {
|
|
7492
|
-
return new _Tuning(
|
|
7492
|
+
return new _Tuning(_chunkNM7UAMC3cjs.edo.call(void 0, divisions, refFreq, refStep));
|
|
7493
7493
|
}
|
|
7494
7494
|
/**
|
|
7495
7495
|
* Standard twelve-tone equal temperament, A4 (MIDI 69) = 440 Hz.
|
|
@@ -7502,7 +7502,7 @@ var Tuning = class _Tuning {
|
|
|
7502
7502
|
* ```
|
|
7503
7503
|
*/
|
|
7504
7504
|
static twelveTet() {
|
|
7505
|
-
return _Tuning.of(
|
|
7505
|
+
return _Tuning.of(_chunkNM7UAMC3cjs.TWELVE_TET);
|
|
7506
7506
|
}
|
|
7507
7507
|
/**
|
|
7508
7508
|
* Rebuild a tuning from the plain table {@link Tuning.data} hands out.
|
|
@@ -7541,7 +7541,7 @@ var Tuning = class _Tuning {
|
|
|
7541
7541
|
* ```
|
|
7542
7542
|
*/
|
|
7543
7543
|
static ratioToCents(numerator, denominator) {
|
|
7544
|
-
return
|
|
7544
|
+
return _chunkNM7UAMC3cjs.ratioToCents.call(void 0, numerator, denominator);
|
|
7545
7545
|
}
|
|
7546
7546
|
/**
|
|
7547
7547
|
* The frequency ratio an interval in cents spans, the inverse of
|
|
@@ -7559,7 +7559,7 @@ var Tuning = class _Tuning {
|
|
|
7559
7559
|
* ```
|
|
7560
7560
|
*/
|
|
7561
7561
|
static centsToRatio(cents) {
|
|
7562
|
-
return
|
|
7562
|
+
return _chunkNM7UAMC3cjs.centsToRatio.call(void 0, cents);
|
|
7563
7563
|
}
|
|
7564
7564
|
/**
|
|
7565
7565
|
* Interval in cents between two frequencies.
|
|
@@ -7575,7 +7575,7 @@ var Tuning = class _Tuning {
|
|
|
7575
7575
|
* ```
|
|
7576
7576
|
*/
|
|
7577
7577
|
static centsBetweenFreq(a, b) {
|
|
7578
|
-
return
|
|
7578
|
+
return _chunkNM7UAMC3cjs.centsBetweenFreq.call(void 0, a, b);
|
|
7579
7579
|
}
|
|
7580
7580
|
/**
|
|
7581
7581
|
* Cents by which a five-limit just interval departs from its 12-TET
|
|
@@ -7591,7 +7591,7 @@ var Tuning = class _Tuning {
|
|
|
7591
7591
|
* ```
|
|
7592
7592
|
*/
|
|
7593
7593
|
static justDeviationCents(semitoneClass) {
|
|
7594
|
-
return
|
|
7594
|
+
return _chunkNM7UAMC3cjs.justDeviationCents.call(void 0, semitoneClass);
|
|
7595
7595
|
}
|
|
7596
7596
|
/** Step index whose frequency is {@link Tuning.refFreq}. */
|
|
7597
7597
|
get refStep() {
|
|
@@ -7633,7 +7633,7 @@ var Tuning = class _Tuning {
|
|
|
7633
7633
|
* ```
|
|
7634
7634
|
*/
|
|
7635
7635
|
frequencyOf(note, tuning = this.#table) {
|
|
7636
|
-
return
|
|
7636
|
+
return _chunkNM7UAMC3cjs.frequencyOf.call(void 0, _chunkS5BKZZGMcjs.noteToMidi.call(void 0, _chunkS5BKZZGMcjs.toNoteData.call(void 0, note)), tuning);
|
|
7637
7637
|
}
|
|
7638
7638
|
/**
|
|
7639
7639
|
* Frequency in Hz of a step index.
|
|
@@ -7655,7 +7655,7 @@ var Tuning = class _Tuning {
|
|
|
7655
7655
|
* ```
|
|
7656
7656
|
*/
|
|
7657
7657
|
frequencyOfStep(step, tuning = this.#table) {
|
|
7658
|
-
return
|
|
7658
|
+
return _chunkNM7UAMC3cjs.frequencyOf.call(void 0, step, tuning);
|
|
7659
7659
|
}
|
|
7660
7660
|
/**
|
|
7661
7661
|
* Nearest step index to a frequency, the rounded inverse of
|
|
@@ -7672,7 +7672,7 @@ var Tuning = class _Tuning {
|
|
|
7672
7672
|
* ```
|
|
7673
7673
|
*/
|
|
7674
7674
|
nearestStep(freq, tuning = this.#table) {
|
|
7675
|
-
return
|
|
7675
|
+
return _chunkNM7UAMC3cjs.nearestStep.call(void 0, freq, tuning);
|
|
7676
7676
|
}
|
|
7677
7677
|
/**
|
|
7678
7678
|
* Step index of a frequency, unrounded.
|
|
@@ -7692,7 +7692,7 @@ var Tuning = class _Tuning {
|
|
|
7692
7692
|
* ```
|
|
7693
7693
|
*/
|
|
7694
7694
|
stepOf(freq, tuning = this.#table) {
|
|
7695
|
-
return
|
|
7695
|
+
return _chunkNM7UAMC3cjs.stepOf.call(void 0, freq, tuning);
|
|
7696
7696
|
}
|
|
7697
7697
|
/**
|
|
7698
7698
|
* How far a frequency sits from its nearest step, in cents; positive means
|
|
@@ -7709,7 +7709,7 @@ var Tuning = class _Tuning {
|
|
|
7709
7709
|
* ```
|
|
7710
7710
|
*/
|
|
7711
7711
|
centsFromNearestStep(freq, tuning = this.#table) {
|
|
7712
|
-
return
|
|
7712
|
+
return _chunkNM7UAMC3cjs.centsFromNearestStep.call(void 0, freq, tuning);
|
|
7713
7713
|
}
|
|
7714
7714
|
/**
|
|
7715
7715
|
* Cents spanned by a number of steps.
|
|
@@ -7725,7 +7725,7 @@ var Tuning = class _Tuning {
|
|
|
7725
7725
|
* ```
|
|
7726
7726
|
*/
|
|
7727
7727
|
centsOfSteps(steps, tuning = this.#table) {
|
|
7728
|
-
return
|
|
7728
|
+
return _chunkNM7UAMC3cjs.centsOfSteps.call(void 0, steps, tuning);
|
|
7729
7729
|
}
|
|
7730
7730
|
/**
|
|
7731
7731
|
* Steps spanned by an interval in cents, unrounded — the inverse of
|
|
@@ -7742,7 +7742,7 @@ var Tuning = class _Tuning {
|
|
|
7742
7742
|
* ```
|
|
7743
7743
|
*/
|
|
7744
7744
|
stepsOfCents(cents, tuning = this.#table) {
|
|
7745
|
-
return
|
|
7745
|
+
return _chunkNM7UAMC3cjs.stepsOfCents.call(void 0, cents, tuning);
|
|
7746
7746
|
}
|
|
7747
7747
|
/**
|
|
7748
7748
|
* Whether another tuning divides the octave the same way from the same
|
|
@@ -7791,17 +7791,17 @@ var Tuning = class _Tuning {
|
|
|
7791
7791
|
function copyPitches(pitches) {
|
|
7792
7792
|
assertDataArray(pitches, "voicing pitches");
|
|
7793
7793
|
if (pitches.length === 0) {
|
|
7794
|
-
throw new (0,
|
|
7794
|
+
throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)("a voicing must contain at least one pitch");
|
|
7795
7795
|
}
|
|
7796
|
-
return pitches.map((pitch, index) =>
|
|
7796
|
+
return pitches.map((pitch, index) => _chunkS5BKZZGMcjs.assertMidiPitch.call(void 0, pitch, `pitches[${index}]`));
|
|
7797
7797
|
}
|
|
7798
7798
|
function spellLine(line, key) {
|
|
7799
7799
|
return line.map(
|
|
7800
|
-
(value) => typeof value === "number" ?
|
|
7800
|
+
(value) => typeof value === "number" ? _chunk3R3QVKY5cjs.spellPitch.call(void 0, value, key.tonic, key) : _chunkS5BKZZGMcjs.toNoteData.call(void 0, value)
|
|
7801
7801
|
);
|
|
7802
7802
|
}
|
|
7803
7803
|
function lineOf(pitches, key) {
|
|
7804
|
-
return key === void 0 ? pitches.map((pitch) =>
|
|
7804
|
+
return key === void 0 ? pitches.map((pitch) => _chunkS5BKZZGMcjs.toNoteData.call(void 0, pitch)) : spellLine(pitches, key);
|
|
7805
7805
|
}
|
|
7806
7806
|
function carriedKeyOf(chord) {
|
|
7807
7807
|
if (typeof chord !== "object" || chord === null) {
|
|
@@ -7857,7 +7857,7 @@ var Voicing = class _Voicing {
|
|
|
7857
7857
|
* ```
|
|
7858
7858
|
*/
|
|
7859
7859
|
static forChord(chord, opts) {
|
|
7860
|
-
return new _Voicing(
|
|
7860
|
+
return new _Voicing(_chunk76ZBTRG2cjs.voiceChordStyled.call(void 0, chord, opts));
|
|
7861
7861
|
}
|
|
7862
7862
|
/**
|
|
7863
7863
|
* Realize a chord as one pitch per voice inside the voice ranges, defaulting
|
|
@@ -7881,7 +7881,7 @@ var Voicing = class _Voicing {
|
|
|
7881
7881
|
* ```
|
|
7882
7882
|
*/
|
|
7883
7883
|
static satb(chord, opts) {
|
|
7884
|
-
return new _Voicing(
|
|
7884
|
+
return new _Voicing(_chunk76ZBTRG2cjs.voiceChord.call(void 0, _chunk3R3QVKY5cjs.toChordData.call(void 0, chord), withCarriedKey(chord, opts)));
|
|
7885
7885
|
}
|
|
7886
7886
|
/**
|
|
7887
7887
|
* Wrap a plain pitch array, as {@link Voicing.data} hands it out.
|
|
@@ -7909,7 +7909,7 @@ var Voicing = class _Voicing {
|
|
|
7909
7909
|
* four-voice exercise against.
|
|
7910
7910
|
*/
|
|
7911
7911
|
static get satbRanges() {
|
|
7912
|
-
return
|
|
7912
|
+
return _chunk76ZBTRG2cjs.SATB_RANGES.map((range) => ({ min: range.min, max: range.max }));
|
|
7913
7913
|
}
|
|
7914
7914
|
/** A copy of the sounding MIDI pitches, lowest voice first. */
|
|
7915
7915
|
get pitches() {
|
|
@@ -7952,7 +7952,7 @@ var Voicing = class _Voicing {
|
|
|
7952
7952
|
*/
|
|
7953
7953
|
spell(key, chord) {
|
|
7954
7954
|
assertKeyArgument(key, "voicing key");
|
|
7955
|
-
return this.#spelled(
|
|
7955
|
+
return this.#spelled(_chunk3R3QVKY5cjs.resolveKey.call(void 0, key), chord).map((note) => new Note(note));
|
|
7956
7956
|
}
|
|
7957
7957
|
/**
|
|
7958
7958
|
* Voice a chord to follow smoothly from this voicing.
|
|
@@ -7982,7 +7982,7 @@ var Voicing = class _Voicing {
|
|
|
7982
7982
|
* ```
|
|
7983
7983
|
*/
|
|
7984
7984
|
next(chord, opts) {
|
|
7985
|
-
return new _Voicing(
|
|
7985
|
+
return new _Voicing(_chunk76ZBTRG2cjs.nextVoicing.call(void 0, this.pitches, _chunk3R3QVKY5cjs.toChordData.call(void 0, chord), withCarriedKey(chord, opts)));
|
|
7986
7986
|
}
|
|
7987
7987
|
/**
|
|
7988
7988
|
* The voice-leading cost from this voicing to another: the summed absolute
|
|
@@ -7994,7 +7994,7 @@ var Voicing = class _Voicing {
|
|
|
7994
7994
|
* voices and are therefore not comparable.
|
|
7995
7995
|
*/
|
|
7996
7996
|
costTo(other) {
|
|
7997
|
-
return
|
|
7997
|
+
return _chunk76ZBTRG2cjs.voiceLeadingCost.call(void 0, this.pitches, other.pitches);
|
|
7998
7998
|
}
|
|
7999
7999
|
/**
|
|
8000
8000
|
* Check the motion from this voicing to another against the four-part rules,
|
|
@@ -8025,14 +8025,14 @@ var Voicing = class _Voicing {
|
|
|
8025
8025
|
*/
|
|
8026
8026
|
checkTo(other, chords, key, opts) {
|
|
8027
8027
|
assertKeyArgument(key, "voicing key");
|
|
8028
|
-
const resolved =
|
|
8029
|
-
const from =
|
|
8030
|
-
const to =
|
|
8028
|
+
const resolved = _chunk3R3QVKY5cjs.resolveKey.call(void 0, key);
|
|
8029
|
+
const from = _chunk3R3QVKY5cjs.toChordData.call(void 0, chords[0]);
|
|
8030
|
+
const to = _chunk3R3QVKY5cjs.toChordData.call(void 0, chords[1]);
|
|
8031
8031
|
const voicings = [
|
|
8032
|
-
|
|
8033
|
-
|
|
8032
|
+
_chunk76ZBTRG2cjs.spellVoicing.call(void 0, this.pitches, from, resolved),
|
|
8033
|
+
_chunk76ZBTRG2cjs.spellVoicing.call(void 0, other.pitches, to, resolved)
|
|
8034
8034
|
];
|
|
8035
|
-
return
|
|
8035
|
+
return _chunk76ZBTRG2cjs.checkPartWriting.call(void 0, voicings, [from, to], resolved, opts);
|
|
8036
8036
|
}
|
|
8037
8037
|
/**
|
|
8038
8038
|
* Mark this voicing, read as a written counterpoint line, against a cantus
|
|
@@ -8062,8 +8062,8 @@ var Voicing = class _Voicing {
|
|
|
8062
8062
|
*/
|
|
8063
8063
|
species(cantusFirmus, species, mode, opts) {
|
|
8064
8064
|
assertKeyArgument(mode, "voicing mode");
|
|
8065
|
-
const resolved =
|
|
8066
|
-
return
|
|
8065
|
+
const resolved = _chunk3R3QVKY5cjs.resolveKey.call(void 0, mode);
|
|
8066
|
+
return _chunk76ZBTRG2cjs.checkSpecies.call(void 0,
|
|
8067
8067
|
spellLine(cantusFirmus, resolved),
|
|
8068
8068
|
spellLine(this.#pitches, resolved),
|
|
8069
8069
|
species,
|
|
@@ -8089,8 +8089,8 @@ var Voicing = class _Voicing {
|
|
|
8089
8089
|
*/
|
|
8090
8090
|
independence(other, opts) {
|
|
8091
8091
|
const { key, ...rest } = _nullishCoalesce(opts, () => ( {}));
|
|
8092
|
-
const resolved = key === void 0 ? void 0 :
|
|
8093
|
-
return
|
|
8092
|
+
const resolved = key === void 0 ? void 0 : _chunk3R3QVKY5cjs.resolveKey.call(void 0, key);
|
|
8093
|
+
return _chunk3R3QVKY5cjs.voiceIndependence.call(void 0,
|
|
8094
8094
|
lineOf(this.#pitches, resolved),
|
|
8095
8095
|
lineOf(other.pitches, resolved),
|
|
8096
8096
|
rest
|
|
@@ -8106,7 +8106,8 @@ var Voicing = class _Voicing {
|
|
|
8106
8106
|
* @param pitch The candidate MIDI pitch.
|
|
8107
8107
|
* @param query The candidate's harmonic and voice-leading context.
|
|
8108
8108
|
* @param opts Set `suggestions: false` to skip the search for safe
|
|
8109
|
-
* replacements when the verdict is not safe
|
|
8109
|
+
* replacements when the verdict is not safe, and `partners: true` to learn
|
|
8110
|
+
* which voice of this voicing, by index, raised each pairwise flag.
|
|
8110
8111
|
* @returns The verdict, reason bitmask, and optional resolution guidance.
|
|
8111
8112
|
* @throws If the profile is unknown, a value names no chord or key, or a
|
|
8112
8113
|
* pitch is not a MIDI pitch in 0..127.
|
|
@@ -8120,7 +8121,7 @@ var Voicing = class _Voicing {
|
|
|
8120
8121
|
* ```
|
|
8121
8122
|
*/
|
|
8122
8123
|
safetyOf(pitch, query, opts) {
|
|
8123
|
-
return
|
|
8124
|
+
return _chunk3R3QVKY5cjs.evaluateSafety.call(void 0, { ...this.#context(query), candidatePitch: pitch }, opts);
|
|
8124
8125
|
}
|
|
8125
8126
|
/**
|
|
8126
8127
|
* Enumerate the pitches placeable against these voices in a range, chord
|
|
@@ -8135,7 +8136,7 @@ var Voicing = class _Voicing {
|
|
|
8135
8136
|
* bound is not a MIDI pitch in 0..127 or is reversed.
|
|
8136
8137
|
*/
|
|
8137
8138
|
safePitches(query, pitchLow, pitchHigh) {
|
|
8138
|
-
return
|
|
8139
|
+
return _chunk3R3QVKY5cjs.enumerateSafePitches.call(void 0, this.#context(query), pitchLow, pitchHigh);
|
|
8139
8140
|
}
|
|
8140
8141
|
/**
|
|
8141
8142
|
* The n-th inversion of the voicing: the lowest voice taken up an octave, n
|
|
@@ -8159,7 +8160,7 @@ var Voicing = class _Voicing {
|
|
|
8159
8160
|
* ```
|
|
8160
8161
|
*/
|
|
8161
8162
|
invert(n) {
|
|
8162
|
-
|
|
8163
|
+
_chunkS5BKZZGMcjs.assertInteger.call(void 0, n, "voicing inversion", -128, 128);
|
|
8163
8164
|
if (n === 0) {
|
|
8164
8165
|
return this;
|
|
8165
8166
|
}
|
|
@@ -8168,7 +8169,7 @@ var Voicing = class _Voicing {
|
|
|
8168
8169
|
const index = n > 0 ? 0 : pitches.length - 1;
|
|
8169
8170
|
const pitch = pitches[index] + (n > 0 ? 12 : -12);
|
|
8170
8171
|
pitches.splice(index, 1);
|
|
8171
|
-
pitches.push(
|
|
8172
|
+
pitches.push(_chunkS5BKZZGMcjs.assertMidiPitch.call(void 0, pitch, "inverted voice"));
|
|
8172
8173
|
pitches.sort((a, b) => a - b);
|
|
8173
8174
|
}
|
|
8174
8175
|
return new _Voicing(pitches);
|
|
@@ -8208,7 +8209,7 @@ var Voicing = class _Voicing {
|
|
|
8208
8209
|
}
|
|
8209
8210
|
/** Spell the voicing, by the key alone or against a chord as well. */
|
|
8210
8211
|
#spelled(key, chord) {
|
|
8211
|
-
return chord === void 0 ? spellLine(this.#pitches, key) :
|
|
8212
|
+
return chord === void 0 ? spellLine(this.#pitches, key) : _chunk76ZBTRG2cjs.spellVoicing.call(void 0, this.pitches, _chunk3R3QVKY5cjs.toChordData.call(void 0, chord), key);
|
|
8212
8213
|
}
|
|
8213
8214
|
/** The safety context these voices supply, minus the candidate pitch. */
|
|
8214
8215
|
#context(query) {
|
|
@@ -8219,8 +8220,8 @@ var Voicing = class _Voicing {
|
|
|
8219
8220
|
});
|
|
8220
8221
|
return {
|
|
8221
8222
|
profile: query.profile,
|
|
8222
|
-
chord: query.chord === null ? null :
|
|
8223
|
-
key:
|
|
8223
|
+
chord: query.chord === null ? null : _chunk3R3QVKY5cjs.toChordData.call(void 0, query.chord),
|
|
8224
|
+
key: _chunk3R3QVKY5cjs.resolveKey.call(void 0, query.key).scale,
|
|
8224
8225
|
otherVoices,
|
|
8225
8226
|
strongBeat: query.strongBeat,
|
|
8226
8227
|
prevPitch: query.prevPitch,
|
|
@@ -8249,4 +8250,4 @@ var Voicing = class _Voicing {
|
|
|
8249
8250
|
|
|
8250
8251
|
|
|
8251
8252
|
exports.Interval = Interval; exports.Note = Note; exports.Timeline = Timeline; exports.Progression = Progression; exports.Chord = Chord; exports.Key = Key; exports.Score = Score; exports.Arrangement = Arrangement; exports.Instrument = Instrument; exports.Composer = Composer; exports.Duration = Duration; exports.Meter = Meter; exports.Motif = Motif; exports.Rhythm = Rhythm; exports.Tempo = Tempo; exports.Tuning = Tuning; exports.Voicing = Voicing;
|
|
8252
|
-
//# sourceMappingURL=chunk-
|
|
8253
|
+
//# sourceMappingURL=chunk-DSMJRXCZ.cjs.map
|