@libraz/libcantus 1.2.0 → 1.3.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.
Files changed (56) hide show
  1. package/README.md +4 -0
  2. package/README_ja.md +4 -0
  3. package/dist/analyze/index.cjs +28 -4
  4. package/dist/analyze/index.cjs.map +1 -1
  5. package/dist/analyze/index.d.cts +151 -5
  6. package/dist/analyze/index.d.ts +151 -5
  7. package/dist/analyze/index.js +34 -10
  8. package/dist/{chunk-DSMJRXCZ.cjs → chunk-4R2LWV7E.cjs} +384 -107
  9. package/dist/chunk-4R2LWV7E.cjs.map +1 -0
  10. package/dist/{chunk-J7FHVZII.cjs → chunk-B2PW6EHN.cjs} +2000 -30
  11. package/dist/chunk-B2PW6EHN.cjs.map +1 -0
  12. package/dist/{chunk-Q6LFSAKV.js → chunk-CPMB7P75.js} +1973 -3
  13. package/dist/chunk-CPMB7P75.js.map +1 -0
  14. package/dist/{chunk-H2KJHBW4.js → chunk-GNVN4PPJ.js} +1871 -5
  15. package/dist/chunk-GNVN4PPJ.js.map +1 -0
  16. package/dist/{chunk-SGLEQVJH.cjs → chunk-IFZDWIKM.cjs} +1868 -2
  17. package/dist/chunk-IFZDWIKM.cjs.map +1 -0
  18. package/dist/{chunk-FBH75DAY.js → chunk-IPEF6NWB.js} +287 -10
  19. package/dist/chunk-IPEF6NWB.js.map +1 -0
  20. package/dist/{chunk-HYJJ2V2I.js → chunk-MLBPXA4Z.js} +300 -720
  21. package/dist/chunk-MLBPXA4Z.js.map +1 -0
  22. package/dist/{chunk-HWHGOVO6.cjs → chunk-PWC4CRWT.cjs} +1 -1
  23. package/dist/{chunk-HWHGOVO6.cjs.map → chunk-PWC4CRWT.cjs.map} +1 -1
  24. package/dist/{chunk-HPVSH7SF.cjs → chunk-YFA7X2F6.cjs} +350 -770
  25. package/dist/chunk-YFA7X2F6.cjs.map +1 -0
  26. package/dist/{chunk-NFJ4P6ZZ.js → chunk-ZBUROTJQ.js} +1 -1
  27. package/dist/generate/index.cjs +15 -3
  28. package/dist/generate/index.cjs.map +1 -1
  29. package/dist/generate/index.d.cts +84 -6
  30. package/dist/generate/index.d.ts +84 -6
  31. package/dist/generate/index.js +14 -2
  32. package/dist/{index-BNSM-DSk.d.cts → index-CY-3NVfy.d.cts} +484 -3
  33. package/dist/{index-BJgP97N1.d.ts → index-zaZdmnU4.d.ts} +484 -3
  34. package/dist/index.cjs +43 -7
  35. package/dist/index.cjs.map +1 -1
  36. package/dist/index.d.cts +5 -5
  37. package/dist/index.d.ts +5 -5
  38. package/dist/index.js +48 -12
  39. package/dist/model/index.cjs +5 -5
  40. package/dist/model/index.d.cts +203 -7
  41. package/dist/model/index.d.ts +203 -7
  42. package/dist/model/index.js +4 -4
  43. package/dist/{index-DGCNKAUr.d.cts → profile-CQMEqdH9.d.cts} +65 -598
  44. package/dist/{index-BRMbPkHE.d.ts → profile-DLdlIpS9.d.ts} +65 -598
  45. package/dist/{index-BBWNZS0f.d.cts → types-D-XgxGvp.d.cts} +1169 -13
  46. package/dist/{index-CJBBiAmU.d.ts → types-Dh7C064C.d.ts} +1169 -13
  47. package/package.json +5 -5
  48. package/dist/chunk-DSMJRXCZ.cjs.map +0 -1
  49. package/dist/chunk-FBH75DAY.js.map +0 -1
  50. package/dist/chunk-H2KJHBW4.js.map +0 -1
  51. package/dist/chunk-HPVSH7SF.cjs.map +0 -1
  52. package/dist/chunk-HYJJ2V2I.js.map +0 -1
  53. package/dist/chunk-J7FHVZII.cjs.map +0 -1
  54. package/dist/chunk-Q6LFSAKV.js.map +0 -1
  55. package/dist/chunk-SGLEQVJH.cjs.map +0 -1
  56. /package/dist/{chunk-NFJ4P6ZZ.js.map → chunk-ZBUROTJQ.js.map} +0 -0
@@ -10,11 +10,11 @@
10
10
 
11
11
 
12
12
 
13
+ var _chunkYFA7X2F6cjs = require('./chunk-YFA7X2F6.cjs');
13
14
 
14
15
 
15
16
 
16
17
 
17
- var _chunkHPVSH7SFcjs = require('./chunk-HPVSH7SF.cjs');
18
18
 
19
19
 
20
20
 
@@ -34,11 +34,17 @@ var _chunkHPVSH7SFcjs = require('./chunk-HPVSH7SF.cjs');
34
34
 
35
35
 
36
36
 
37
+ var _chunkNM7UAMC3cjs = require('./chunk-NM7UAMC3.cjs');
38
+
39
+
40
+
41
+
42
+
43
+
37
44
 
38
45
 
39
46
 
40
47
 
41
- var _chunkNM7UAMC3cjs = require('./chunk-NM7UAMC3.cjs');
42
48
 
43
49
 
44
50
 
@@ -62,6 +68,7 @@ var _chunkNM7UAMC3cjs = require('./chunk-NM7UAMC3.cjs');
62
68
 
63
69
 
64
70
 
71
+ var _chunkB2PW6EHNcjs = require('./chunk-B2PW6EHN.cjs');
65
72
 
66
73
 
67
74
 
@@ -69,7 +76,6 @@ var _chunkNM7UAMC3cjs = require('./chunk-NM7UAMC3.cjs');
69
76
 
70
77
 
71
78
 
72
- var _chunkJ7FHVZIIcjs = require('./chunk-J7FHVZII.cjs');
73
79
 
74
80
 
75
81
 
@@ -97,7 +103,8 @@ var _chunkJ7FHVZIIcjs = require('./chunk-J7FHVZII.cjs');
97
103
 
98
104
 
99
105
 
100
- var _chunkSGLEQVJHcjs = require('./chunk-SGLEQVJH.cjs');
106
+
107
+ var _chunkIFZDWIKMcjs = require('./chunk-IFZDWIKM.cjs');
101
108
 
102
109
 
103
110
 
@@ -1160,7 +1167,7 @@ var Timeline = class _Timeline {
1160
1167
  * @returns The timeline.
1161
1168
  */
1162
1169
  static fromChords(spans, totalBeats, key) {
1163
- const timeline = _chunkSGLEQVJHcjs.chordTimelineFromChords.call(void 0, spans, totalBeats);
1170
+ const timeline = _chunkIFZDWIKMcjs.chordTimelineFromChords.call(void 0, spans, totalBeats);
1164
1171
  const data = { segments: timeline.segments, totalBeats };
1165
1172
  if (key !== void 0) {
1166
1173
  data.keys = [
@@ -1184,7 +1191,7 @@ var Timeline = class _Timeline {
1184
1191
  * @returns The inferred timeline, carrying the key regions the analysis found.
1185
1192
  */
1186
1193
  static fromNotes(notes, opts) {
1187
- const { timeline, keys, segmentConfidence } = _chunkSGLEQVJHcjs.chordTimelineFromNotes.call(void 0, notes, opts);
1194
+ const { timeline, keys, segmentConfidence } = _chunkIFZDWIKMcjs.chordTimelineFromNotes.call(void 0, notes, opts);
1188
1195
  const totalBeats = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _5 => _5.totalBeats]), () => ( spanEnd(timeline.segments, keys)));
1189
1196
  return new _Timeline({ segments: timeline.segments, totalBeats, keys, segmentConfidence });
1190
1197
  }
@@ -1231,7 +1238,7 @@ var Timeline = class _Timeline {
1231
1238
  * @throws If `beat` is not finite.
1232
1239
  */
1233
1240
  at(beat) {
1234
- const chord = _chunkSGLEQVJHcjs.chordAtBeat.call(void 0, this.#segments, beat);
1241
+ const chord = _chunkIFZDWIKMcjs.chordAtBeat.call(void 0, this.#segments, beat);
1235
1242
  if (chord === null) {
1236
1243
  return null;
1237
1244
  }
@@ -1248,7 +1255,7 @@ var Timeline = class _Timeline {
1248
1255
  }
1249
1256
  /** The key held longest across the span, when the analysis found one. */
1250
1257
  get key() {
1251
- const prevailing = _chunkSGLEQVJHcjs.prevailingKeyOf.call(void 0, this.#keys);
1258
+ const prevailing = _chunkIFZDWIKMcjs.prevailingKeyOf.call(void 0, this.#keys);
1252
1259
  return prevailing === null ? void 0 : toKey(prevailing);
1253
1260
  }
1254
1261
  /**
@@ -1320,7 +1327,7 @@ var Timeline = class _Timeline {
1320
1327
  * @throws If the timeline carries no key region to read the chords against.
1321
1328
  */
1322
1329
  reduce(opts) {
1323
- return _chunkHPVSH7SFcjs.reduceProgression.call(void 0, this.chordTimeline, this.#keyContext(), opts);
1330
+ return _chunkIFZDWIKMcjs.reduceProgression.call(void 0, this.chordTimeline, this.#keyContext(), opts);
1324
1331
  }
1325
1332
  /**
1326
1333
  * The cadences the harmony arrives at.
@@ -1333,7 +1340,7 @@ var Timeline = class _Timeline {
1333
1340
  * @throws If the timeline carries no key region to read the chords against.
1334
1341
  */
1335
1342
  cadences() {
1336
- return _chunkSGLEQVJHcjs.detectCadences.call(void 0, this.chordTimeline, this.#keyContext());
1343
+ return _chunkIFZDWIKMcjs.detectCadences.call(void 0, this.chordTimeline, this.#keyContext());
1337
1344
  }
1338
1345
  /**
1339
1346
  * The keys the chords themselves imply, in time order.
@@ -1362,7 +1369,7 @@ var Timeline = class _Timeline {
1362
1369
  * ```
1363
1370
  */
1364
1371
  modulations(opts) {
1365
- return _chunkSGLEQVJHcjs.detectModulations.call(void 0, this.#copySegments(), {
1372
+ return _chunkIFZDWIKMcjs.detectModulations.call(void 0, this.#copySegments(), {
1366
1373
  totalBeats: this.#totalBeats,
1367
1374
  ...opts
1368
1375
  }).map(copyKeyRegion);
@@ -1385,7 +1392,7 @@ var Timeline = class _Timeline {
1385
1392
  return this.#segments.map((segment) => ({
1386
1393
  startBeat: segment.startBeat,
1387
1394
  endBeat: segment.endBeat,
1388
- roman: _chunkSGLEQVJHcjs.chordToRoman.call(void 0, segment.chord, keyAt(segment.startBeat), opts)
1395
+ roman: _chunkIFZDWIKMcjs.chordToRoman.call(void 0, segment.chord, keyAt(segment.startBeat), opts)
1389
1396
  }));
1390
1397
  }
1391
1398
  /**
@@ -1500,7 +1507,7 @@ var Timeline = class _Timeline {
1500
1507
  /** The `{ at, segments }` shape the analysis functions take. */
1501
1508
  get chordTimeline() {
1502
1509
  const segments = this.#copySegments();
1503
- return { at: (beat) => _chunkSGLEQVJHcjs.chordAtBeat.call(void 0, segments, beat), segments };
1510
+ return { at: (beat) => _chunkIFZDWIKMcjs.chordAtBeat.call(void 0, segments, beat), segments };
1504
1511
  }
1505
1512
  /** A fresh copy of the segments, which is what every reader is handed. */
1506
1513
  #copySegments() {
@@ -1508,8 +1515,8 @@ var Timeline = class _Timeline {
1508
1515
  }
1509
1516
  /** The key in force at a beat, or undefined when the timeline knows none. */
1510
1517
  #keyAt(beat) {
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));
1518
+ const prevailing = _chunkIFZDWIKMcjs.prevailingKeyOf.call(void 0, this.#keys);
1519
+ return prevailing === null ? void 0 : toKey(_chunkIFZDWIKMcjs.keyLookup.call(void 0, this.#keys, prevailing)(beat));
1513
1520
  }
1514
1521
  /**
1515
1522
  * The key every beat of the timeline is read against, spelling and all.
@@ -1522,13 +1529,13 @@ var Timeline = class _Timeline {
1522
1529
  * would number it as the G# minor those read best as.
1523
1530
  */
1524
1531
  #resolvedKeyAt() {
1525
- const prevailing = _chunkSGLEQVJHcjs.prevailingKeyOf.call(void 0, this.#keys);
1532
+ const prevailing = _chunkIFZDWIKMcjs.prevailingKeyOf.call(void 0, this.#keys);
1526
1533
  if (prevailing === null) {
1527
1534
  throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)(
1528
1535
  "timeline carries no key; build it from notes, or pass a key to Timeline.fromChords"
1529
1536
  );
1530
1537
  }
1531
- return _chunkSGLEQVJHcjs.keyLookup.call(void 0, this.#keys, prevailing);
1538
+ return _chunkIFZDWIKMcjs.keyLookup.call(void 0, this.#keys, prevailing);
1532
1539
  }
1533
1540
  /**
1534
1541
  * The pitch classes of that key, for the readings that want them.
@@ -1937,7 +1944,7 @@ var Progression = class _Progression {
1937
1944
  const from = this.#chords[this.#chords.length - 2];
1938
1945
  const to = this.#chords[this.#chords.length - 1];
1939
1946
  const approach = this.#chords[this.#chords.length - 3];
1940
- const cadence = from !== void 0 && to !== void 0 ? _chunkSGLEQVJHcjs.detectCadence.call(void 0, from.data, to.data, resolved, {
1947
+ const cadence = from !== void 0 && to !== void 0 ? _chunkIFZDWIKMcjs.detectCadence.call(void 0, from.data, to.data, resolved, {
1941
1948
  ...cadenceOpts,
1942
1949
  ...approach === void 0 ? {} : { approach: approach.data },
1943
1950
  ...voicing === void 0 ? {} : { voicing: this.#closingVoicing(voicing) }
@@ -2014,7 +2021,7 @@ var Progression = class _Progression {
2014
2021
  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
2022
  const pair = _optionalChain([opts, 'optionalAccess', _11 => _11.voicing]);
2016
2023
  found.push(
2017
- _chunkSGLEQVJHcjs.detectCadence.call(void 0, from.data, to.data, resolved, {
2024
+ _chunkIFZDWIKMcjs.detectCadence.call(void 0, from.data, to.data, resolved, {
2018
2025
  ..._optionalChain([opts, 'optionalAccess', _12 => _12.alternatives]) === void 0 ? {} : { alternatives: opts.alternatives },
2019
2026
  ...approach === void 0 ? {} : { approach },
2020
2027
  ...pair === void 0 ? {} : { voicing: [_nullishCoalesce(pair[index - 1], () => ( [])), _nullishCoalesce(pair[index], () => ( []))] }
@@ -2056,7 +2063,7 @@ var Progression = class _Progression {
2056
2063
  );
2057
2064
  }
2058
2065
  const key = this.#resolveKey();
2059
- const chosen = _chunkJ7FHVZIIcjs.substituteChord.call(void 0, target.data, key, opts).find(
2066
+ const chosen = _chunkB2PW6EHNcjs.substituteChord.call(void 0, target.data, key, opts).find(
2060
2067
  (candidate) => candidate.type === type
2061
2068
  );
2062
2069
  if (chosen === void 0) {
@@ -2446,7 +2453,7 @@ var Chord = class _Chord {
2446
2453
  * @returns Ranked chord interpretations (may be empty).
2447
2454
  */
2448
2455
  static detect(pitches, opts) {
2449
- return _chunkSGLEQVJHcjs.detectChord.call(void 0, pitches, opts).map(
2456
+ return _chunkIFZDWIKMcjs.detectChord.call(void 0, pitches, opts).map(
2450
2457
  (match) => new _Chord(_chunk3R3QVKY5cjs.makeChord.call(void 0, match.rootPc, match.quality, match.bassPc))
2451
2458
  );
2452
2459
  }
@@ -2469,7 +2476,7 @@ var Chord = class _Chord {
2469
2476
  * ```
2470
2477
  */
2471
2478
  static detectMatches(pitches, opts) {
2472
- return _chunkSGLEQVJHcjs.detectChord.call(void 0, pitches, opts).map((match) => ({
2479
+ return _chunkIFZDWIKMcjs.detectChord.call(void 0, pitches, opts).map((match) => ({
2473
2480
  chord: new _Chord(_chunk3R3QVKY5cjs.makeChord.call(void 0, match.rootPc, match.quality, match.bassPc)),
2474
2481
  match
2475
2482
  }));
@@ -2482,7 +2489,7 @@ var Chord = class _Chord {
2482
2489
  * @returns The top-ranked chord, or null when nothing matches.
2483
2490
  */
2484
2491
  static detectBest(pitches, opts) {
2485
- const best = _chunkSGLEQVJHcjs.detectChordBest.call(void 0, pitches, opts);
2492
+ const best = _chunkIFZDWIKMcjs.detectChordBest.call(void 0, pitches, opts);
2486
2493
  return best === null ? null : new _Chord(best);
2487
2494
  }
2488
2495
  /** The root pitch class (0..11). */
@@ -2617,7 +2624,7 @@ var Chord = class _Chord {
2617
2624
  * @throws If no key is given and none is carried.
2618
2625
  */
2619
2626
  roman(key, opts) {
2620
- return _chunkSGLEQVJHcjs.chordToRoman.call(void 0, this.#data, this.#resolveKey(key), opts);
2627
+ return _chunkIFZDWIKMcjs.chordToRoman.call(void 0, this.#data, this.#resolveKey(key), opts);
2621
2628
  }
2622
2629
  /**
2623
2630
  * The chord's Roman numeral together with the reasoning behind it: the degree
@@ -2645,7 +2652,7 @@ var Chord = class _Chord {
2645
2652
  * ```
2646
2653
  */
2647
2654
  explain(key, opts) {
2648
- return _chunkSGLEQVJHcjs.explainRoman.call(void 0, this.#data, this.#resolveKey(key), opts);
2655
+ return _chunkIFZDWIKMcjs.explainRoman.call(void 0, this.#data, this.#resolveKey(key), opts);
2649
2656
  }
2650
2657
  /**
2651
2658
  * The chord's harmonic function (tonic / subdominant / dominant) in a key.
@@ -2656,7 +2663,7 @@ var Chord = class _Chord {
2656
2663
  * @throws If no key is given and none is carried.
2657
2664
  */
2658
2665
  function(key) {
2659
- return _chunkSGLEQVJHcjs.functionOf.call(void 0, this.#data, this.#resolveKey(key));
2666
+ return _chunkIFZDWIKMcjs.functionOf.call(void 0, this.#data, this.#resolveKey(key));
2660
2667
  }
2661
2668
  /**
2662
2669
  * Full functional analysis: function, borrowing, Roman numeral, and the
@@ -2676,7 +2683,7 @@ var Chord = class _Chord {
2676
2683
  * ```
2677
2684
  */
2678
2685
  analyze(key, opts) {
2679
- return _chunkSGLEQVJHcjs.analyzeChord.call(void 0, this.#data, this.#resolveKey(key), opts);
2686
+ return _chunkIFZDWIKMcjs.analyzeChord.call(void 0, this.#data, this.#resolveKey(key), opts);
2680
2687
  }
2681
2688
  /**
2682
2689
  * Whether the chord is borrowed from the parallel mode (modal interchange).
@@ -2687,7 +2694,7 @@ var Chord = class _Chord {
2687
2694
  * @throws If no key is given and none is carried.
2688
2695
  */
2689
2696
  isBorrowed(key) {
2690
- return _chunkSGLEQVJHcjs.isBorrowedChord.call(void 0, this.#data, this.#resolveKey(key));
2697
+ return _chunkIFZDWIKMcjs.isBorrowedChord.call(void 0, this.#data, this.#resolveKey(key));
2691
2698
  }
2692
2699
  /**
2693
2700
  * The origin of a non-diatonic chord (parallel mode or Neapolitan), or null.
@@ -2698,7 +2705,7 @@ var Chord = class _Chord {
2698
2705
  * @throws If no key is given and none is carried.
2699
2706
  */
2700
2707
  borrowedSource(key) {
2701
- return _chunkSGLEQVJHcjs.borrowedSource.call(void 0, this.#data, this.#resolveKey(key));
2708
+ return _chunkIFZDWIKMcjs.borrowedSource.call(void 0, this.#data, this.#resolveKey(key));
2702
2709
  }
2703
2710
  /**
2704
2711
  * The chord written as the figures a bass would carry under it: `6`, `64`,
@@ -2750,7 +2757,7 @@ var Chord = class _Chord {
2750
2757
  * ```
2751
2758
  */
2752
2759
  substitutions(key, opts) {
2753
- return _chunkJ7FHVZIIcjs.substituteChord.call(void 0, this.#data, this.#resolveKey(key), opts);
2760
+ return _chunkB2PW6EHNcjs.substituteChord.call(void 0, this.#data, this.#resolveKey(key), opts);
2754
2761
  }
2755
2762
  /**
2756
2763
  * The modal-interchange palette of the chord's key: the parallel mode's
@@ -2775,7 +2782,7 @@ var Chord = class _Chord {
2775
2782
  * ```
2776
2783
  */
2777
2784
  modalInterchange(key) {
2778
- return _chunkJ7FHVZIIcjs.modalInterchangePalette.call(void 0, this.#resolveKey(key));
2785
+ return _chunkB2PW6EHNcjs.modalInterchangePalette.call(void 0, this.#resolveKey(key));
2779
2786
  }
2780
2787
  /**
2781
2788
  * The chord rendered as a lead-sheet symbol (e.g. `'Cmaj7'`, `'F#m7'`, `'C/G'`).
@@ -2827,7 +2834,7 @@ var Chord = class _Chord {
2827
2834
  */
2828
2835
  negativeHarmony(key) {
2829
2836
  const resolved = this.#resolveKey(key);
2830
- return new _Chord(_chunkJ7FHVZIIcjs.negativeHarmonyMirror.call(void 0, this.#data, resolved), resolved);
2837
+ return new _Chord(_chunkB2PW6EHNcjs.negativeHarmonyMirror.call(void 0, this.#data, resolved), resolved);
2831
2838
  }
2832
2839
  /**
2833
2840
  * The V7 that tonicizes this chord: a dominant seventh a perfect fifth above
@@ -2845,7 +2852,7 @@ var Chord = class _Chord {
2845
2852
  * ```
2846
2853
  */
2847
2854
  secondaryDominant() {
2848
- return new _Chord(_chunkSGLEQVJHcjs.secondaryDominantOf.call(void 0, this.#given), this.#key);
2855
+ return new _Chord(_chunkIFZDWIKMcjs.secondaryDominantOf.call(void 0, this.#given), this.#key);
2849
2856
  }
2850
2857
  /**
2851
2858
  * The n-th inversion: a copy whose bass is the chord tone `n` steps above the
@@ -3440,7 +3447,7 @@ var Key = class _Key {
3440
3447
  * @returns Ranked key matches (may be empty).
3441
3448
  */
3442
3449
  static detectMatches(pitches, opts) {
3443
- return _chunkSGLEQVJHcjs.detectKey.call(void 0, pitches, opts).map((match) => _Key.#fromMatch(match));
3450
+ return _chunkIFZDWIKMcjs.detectKey.call(void 0, pitches, opts).map((match) => _Key.#fromMatch(match));
3444
3451
  }
3445
3452
  /**
3446
3453
  * The single best key interpretation of a pitch set.
@@ -3455,7 +3462,7 @@ var Key = class _Key {
3455
3462
  * ```
3456
3463
  */
3457
3464
  static detectBest(pitches, opts) {
3458
- const best = _chunkSGLEQVJHcjs.detectKeyBest.call(void 0, pitches, opts);
3465
+ const best = _chunkIFZDWIKMcjs.detectKeyBest.call(void 0, pitches, opts);
3459
3466
  return best === null ? null : _Key.#fromMatch(best).key;
3460
3467
  }
3461
3468
  /**
@@ -3485,7 +3492,7 @@ var Key = class _Key {
3485
3492
  }
3486
3493
  /** Whether the scale has a minor third and no major third. */
3487
3494
  get isMinor() {
3488
- return _chunkSGLEQVJHcjs.isMinorKey.call(void 0, this.#scale);
3495
+ return _chunkIFZDWIKMcjs.isMinorKey.call(void 0, this.#scale);
3489
3496
  }
3490
3497
  /**
3491
3498
  * The key signature as a signed count of sharps (positive) or flats
@@ -3778,7 +3785,7 @@ var Key = class _Key {
3778
3785
  */
3779
3786
  pivotsTo(other) {
3780
3787
  assertKeyArgument(other, "key");
3781
- return _chunkSGLEQVJHcjs.pivotChords.call(void 0, this.#scale, other).map(({ chord, romanFrom, romanTo }) => ({
3788
+ return _chunkIFZDWIKMcjs.pivotChords.call(void 0, this.#scale, other).map(({ chord, romanFrom, romanTo }) => ({
3782
3789
  chord: new Chord(chord, this),
3783
3790
  romanFrom,
3784
3791
  romanTo
@@ -4162,7 +4169,7 @@ var Key = class _Key {
4162
4169
  * @throws If the numeral is not valid.
4163
4170
  */
4164
4171
  roman(text) {
4165
- return new Chord(_chunkSGLEQVJHcjs.romanToChord.call(void 0, text, this), this);
4172
+ return new Chord(_chunkIFZDWIKMcjs.romanToChord.call(void 0, text, this), this);
4166
4173
  }
4167
4174
  /**
4168
4175
  * The augmented sixth chord of a kind, built in this key.
@@ -4183,7 +4190,7 @@ var Key = class _Key {
4183
4190
  * ```
4184
4191
  */
4185
4192
  augmentedSixth(kind) {
4186
- return new Chord(_chunkSGLEQVJHcjs.augmentedSixthChord.call(void 0, kind, keyIdentity(this)), this);
4193
+ return new Chord(_chunkIFZDWIKMcjs.augmentedSixthChord.call(void 0, kind, keyIdentity(this)), this);
4187
4194
  }
4188
4195
  /**
4189
4196
  * Build a progression from Roman numerals in this key.
@@ -4411,6 +4418,8 @@ var Score = class _Score {
4411
4418
  #chords;
4412
4419
  /** The key regions, made on the first member that needs them. */
4413
4420
  #regions;
4421
+ /** The reference profile asked for with no options, made on first read. */
4422
+ #profile;
4414
4423
  /**
4415
4424
  * Wrap plain score data.
4416
4425
  *
@@ -4653,7 +4662,7 @@ var Score = class _Score {
4653
4662
  * @returns The humanized score.
4654
4663
  */
4655
4664
  humanize(opts) {
4656
- return this.#withNotes(_chunkJ7FHVZIIcjs.humanize.call(void 0, this.#data.notes, { ts: this.meterAt(0), ...opts }));
4665
+ return this.#withNotes(_chunkB2PW6EHNcjs.humanize.call(void 0, this.#data.notes, { ts: this.meterAt(0), ...opts }));
4657
4666
  }
4658
4667
  /**
4659
4668
  * The notes with ornaments added.
@@ -4666,7 +4675,7 @@ var Score = class _Score {
4666
4675
  * @returns The ornamented score.
4667
4676
  */
4668
4677
  ornament(opts) {
4669
- return this.#withNotes(_chunkJ7FHVZIIcjs.ornament.call(void 0, this.#data.notes, { ts: this.meterAt(0), ...opts }));
4678
+ return this.#withNotes(_chunkB2PW6EHNcjs.ornament.call(void 0, this.#data.notes, { ts: this.meterAt(0), ...opts }));
4670
4679
  }
4671
4680
  /**
4672
4681
  * The notes placed on a groove template's slots.
@@ -4680,7 +4689,7 @@ var Score = class _Score {
4680
4689
  * @throws If the template was extracted under another meter.
4681
4690
  */
4682
4691
  groove(template) {
4683
- return this.#withNotes(_chunkJ7FHVZIIcjs.applyGrooveTemplate.call(void 0, this.#data.notes, template, this.meterAt(0)));
4692
+ return this.#withNotes(_chunkB2PW6EHNcjs.applyGrooveTemplate.call(void 0, this.#data.notes, template, this.meterAt(0)));
4684
4693
  }
4685
4694
  /**
4686
4695
  * The feel of the score's own timing, as a template another score can take on.
@@ -4704,7 +4713,7 @@ var Score = class _Score {
4704
4713
  * ```
4705
4714
  */
4706
4715
  grooveTemplate(subdivision) {
4707
- return _chunkJ7FHVZIIcjs.extractGrooveTemplate.call(void 0, this.#data.notes, this.meterAt(0), subdivision);
4716
+ return _chunkB2PW6EHNcjs.extractGrooveTemplate.call(void 0, this.#data.notes, this.meterAt(0), subdivision);
4708
4717
  }
4709
4718
  /**
4710
4719
  * The harmony the notes spell out, in time.
@@ -4717,7 +4726,7 @@ var Score = class _Score {
4717
4726
  * and how sure it is of each segment.
4718
4727
  */
4719
4728
  timeline(opts) {
4720
- const result = opts === void 0 ? this.#chordAnalysis() : _chunkSGLEQVJHcjs.chordTimelineFromNotes.call(void 0, this.#data.notes, this.#analysisOptions(opts));
4729
+ const result = opts === void 0 ? this.#chordAnalysis() : _chunkIFZDWIKMcjs.chordTimelineFromNotes.call(void 0, this.#data.notes, this.#analysisOptions(opts));
4721
4730
  return Timeline.fromData({
4722
4731
  segments: result.timeline.segments,
4723
4732
  totalBeats: _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _36 => _36.totalBeats]), () => ( this.totalBeats)),
@@ -4739,7 +4748,7 @@ var Score = class _Score {
4739
4748
  if (this.#key !== void 0) {
4740
4749
  return this.#key;
4741
4750
  }
4742
- const prevailing = _chunkSGLEQVJHcjs.prevailingKeyOf.call(void 0, this.#keyRegions());
4751
+ const prevailing = _chunkIFZDWIKMcjs.prevailingKeyOf.call(void 0, this.#keyRegions());
4743
4752
  return prevailing === null ? void 0 : toKey(prevailing);
4744
4753
  }
4745
4754
  /**
@@ -4760,7 +4769,7 @@ var Score = class _Score {
4760
4769
  if (this.#key !== void 0) {
4761
4770
  return statedKeyRegions(this.#key, this.#data.notes, _nullishCoalesce(opts.totalBeats, () => ( this.totalBeats)));
4762
4771
  }
4763
- return _chunkSGLEQVJHcjs.keyTimelineFromNotes.call(void 0, this.#data.notes, { meters: this.#data.meters, ...opts });
4772
+ return _chunkIFZDWIKMcjs.keyTimelineFromNotes.call(void 0, this.#data.notes, { meters: this.#data.meters, ...opts });
4764
4773
  }
4765
4774
  return this.#keyRegions().map(copyKeyRegion);
4766
4775
  }
@@ -4788,7 +4797,7 @@ var Score = class _Score {
4788
4797
  * ```
4789
4798
  */
4790
4799
  detectKeys(opts) {
4791
- return _chunkSGLEQVJHcjs.detectKeyFromNotes.call(void 0, this.#data.notes, opts).map(detectedKeyMatch);
4800
+ return _chunkIFZDWIKMcjs.detectKeyFromNotes.call(void 0, this.#data.notes, opts).map(detectedKeyMatch);
4792
4801
  }
4793
4802
  /**
4794
4803
  * The phrases the notes fall into.
@@ -4800,7 +4809,7 @@ var Score = class _Score {
4800
4809
  * @returns The phrases, in time order.
4801
4810
  */
4802
4811
  phrases(opts) {
4803
- return _chunkHPVSH7SFcjs.phrasesFromTimeline.call(void 0, this.#chordTimeline(), this.#data.notes, {
4812
+ return _chunkYFA7X2F6cjs.phrasesFromTimeline.call(void 0, this.#chordTimeline(), this.#data.notes, {
4804
4813
  meters: this.#data.meters,
4805
4814
  ...this.#key === void 0 ? {} : { key: keyIdentity(this.#key) },
4806
4815
  ...opts
@@ -4820,7 +4829,7 @@ var Score = class _Score {
4820
4829
  * @returns The cadences, heaviest first; ties keep the earlier one.
4821
4830
  */
4822
4831
  structuralCadences(opts) {
4823
- return _chunkHPVSH7SFcjs.structuralCadences.call(void 0, this.phrases(opts));
4832
+ return _chunkYFA7X2F6cjs.structuralCadences.call(void 0, this.phrases(opts));
4824
4833
  }
4825
4834
  /**
4826
4835
  * The sections the score divides into.
@@ -4829,7 +4838,7 @@ var Score = class _Score {
4829
4838
  * @returns The sections, in time order.
4830
4839
  */
4831
4840
  sections(opts) {
4832
- return _chunkHPVSH7SFcjs.sectionsFromNotes.call(void 0, this.#data.notes, { meters: this.#data.meters, ...opts });
4841
+ return _chunkYFA7X2F6cjs.sectionsFromNotes.call(void 0, this.#data.notes, { meters: this.#data.meters, ...opts });
4833
4842
  }
4834
4843
  /**
4835
4844
  * The bar-level pulse above the meter.
@@ -4842,7 +4851,7 @@ var Score = class _Score {
4842
4851
  * @returns The grouping, its downbeats, a confidence, and a rationale.
4843
4852
  */
4844
4853
  hypermeter(opts) {
4845
- return _chunkHPVSH7SFcjs.hypermeter.call(void 0, this.#data.notes, this.#data.meters, {
4854
+ return _chunkYFA7X2F6cjs.hypermeter.call(void 0, this.#data.notes, this.#data.meters, {
4846
4855
  cadenceBeats: this.#cadenceBeats(),
4847
4856
  ...opts
4848
4857
  });
@@ -4884,7 +4893,7 @@ var Score = class _Score {
4884
4893
  * ```
4885
4894
  */
4886
4895
  motifs(opts) {
4887
- return _chunkHPVSH7SFcjs.extractMotifs.call(void 0, this.#data.notes, opts);
4896
+ return _chunkIFZDWIKMcjs.extractMotifs.call(void 0, this.#data.notes, opts);
4888
4897
  }
4889
4898
  /**
4890
4899
  * The shape the melody traces.
@@ -4896,7 +4905,144 @@ var Score = class _Score {
4896
4905
  * answered for; {@link Score.voices} is what reads the polyphony as polyphony.
4897
4906
  */
4898
4907
  contour() {
4899
- return _chunkHPVSH7SFcjs.melodicContour.call(void 0, this.#data.notes);
4908
+ return _chunkIFZDWIKMcjs.melodicContour.call(void 0, this.#data.notes);
4909
+ }
4910
+ /**
4911
+ * The score's structural fingerprint: form, phrase shape, harmonic function
4912
+ * and rhythm, and how its motifs derive from one another.
4913
+ *
4914
+ * The harmony is the score's own kept chord analysis, read once whether this
4915
+ * is asked before or after {@link Score.timeline} — unless `opts.timeline`
4916
+ * gives the harmony directly, in which case the reading runs fresh through
4917
+ * {@link analyzeReference} rather than the harmony this score already holds.
4918
+ * The meter, the key and the span are the score's own and are not on offer
4919
+ * here: a caller wanting another meter reads through {@link
4920
+ * Score.withMeters}, and one wanting another key or span calls {@link
4921
+ * analyzeReference} directly.
4922
+ *
4923
+ * Asked with no options, the answer is kept and a copy of it handed back, as
4924
+ * {@link Score.timeline} keeps its own reading; asked with options, the
4925
+ * answer is read afresh and not kept.
4926
+ *
4927
+ * @param opts The harmony, the melody, and the budget; see {@link
4928
+ * ReferenceProfileOptions}. Meter, key and span are the score's own.
4929
+ * @returns The profile.
4930
+ * @example
4931
+ * ```ts
4932
+ * import { Score } from '@libraz/libcantus';
4933
+ * const triad = (pitches: number[], startBeat: number) =>
4934
+ * pitches.map((pitch) => ({ pitch, startBeat, durationBeat: 4 }));
4935
+ * const score = Score.of(
4936
+ * [
4937
+ * ...triad([60, 64, 67], 0),
4938
+ * ...triad([65, 69, 72], 4),
4939
+ * ...triad([67, 71, 74], 8),
4940
+ * ...triad([60, 64, 67], 12),
4941
+ * ],
4942
+ * { key: 'C major' },
4943
+ * );
4944
+ * score.reference().harmony.chords.map((chord) => chord.roman); // ['I', 'IV', 'V', 'I']
4945
+ * ```
4946
+ */
4947
+ reference(opts) {
4948
+ if (opts === void 0 && this.#profile !== void 0) {
4949
+ return copyPlain(this.#profile, "reference profile");
4950
+ }
4951
+ const keyed = this.#key === void 0 ? {} : { key: keyIdentity(this.#key) };
4952
+ const asked = {
4953
+ meters: this.#data.meters,
4954
+ totalBeats: this.totalBeats,
4955
+ ...keyed,
4956
+ ...opts
4957
+ };
4958
+ const profile = _optionalChain([opts, 'optionalAccess', _37 => _37.timeline]) === void 0 ? _chunkYFA7X2F6cjs.referenceFromReadings.call(void 0, this.#data.notes, this.#chordAnalysis(), asked) : _chunkYFA7X2F6cjs.analyzeReference.call(void 0, this.#data.notes, asked);
4959
+ if (opts === void 0) {
4960
+ this.#profile = profile;
4961
+ return copyPlain(profile, "reference profile");
4962
+ }
4963
+ return profile;
4964
+ }
4965
+ /**
4966
+ * The onset placement of the score's melodic line.
4967
+ *
4968
+ * A melody is one line, so a score holding several is read as its top voice,
4969
+ * as {@link Score.motifs} and {@link Score.contour} are.
4970
+ *
4971
+ * @param opts The span's end and the budget; see {@link
4972
+ * RhythmAnalysisOptions}. The meter is the score's own.
4973
+ * @returns The rhythm reading.
4974
+ * @example
4975
+ * ```ts
4976
+ * import { Score } from '@libraz/libcantus';
4977
+ * const score = Score.of([
4978
+ * { pitch: 60, startBeat: 0, durationBeat: 1 },
4979
+ * { pitch: 62, startBeat: 1, durationBeat: 1 },
4980
+ * { pitch: 64, startBeat: 2, durationBeat: 1 },
4981
+ * { pitch: 65, startBeat: 3, durationBeat: 1 },
4982
+ * ]);
4983
+ * score.rhythm().onsetDensity; // 4
4984
+ * ```
4985
+ */
4986
+ rhythm(opts) {
4987
+ return _chunkIFZDWIKMcjs.analyzeRhythm.call(void 0, this.#data.notes, {
4988
+ meters: this.#data.meters,
4989
+ totalBeats: this.totalBeats,
4990
+ ...opts
4991
+ });
4992
+ }
4993
+ /**
4994
+ * How the score's motifs derive from one another: which statement grew out
4995
+ * of which, and by what transformation.
4996
+ *
4997
+ * {@link Score.motifs} finds the cells; this reads across their occurrences
4998
+ * and names, for every statement after the first, the earlier one it most
4999
+ * plausibly grew out of. A melody is one line, so a score holding several is
5000
+ * read as its top voice, as {@link Score.motifs} is.
5001
+ *
5002
+ * @param opts Cell-length bounds and the recurrence threshold {@link
5003
+ * Score.motifs} takes, plus the variation threshold and the budget; see
5004
+ * {@link MotifGraphOptions} and {@link ExtractMotifsOptions}.
5005
+ * @returns The derivation forest.
5006
+ * @example
5007
+ * ```ts
5008
+ * import { Score } from '@libraz/libcantus';
5009
+ * const score = Score.of([
5010
+ * { pitch: 60, startBeat: 0, durationBeat: 1 },
5011
+ * { pitch: 62, startBeat: 1, durationBeat: 1 },
5012
+ * { pitch: 64, startBeat: 2, durationBeat: 1 },
5013
+ * { pitch: 60, startBeat: 3, durationBeat: 1 },
5014
+ * { pitch: 62, startBeat: 4, durationBeat: 1 },
5015
+ * { pitch: 64, startBeat: 5, durationBeat: 1 },
5016
+ * ]);
5017
+ * score.motifGraph().edges.length; // 1
5018
+ * ```
5019
+ */
5020
+ motifGraph(opts) {
5021
+ return _chunkIFZDWIKMcjs.motifGraph.call(void 0, this.#data.notes, _chunkIFZDWIKMcjs.extractMotifs.call(void 0, this.#data.notes, opts), {
5022
+ key: this.key(),
5023
+ ...opts
5024
+ });
5025
+ }
5026
+ /**
5027
+ * How this score, read as a melody, keeps to a composition plan.
5028
+ *
5029
+ * @param plan The plan the melody was written for.
5030
+ * @param opts The budget; see {@link EvaluateCompositionOptions}.
5031
+ * @returns The violations found and the fit reading; see {@link
5032
+ * evaluateComposition}.
5033
+ * @example
5034
+ * ```ts
5035
+ * import { Composer, Score } from '@libraz/libcantus';
5036
+ * const notes = [60, 62, 64, 65, 67, 65, 64, 62, 60, 62, 64, 65, 67, 65, 64, 60].map(
5037
+ * (pitch, startBeat) => ({ pitch, startBeat, durationBeat: 1 }),
5038
+ * );
5039
+ * const composer = Composer.of({ key: 'C major', seed: 5 });
5040
+ * const plan = composer.plan(Score.of(notes, { key: 'C major' }).reference());
5041
+ * composer.melody(plan).evaluate(plan).violations.some((v) => v.severity === 'error'); // false
5042
+ * ```
5043
+ */
5044
+ evaluate(plan, opts) {
5045
+ return _chunkB2PW6EHNcjs.evaluateComposition.call(void 0, this.#data.notes, plan, opts);
4900
5046
  }
4901
5047
  /**
4902
5048
  * Each note's role in the harmony sounding under it.
@@ -4920,7 +5066,7 @@ var Score = class _Score {
4920
5066
  */
4921
5067
  voices(key) {
4922
5068
  const timeline = this.#chordTimeline();
4923
- return _chunkHPVSH7SFcjs.analyzePolyphony.call(void 0, this.#data.notes, timeline.at, this.#keyContext(key));
5069
+ return _chunkYFA7X2F6cjs.analyzePolyphony.call(void 0, this.#data.notes, timeline.at, this.#keyContext(key));
4924
5070
  }
4925
5071
  /**
4926
5072
  * The notes carrying the ids the voice analysis reports them back under.
@@ -4934,7 +5080,7 @@ var Score = class _Score {
4934
5080
  * @returns One voice note per note, in the score's own time order.
4935
5081
  */
4936
5082
  voiceNotes() {
4937
- return _chunkSGLEQVJHcjs.toVoiceNotes.call(void 0, this.#data.notes);
5083
+ return _chunkIFZDWIKMcjs.toVoiceNotes.call(void 0, this.#data.notes);
4938
5084
  }
4939
5085
  /**
4940
5086
  * Whether an instrument can play the score, and what makes it hard.
@@ -5114,7 +5260,7 @@ var Score = class _Score {
5114
5260
  * Score.timeline} hands all three to the class it builds.
5115
5261
  */
5116
5262
  #chordAnalysis() {
5117
- const analysis = _nullishCoalesce(this.#chords, () => ( _chunkSGLEQVJHcjs.chordTimelineFromNotes.call(void 0, this.#data.notes, this.#analysisOptions())));
5263
+ const analysis = _nullishCoalesce(this.#chords, () => ( _chunkIFZDWIKMcjs.chordTimelineFromNotes.call(void 0, this.#data.notes, this.#analysisOptions())));
5118
5264
  this.#chords = analysis;
5119
5265
  return analysis;
5120
5266
  }
@@ -5125,13 +5271,13 @@ var Score = class _Score {
5125
5271
  * Kept on first reading for the same reason the chord timeline is.
5126
5272
  */
5127
5273
  #keyRegions() {
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))));
5274
+ const regions = _nullishCoalesce(this.#regions, () => ( (this.#key === void 0 ? _chunkIFZDWIKMcjs.keyTimelineFromNotes.call(void 0, this.#data.notes, { meters: this.#data.meters }) : statedKeyRegions(this.#key, this.#data.notes, this.totalBeats))));
5129
5275
  this.#regions = regions;
5130
5276
  return regions;
5131
5277
  }
5132
5278
  /** Where the score's own harmony closes, as beats. */
5133
5279
  #cadenceBeats() {
5134
- return _chunkSGLEQVJHcjs.detectCadences.call(void 0, this.#chordTimeline(), this.#keyContext(void 0)).map(
5280
+ return _chunkIFZDWIKMcjs.detectCadences.call(void 0, this.#chordTimeline(), this.#keyContext(void 0)).map(
5135
5281
  (hit) => hit.atBeat
5136
5282
  );
5137
5283
  }
@@ -5156,8 +5302,8 @@ var Score = class _Score {
5156
5302
  return keyIdentity(this.#key);
5157
5303
  }
5158
5304
  const regions = this.#keyRegions();
5159
- const prevailing = _nullishCoalesce(_chunkSGLEQVJHcjs.prevailingKeyOf.call(void 0, regions), () => ( keyIdentity(Key.major("C"))));
5160
- const keyAt = _chunkSGLEQVJHcjs.keyLookup.call(void 0, regions, prevailing);
5305
+ const prevailing = _nullishCoalesce(_chunkIFZDWIKMcjs.prevailingKeyOf.call(void 0, regions), () => ( keyIdentity(Key.major("C"))));
5306
+ const keyAt = _chunkIFZDWIKMcjs.keyLookup.call(void 0, regions, prevailing);
5161
5307
  return (beat) => _chunk3R3QVKY5cjs.scaleOf.call(void 0, keyAt(beat));
5162
5308
  }
5163
5309
  };
@@ -5194,7 +5340,7 @@ function copyTrack(track, index, budget) {
5194
5340
  copy.name = track.name;
5195
5341
  }
5196
5342
  if (track.role !== void 0) {
5197
- copy.role = _chunkHPVSH7SFcjs.trackRoleOf.call(void 0, track.role, `tracks[${index}].role`);
5343
+ copy.role = _chunkYFA7X2F6cjs.trackRoleOf.call(void 0, track.role, `tracks[${index}].role`);
5198
5344
  }
5199
5345
  return copy;
5200
5346
  }
@@ -5273,7 +5419,7 @@ function copySettings(settings, trackCount) {
5273
5419
  }
5274
5420
  function copyArrangement(data) {
5275
5421
  assertDataObject(data, "arrangement data");
5276
- const budget = _optionalChain([data, 'access', _37 => _37.settings, 'optionalAccess', _38 => _38.budget]);
5422
+ const budget = _optionalChain([data, 'access', _38 => _38.settings, 'optionalAccess', _39 => _39.budget]);
5277
5423
  const tracks = assertDataArray(data.tracks, "arrangement tracks").map(
5278
5424
  (track, index) => copyTrack(track, index, budget)
5279
5425
  );
@@ -5463,7 +5609,7 @@ var Arrangement = class _Arrangement {
5463
5609
  }
5464
5610
  copied.push({
5465
5611
  trackIndex: edit.trackIndex,
5466
- notes: copyNotes(edit.notes, `edits[${index}].notes`, _optionalChain([this, 'access', _39 => _39.#data, 'access', _40 => _40.settings, 'optionalAccess', _41 => _41.budget]))
5612
+ notes: copyNotes(edit.notes, `edits[${index}].notes`, _optionalChain([this, 'access', _40 => _40.#data, 'access', _41 => _41.settings, 'optionalAccess', _42 => _42.budget]))
5467
5613
  });
5468
5614
  }
5469
5615
  const session = this.#session().update(copied);
@@ -5488,7 +5634,7 @@ var Arrangement = class _Arrangement {
5488
5634
  * @returns One tension reading per sampled beat, in beat order.
5489
5635
  */
5490
5636
  tension(opts) {
5491
- return _chunkHPVSH7SFcjs.tensionCurveFrom.call(void 0,
5637
+ return _chunkYFA7X2F6cjs.tensionCurveFrom.call(void 0,
5492
5638
  [...this.#data.tracks],
5493
5639
  this.#session().analysis,
5494
5640
  this.#layered(analysisOptionsOf(opts))
@@ -5514,7 +5660,7 @@ var Arrangement = class _Arrangement {
5514
5660
  * tracks exceed the budget.
5515
5661
  */
5516
5662
  analyze(opts) {
5517
- return _chunkHPVSH7SFcjs.analyzeArrangement.call(void 0, [...this.#data.tracks], this.#layered(analysisOptionsOf(opts)));
5663
+ return _chunkYFA7X2F6cjs.analyzeArrangement.call(void 0, [...this.#data.tracks], this.#layered(analysisOptionsOf(opts)));
5518
5664
  }
5519
5665
  /**
5520
5666
  * The harmony the tracks spell out together, in time.
@@ -5532,6 +5678,70 @@ var Arrangement = class _Arrangement {
5532
5678
  keys: [...keys]
5533
5679
  });
5534
5680
  }
5681
+ /**
5682
+ * The arrangement's structural fingerprint: form, phrase shape, harmonic
5683
+ * function and rhythm, and how its melody's motifs derive from one another.
5684
+ *
5685
+ * The harmony reads the arrangement's own session analysis directly — the
5686
+ * tracks `settings.harmonyTracks` names, or else every track but the
5687
+ * percussion ones — so the harmony is never inferred a second time. The
5688
+ * melody is the notes of the tracks played with `role: 'melody'`, joined in
5689
+ * the order the tracks were given; an arrangement naming none reads the top
5690
+ * line of the harmony notes instead, as {@link analyzeReference} does
5691
+ * without a `melody` option. Meter, key, harmony and melody are the
5692
+ * arrangement's own and are not on offer here: a caller wanting others calls
5693
+ * {@link analyzeReference} directly, with the same notes {@link
5694
+ * Arrangement.tracks} hands out.
5695
+ *
5696
+ * @param opts The budget; see {@link ReferenceProfileOptions}.
5697
+ * @returns The profile.
5698
+ * @example
5699
+ * ```ts
5700
+ * import { Arrangement } from '@libraz/libcantus';
5701
+ * const triad = (pitches: number[], startBeat: number) =>
5702
+ * pitches.map((pitch) => ({ pitch, startBeat, durationBeat: 4 }));
5703
+ * const arrangement = Arrangement.of(
5704
+ * [
5705
+ * {
5706
+ * name: 'lead',
5707
+ * role: 'melody',
5708
+ * notes: [
5709
+ * ...triad([60, 64, 67], 0),
5710
+ * ...triad([65, 69, 72], 4),
5711
+ * ...triad([67, 71, 74], 8),
5712
+ * ...triad([60, 64, 67], 12),
5713
+ * ],
5714
+ * },
5715
+ * ],
5716
+ * { key: 'C major' },
5717
+ * );
5718
+ * arrangement.reference().harmony.chords.map((chord) => chord.roman); // ['I', 'IV', 'V', 'I']
5719
+ * ```
5720
+ */
5721
+ reference(opts) {
5722
+ const tracks = this.#data.tracks;
5723
+ const harmonyTracks = _optionalChain([this, 'access', _43 => _43.#data, 'access', _44 => _44.settings, 'optionalAccess', _45 => _45.harmonyTracks]);
5724
+ const harmony = [];
5725
+ const melody = [];
5726
+ for (let index = 0; index < tracks.length; index += 1) {
5727
+ const track = tracks[index];
5728
+ if (track === void 0) {
5729
+ continue;
5730
+ }
5731
+ if (track.role !== "drums" && (harmonyTracks === void 0 || harmonyTracks.includes(index))) {
5732
+ harmony.push(...track.notes);
5733
+ }
5734
+ if (track.role === "melody") {
5735
+ melody.push(...track.notes);
5736
+ }
5737
+ }
5738
+ return _chunkYFA7X2F6cjs.referenceFromReadings.call(void 0, harmony, this.#session().analysis, {
5739
+ meters: _optionalChain([this, 'access', _46 => _46.#data, 'access', _47 => _47.settings, 'optionalAccess', _48 => _48.meters]),
5740
+ totalBeats: this.timeline().totalBeats,
5741
+ ...melody.length === 0 ? {} : { melody },
5742
+ ...opts
5743
+ });
5744
+ }
5535
5745
  /**
5536
5746
  * Whether another arrangement holds the same tracks under the same settings.
5537
5747
  *
@@ -5556,7 +5766,7 @@ var Arrangement = class _Arrangement {
5556
5766
  }
5557
5767
  /** The open reading, analysing the tracks on the first call. */
5558
5768
  #session() {
5559
- const open = _nullishCoalesce(this.#open, () => ( _chunkHPVSH7SFcjs.createArrangementSession.call(void 0, [...this.#data.tracks], this.#analysisOptions())));
5769
+ const open = _nullishCoalesce(this.#open, () => ( _chunkYFA7X2F6cjs.createArrangementSession.call(void 0, [...this.#data.tracks], this.#analysisOptions())));
5560
5770
  this.#open = open;
5561
5771
  return open;
5562
5772
  }
@@ -5596,12 +5806,12 @@ var Arrangement = class _Arrangement {
5596
5806
  #scoreOptions() {
5597
5807
  const settings = this.#data.settings;
5598
5808
  const opts = {};
5599
- if (_optionalChain([settings, 'optionalAccess', _42 => _42.meters]) !== void 0) {
5809
+ if (_optionalChain([settings, 'optionalAccess', _49 => _49.meters]) !== void 0) {
5600
5810
  opts.meters = settings.meters;
5601
- } else if (_optionalChain([settings, 'optionalAccess', _43 => _43.ts]) !== void 0) {
5811
+ } else if (_optionalChain([settings, 'optionalAccess', _50 => _50.ts]) !== void 0) {
5602
5812
  opts.meters = settings.ts;
5603
5813
  }
5604
- if (_optionalChain([settings, 'optionalAccess', _44 => _44.key]) !== void 0) {
5814
+ if (_optionalChain([settings, 'optionalAccess', _51 => _51.key]) !== void 0) {
5605
5815
  opts.key = settings.key;
5606
5816
  }
5607
5817
  return opts;
@@ -5982,7 +6192,7 @@ function copyOptions(options) {
5982
6192
  if (options.rng !== void 0) {
5983
6193
  copy.rng = options.rng;
5984
6194
  }
5985
- const resolved = _chunkJ7FHVZIIcjs.resolveContext.call(void 0, contextOf(copy));
6195
+ const resolved = _chunkB2PW6EHNcjs.resolveContext.call(void 0, contextOf(copy));
5986
6196
  copy.seed = resolved.seed;
5987
6197
  copy.algorithmVersion = resolved.algorithmVersion;
5988
6198
  return copy;
@@ -6097,7 +6307,7 @@ var Composer = class _Composer {
6097
6307
  progression(opts) {
6098
6308
  const key = this.#requireKey("progression");
6099
6309
  const ts = this.#unchangingMeter("progression");
6100
- const chords = _chunkJ7FHVZIIcjs.generateProgression.call(void 0, { ...opts, key, ts, ctx: this.context });
6310
+ const chords = _chunkB2PW6EHNcjs.generateProgression.call(void 0, { ...opts, key, ts, ctx: this.context });
6101
6311
  return Timeline.fromChords(chords, opts.bars * _chunkS5BKZZGMcjs.beatsPerBar.call(void 0, ts), key);
6102
6312
  }
6103
6313
  /**
@@ -6117,7 +6327,7 @@ var Composer = class _Composer {
6117
6327
  * request is refused rather than answered with 4/4 bars over the change.
6118
6328
  */
6119
6329
  drums(opts) {
6120
- const hits = _chunkJ7FHVZIIcjs.generateDrums.call(void 0, { ...opts, ts: this.#unchangingMeter("drums"), ctx: this.context });
6330
+ const hits = _chunkB2PW6EHNcjs.generateDrums.call(void 0, { ...opts, ts: this.#unchangingMeter("drums"), ctx: this.context });
6121
6331
  return Score.of(hits, this.#scoreOptions());
6122
6332
  }
6123
6333
  /**
@@ -6144,7 +6354,7 @@ var Composer = class _Composer {
6144
6354
  const segments = Array.isArray(source) ? source : source.segments;
6145
6355
  const key = this.#requireKey("bass");
6146
6356
  const { instrument, ...rest } = _nullishCoalesce(opts, () => ( {}));
6147
- const notes = _chunkJ7FHVZIIcjs.generateBassLine.call(void 0, {
6357
+ const notes = _chunkB2PW6EHNcjs.generateBassLine.call(void 0, {
6148
6358
  ...rest,
6149
6359
  ...instrument === void 0 ? {} : { instrument: _chunkCGBADIO5cjs.toStringedProfile.call(void 0, instrument, "bass instrument") },
6150
6360
  segments,
@@ -6176,7 +6386,7 @@ var Composer = class _Composer {
6176
6386
  counterMelody(melody, opts) {
6177
6387
  const key = this.#requireKey("counterMelody");
6178
6388
  const { timeline, ...rest } = _nullishCoalesce(opts, () => ( {}));
6179
- const notes = _chunkJ7FHVZIIcjs.generateCounterMelody.call(void 0, {
6389
+ const notes = _chunkB2PW6EHNcjs.generateCounterMelody.call(void 0, {
6180
6390
  ...rest,
6181
6391
  ...timeline === void 0 ? {} : { timeline: toChordTimeline(timeline) },
6182
6392
  melody: melody.notes,
@@ -6207,7 +6417,7 @@ var Composer = class _Composer {
6207
6417
  * ```
6208
6418
  */
6209
6419
  harmonize(melody, opts) {
6210
- const result = _chunkJ7FHVZIIcjs.harmonizeMelody.call(void 0, {
6420
+ const result = _chunkB2PW6EHNcjs.harmonizeMelody.call(void 0, {
6211
6421
  ...opts,
6212
6422
  melody: melody.notes,
6213
6423
  ...this.#key === void 0 ? {} : { key: this.#key },
@@ -6228,6 +6438,73 @@ var Composer = class _Composer {
6228
6438
  transposeSemitones: result.transposeSemitones
6229
6439
  };
6230
6440
  }
6441
+ /**
6442
+ * A composition plan derived from a reference profile.
6443
+ *
6444
+ * The composer's key is the plan's home key unless `opts.key` names another,
6445
+ * and its seed and algorithm version are the ones the plan records, so the
6446
+ * plan is written under the same recipe as the composer's other parts.
6447
+ *
6448
+ * @param reference The reference profile to derive from.
6449
+ * @param opts Everything {@link deriveCompositionPlan} takes but the context,
6450
+ * which is the composer's.
6451
+ * @returns The plan.
6452
+ * @throws If the composer draws from a caller-held `rng`: a plan records its
6453
+ * seed, and a source cannot be written into it.
6454
+ * @example
6455
+ * ```ts
6456
+ * import { Composer, Score } from '@libraz/libcantus';
6457
+ * const notes = [60, 62, 64, 65, 67, 65, 64, 62, 60, 62, 64, 65, 67, 65, 64, 60].map(
6458
+ * (pitch, startBeat) => ({ pitch, startBeat, durationBeat: 1 }),
6459
+ * );
6460
+ * const reference = Score.of(notes, { key: 'C major' }).reference();
6461
+ * const plan = Composer.of({ key: 'D major', seed: 5 }).plan(reference);
6462
+ * plan.seed; // 5
6463
+ * plan.keys[0].scale.rootPc; // 2
6464
+ * ```
6465
+ */
6466
+ plan(reference, opts) {
6467
+ const ctx = this.context;
6468
+ if (ctx.rng !== void 0) {
6469
+ throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)(
6470
+ "composer plan cannot record a caller-held rng; give the composer a seed instead"
6471
+ );
6472
+ }
6473
+ return _chunkB2PW6EHNcjs.deriveCompositionPlan.call(void 0, reference, {
6474
+ ...this.#key === void 0 ? {} : { key: this.#key },
6475
+ ...opts,
6476
+ ctx
6477
+ });
6478
+ }
6479
+ /**
6480
+ * A melody written to a composition plan.
6481
+ *
6482
+ * The plan is the reproduction recipe, so its seed and algorithm version are
6483
+ * the ones the melody is drawn under, not the composer's. The score is read
6484
+ * in the plan's meter and home key, at the composer's tempo.
6485
+ *
6486
+ * @param plan The plan to follow.
6487
+ * @param opts The budget; see {@link MelodyOptions}.
6488
+ * @returns The melody, as a score.
6489
+ * @example
6490
+ * ```ts
6491
+ * import { Composer, Score } from '@libraz/libcantus';
6492
+ * const notes = [60, 62, 64, 65, 67, 65, 64, 62, 60, 62, 64, 65, 67, 65, 64, 60].map(
6493
+ * (pitch, startBeat) => ({ pitch, startBeat, durationBeat: 1 }),
6494
+ * );
6495
+ * const composer = Composer.of({ key: 'C major', seed: 5 });
6496
+ * const plan = composer.plan(Score.of(notes, { key: 'C major' }).reference());
6497
+ * composer.melody(plan).notes.length > 0; // true
6498
+ * ```
6499
+ */
6500
+ melody(plan, opts) {
6501
+ const notes = _chunkB2PW6EHNcjs.generateMelody.call(void 0, plan, opts);
6502
+ const score = { meters: plan.meters, key: plan.keys[0] };
6503
+ if (this.#options.bpm !== void 0) {
6504
+ score.tempo = this.#options.bpm;
6505
+ }
6506
+ return Score.of(notes, score);
6507
+ }
6231
6508
  /**
6232
6509
  * Whether another composer holds the same settings.
6233
6510
  *
@@ -6480,7 +6757,7 @@ var Duration = class _Duration {
6480
6757
  */
6481
6758
  equals(other) {
6482
6759
  const b = other.data;
6483
- return this.#base === b.base && this.#dots === b.dots && _optionalChain([this, 'access', _45 => _45.#tuplet, 'optionalAccess', _46 => _46.actual]) === _optionalChain([b, 'access', _47 => _47.tuplet, 'optionalAccess', _48 => _48.actual]) && _optionalChain([this, 'access', _49 => _49.#tuplet, 'optionalAccess', _50 => _50.normal]) === _optionalChain([b, 'access', _51 => _51.tuplet, 'optionalAccess', _52 => _52.normal]);
6760
+ return this.#base === b.base && this.#dots === b.dots && _optionalChain([this, 'access', _52 => _52.#tuplet, 'optionalAccess', _53 => _53.actual]) === _optionalChain([b, 'access', _54 => _54.tuplet, 'optionalAccess', _55 => _55.actual]) && _optionalChain([this, 'access', _56 => _56.#tuplet, 'optionalAccess', _57 => _57.normal]) === _optionalChain([b, 'access', _58 => _58.tuplet, 'optionalAccess', _59 => _59.normal]);
6484
6761
  }
6485
6762
  /**
6486
6763
  * The plain duration, for JSON serialization.
@@ -6736,7 +7013,7 @@ var Meter = class _Meter {
6736
7013
  if (grouping === void 0 || b.grouping === void 0) {
6737
7014
  return this.#ts.numerator === b.numerator && this.#ts.denominator === b.denominator && grouping === b.grouping;
6738
7015
  }
6739
- return this.#ts.numerator === b.numerator && this.#ts.denominator === b.denominator && grouping.length === b.grouping.length && grouping.every((entry, index) => entry === _optionalChain([b, 'access', _53 => _53.grouping, 'optionalAccess', _54 => _54[index]]));
7016
+ return this.#ts.numerator === b.numerator && this.#ts.denominator === b.denominator && grouping.length === b.grouping.length && grouping.every((entry, index) => entry === _optionalChain([b, 'access', _60 => _60.grouping, 'optionalAccess', _61 => _61[index]]));
6740
7017
  }
6741
7018
  /**
6742
7019
  * The plain time signature, for JSON serialization.
@@ -6807,7 +7084,7 @@ var Motif = class _Motif {
6807
7084
  * ```
6808
7085
  */
6809
7086
  static generate(opts) {
6810
- return new _Motif(_chunkJ7FHVZIIcjs.generateMotif.call(void 0, { ...opts, chord: chordFrom(opts.chord) }));
7087
+ return new _Motif(_chunkB2PW6EHNcjs.generateMotif.call(void 0, { ...opts, chord: chordFrom(opts.chord) }));
6811
7088
  }
6812
7089
  /**
6813
7090
  * Read a run of notes as a motif.
@@ -6837,7 +7114,7 @@ var Motif = class _Motif {
6837
7114
  }
6838
7115
  /** Where the cell stops sounding, measured from its own first onset. */
6839
7116
  get totalBeats() {
6840
- return _chunkJ7FHVZIIcjs.cellSpan.call(void 0, this.#cell);
7117
+ return _chunkB2PW6EHNcjs.cellSpan.call(void 0, this.#cell);
6841
7118
  }
6842
7119
  /** A copy of the underlying plain cell. */
6843
7120
  get data() {
@@ -6874,7 +7151,7 @@ var Motif = class _Motif {
6874
7151
  * ```
6875
7152
  */
6876
7153
  transform(kind, amount, key) {
6877
- return new _Motif(_chunkJ7FHVZIIcjs.transformMotif.call(void 0, this.#cell, kind, amount, key));
7154
+ return new _Motif(_chunkB2PW6EHNcjs.transformMotif.call(void 0, this.#cell, kind, amount, key));
6878
7155
  }
6879
7156
  /**
6880
7157
  * The cell laid across a span and snapped to the harmony under it.
@@ -6896,7 +7173,7 @@ var Motif = class _Motif {
6896
7173
  */
6897
7174
  develop(timeline, key, bars, ts) {
6898
7175
  const chords = "chordTimeline" in timeline ? timeline.chordTimeline : timeline;
6899
- return new _Motif(_chunkJ7FHVZIIcjs.developMotif.call(void 0, this.#cell, chords, key, bars, ts));
7176
+ return new _Motif(_chunkB2PW6EHNcjs.developMotif.call(void 0, this.#cell, chords, key, bars, ts));
6900
7177
  }
6901
7178
  /**
6902
7179
  * How this motif stands to another: the transformation that turns one into
@@ -6910,7 +7187,7 @@ var Motif = class _Motif {
6910
7187
  * @returns The relation, or null when the two stand in none.
6911
7188
  */
6912
7189
  relateTo(other, key) {
6913
- return _chunkHPVSH7SFcjs.relateMotifs.call(void 0, _chunkHPVSH7SFcjs.motifFromNotes.call(void 0, this.#cell.notes), _chunkHPVSH7SFcjs.motifFromNotes.call(void 0, other.notes), key);
7190
+ return _chunkIFZDWIKMcjs.relateMotifs.call(void 0, _chunkIFZDWIKMcjs.motifFromNotes.call(void 0, this.#cell.notes), _chunkIFZDWIKMcjs.motifFromNotes.call(void 0, other.notes), key);
6914
7191
  }
6915
7192
  /**
6916
7193
  * How alike two lines are, in [0, 1].
@@ -6923,7 +7200,7 @@ var Motif = class _Motif {
6923
7200
  * @returns The likeness: 1 for the same line, a transposition of it included.
6924
7201
  */
6925
7202
  similarityTo(other) {
6926
- return _chunkHPVSH7SFcjs.melodicSimilarity.call(void 0, this.#cell.notes, other.notes);
7203
+ return _chunkIFZDWIKMcjs.melodicSimilarity.call(void 0, this.#cell.notes, other.notes);
6927
7204
  }
6928
7205
  /**
6929
7206
  * The cell as a score, so it reaches the rest of the class API.
@@ -6933,7 +7210,7 @@ var Motif = class _Motif {
6933
7210
  * @returns The score holding the cell.
6934
7211
  */
6935
7212
  toScore(opts) {
6936
- return Score.of(_chunkJ7FHVZIIcjs.motifToNoteEvents.call(void 0, this.#cell), opts);
7213
+ return Score.of(_chunkB2PW6EHNcjs.motifToNoteEvents.call(void 0, this.#cell), opts);
6937
7214
  }
6938
7215
  /**
6939
7216
  * Whether another motif holds the same notes in the same order.
@@ -6988,13 +7265,13 @@ function spanOf(events) {
6988
7265
  }
6989
7266
  function toGrid(events) {
6990
7267
  return events.map((event) => ({
6991
- step: event.position / _chunkJ7FHVZIIcjs.STEP_BEATS,
7268
+ step: event.position / _chunkB2PW6EHNcjs.STEP_BEATS,
6992
7269
  velocity: GRID_VELOCITY,
6993
7270
  source: event
6994
7271
  }));
6995
7272
  }
6996
7273
  function fromGrid(events, spanBeats) {
6997
- const positions = [...new Set(events.map((event) => event.step * _chunkJ7FHVZIIcjs.STEP_BEATS))].sort(
7274
+ const positions = [...new Set(events.map((event) => event.step * _chunkB2PW6EHNcjs.STEP_BEATS))].sort(
6998
7275
  (a, b) => a - b
6999
7276
  );
7000
7277
  return positions.map((position, index) => ({
@@ -7035,7 +7312,7 @@ var Rhythm = class _Rhythm {
7035
7312
  */
7036
7313
  static generate(ts, opts) {
7037
7314
  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 });
7315
+ return new _Rhythm({ events: _chunkB2PW6EHNcjs.generateRhythm.call(void 0, meter, opts), ts: meter });
7039
7316
  }
7040
7317
  /**
7041
7318
  * Build a pattern from onsets that already exist.
@@ -7091,7 +7368,7 @@ var Rhythm = class _Rhythm {
7091
7368
  * @returns The onset count divided by the number of bars it spans.
7092
7369
  */
7093
7370
  density() {
7094
- return _chunkJ7FHVZIIcjs.rhythmDensity.call(void 0, this.#data.events, this.#data.ts);
7371
+ return _chunkB2PW6EHNcjs.rhythmDensity.call(void 0, this.#data.events, this.#data.ts);
7095
7372
  }
7096
7373
  /**
7097
7374
  * Drop the onsets carrying the least of the metre.
@@ -7106,7 +7383,7 @@ var Rhythm = class _Rhythm {
7106
7383
  * @throws If the amount is outside [0, 1].
7107
7384
  */
7108
7385
  thin(amount) {
7109
- return this.#withGrid(_chunkJ7FHVZIIcjs.thin.call(void 0, toGrid(this.#data.events), amount, this.#data.ts));
7386
+ return this.#withGrid(_chunkB2PW6EHNcjs.thin.call(void 0, toGrid(this.#data.events), amount, this.#data.ts));
7110
7387
  }
7111
7388
  /**
7112
7389
  * Anticipate beats, one sixteenth early.
@@ -7125,10 +7402,10 @@ var Rhythm = class _Rhythm {
7125
7402
  */
7126
7403
  syncopate(amount, ctx) {
7127
7404
  return this.#withGrid(
7128
- _chunkJ7FHVZIIcjs.syncopate.call(void 0,
7405
+ _chunkB2PW6EHNcjs.syncopate.call(void 0,
7129
7406
  toGrid(this.#data.events),
7130
7407
  { amount, ts: this.#data.ts },
7131
- _chunkJ7FHVZIIcjs.resolveContext.call(void 0, ctx).part(PART)
7408
+ _chunkB2PW6EHNcjs.resolveContext.call(void 0, ctx).part(PART)
7132
7409
  )
7133
7410
  );
7134
7411
  }
@@ -7140,7 +7417,7 @@ var Rhythm = class _Rhythm {
7140
7417
  * @returns The compressed pattern.
7141
7418
  */
7142
7419
  doubleTime() {
7143
- return this.#withGrid(_chunkJ7FHVZIIcjs.doubleTime.call(void 0, toGrid(this.#data.events), this.#spanSteps()));
7420
+ return this.#withGrid(_chunkB2PW6EHNcjs.doubleTime.call(void 0, toGrid(this.#data.events), this.#spanSteps()));
7144
7421
  }
7145
7422
  /**
7146
7423
  * Stretch the pattern to twice its length: everything falls half as often.
@@ -7151,7 +7428,7 @@ var Rhythm = class _Rhythm {
7151
7428
  * @returns The stretched pattern.
7152
7429
  */
7153
7430
  halfTime() {
7154
- return this.#withGrid(_chunkJ7FHVZIIcjs.halfTime.call(void 0, toGrid(this.#data.events), this.#spanSteps()));
7431
+ return this.#withGrid(_chunkB2PW6EHNcjs.halfTime.call(void 0, toGrid(this.#data.events), this.#spanSteps()));
7155
7432
  }
7156
7433
  /**
7157
7434
  * Keep as much decoration as the ornament dial asks for.
@@ -7168,11 +7445,11 @@ var Rhythm = class _Rhythm {
7168
7445
  */
7169
7446
  ornamentBy(isOrnament, amount, ctx) {
7170
7447
  return this.#withGrid(
7171
- _chunkJ7FHVZIIcjs.ornamentBy.call(void 0,
7448
+ _chunkB2PW6EHNcjs.ornamentBy.call(void 0,
7172
7449
  toGrid(this.#data.events),
7173
7450
  (grid) => isOrnament(grid.source),
7174
7451
  amount,
7175
- _chunkJ7FHVZIIcjs.resolveContext.call(void 0, ctx).part(PART)
7452
+ _chunkB2PW6EHNcjs.resolveContext.call(void 0, ctx).part(PART)
7176
7453
  )
7177
7454
  );
7178
7455
  }
@@ -7192,12 +7469,12 @@ var Rhythm = class _Rhythm {
7192
7469
  * @throws If a dial is outside [0, 1].
7193
7470
  */
7194
7471
  deform(opts, ctx) {
7195
- const resolved = _chunkJ7FHVZIIcjs.resolveContext.call(void 0, ctx);
7196
- const isOrnament = _optionalChain([opts, 'optionalAccess', _55 => _55.isOrnament]);
7472
+ const resolved = _chunkB2PW6EHNcjs.resolveContext.call(void 0, ctx);
7473
+ const isOrnament = _optionalChain([opts, 'optionalAccess', _62 => _62.isOrnament]);
7197
7474
  const options = {
7198
7475
  rhythmic: resolved.rhythmic,
7199
7476
  ornament: resolved.ornament,
7200
- rate: _optionalChain([opts, 'optionalAccess', _56 => _56.rate]),
7477
+ rate: _optionalChain([opts, 'optionalAccess', _63 => _63.rate]),
7201
7478
  spanSteps: this.#spanSteps(),
7202
7479
  ts: this.#data.ts,
7203
7480
  // The transform hands the predicate the events it was given, which carry
@@ -7205,7 +7482,7 @@ var Rhythm = class _Rhythm {
7205
7482
  // grid event the rule reads, so the field is named back here.
7206
7483
  isOrnament: isOrnament === void 0 ? void 0 : (grid) => isOrnament(grid.source)
7207
7484
  };
7208
- return this.#withGrid(_chunkJ7FHVZIIcjs.deform.call(void 0, toGrid(this.#data.events), options, resolved.part(PART)));
7485
+ return this.#withGrid(_chunkB2PW6EHNcjs.deform.call(void 0, toGrid(this.#data.events), options, resolved.part(PART)));
7209
7486
  }
7210
7487
  /**
7211
7488
  * Whether one player can sustain the pattern at the context's tempo.
@@ -7219,8 +7496,8 @@ var Rhythm = class _Rhythm {
7219
7496
  * @returns True when the pattern is inside the ceiling.
7220
7497
  */
7221
7498
  withinCeiling(ctx) {
7222
- const resolved = _chunkJ7FHVZIIcjs.resolveContext.call(void 0, ctx);
7223
- return _chunkJ7FHVZIIcjs.withinCeiling.call(void 0, toGrid(this.#data.events), resolved.bpm, resolved.difficulty);
7499
+ const resolved = _chunkB2PW6EHNcjs.resolveContext.call(void 0, ctx);
7500
+ return _chunkB2PW6EHNcjs.withinCeiling.call(void 0, toGrid(this.#data.events), resolved.bpm, resolved.difficulty);
7224
7501
  }
7225
7502
  /**
7226
7503
  * The pattern as sounding notes at one pitch, in its own meter.
@@ -7244,7 +7521,7 @@ var Rhythm = class _Rhythm {
7244
7521
  * ```
7245
7522
  */
7246
7523
  toScore(pitch, velocity) {
7247
- return Score.of(_chunkJ7FHVZIIcjs.rhythmToNoteEvents.call(void 0, this.#data.events, pitch, velocity), {
7524
+ return Score.of(_chunkB2PW6EHNcjs.rhythmToNoteEvents.call(void 0, this.#data.events, pitch, velocity), {
7248
7525
  meters: this.#data.ts
7249
7526
  });
7250
7527
  }
@@ -7268,7 +7545,7 @@ var Rhythm = class _Rhythm {
7268
7545
  }
7269
7546
  /** The pattern's span as a count of sixteenths, for the transforms. */
7270
7547
  #spanSteps() {
7271
- return spanOf(this.#data.events) / _chunkJ7FHVZIIcjs.STEP_BEATS;
7548
+ return spanOf(this.#data.events) / _chunkB2PW6EHNcjs.STEP_BEATS;
7272
7549
  }
7273
7550
  /** The same meter carrying the onsets a transform returned. */
7274
7551
  #withGrid(events) {
@@ -7811,7 +8088,7 @@ function carriedKeyOf(chord) {
7811
8088
  return typeof key === "object" && key !== null ? key : void 0;
7812
8089
  }
7813
8090
  function withCarriedKey(chord, opts) {
7814
- if (_optionalChain([opts, 'optionalAccess', _57 => _57.key]) !== void 0) {
8091
+ if (_optionalChain([opts, 'optionalAccess', _64 => _64.key]) !== void 0) {
7815
8092
  return opts;
7816
8093
  }
7817
8094
  const key = carriedKeyOf(chord);
@@ -8213,9 +8490,9 @@ var Voicing = class _Voicing {
8213
8490
  }
8214
8491
  /** The safety context these voices supply, minus the candidate pitch. */
8215
8492
  #context(query) {
8216
- const previous = _optionalChain([query, 'access', _58 => _58.previous, 'optionalAccess', _59 => _59.pitches]);
8493
+ const previous = _optionalChain([query, 'access', _65 => _65.previous, 'optionalAccess', _66 => _66.pitches]);
8217
8494
  const otherVoices = this.#pitches.map((pitch, index) => {
8218
- const prevPitch = _optionalChain([previous, 'optionalAccess', _60 => _60[index]]);
8495
+ const prevPitch = _optionalChain([previous, 'optionalAccess', _67 => _67[index]]);
8219
8496
  return prevPitch === void 0 ? { pitch } : { pitch, prevPitch };
8220
8497
  });
8221
8498
  return {
@@ -8250,4 +8527,4 @@ var Voicing = class _Voicing {
8250
8527
 
8251
8528
 
8252
8529
  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;
8253
- //# sourceMappingURL=chunk-DSMJRXCZ.cjs.map
8530
+ //# sourceMappingURL=chunk-4R2LWV7E.cjs.map