@libraz/libcantus 1.1.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 (103) hide show
  1. package/README.md +4 -0
  2. package/README_ja.md +4 -0
  3. package/dist/analyze/index.cjs +31 -7
  4. package/dist/analyze/index.cjs.map +1 -1
  5. package/dist/analyze/index.d.cts +155 -9
  6. package/dist/analyze/index.d.ts +155 -9
  7. package/dist/analyze/index.js +37 -13
  8. package/dist/{chunk-TT6PKMPR.cjs → chunk-35NBV2FT.cjs} +16 -16
  9. package/dist/{chunk-TT6PKMPR.cjs.map → chunk-35NBV2FT.cjs.map} +1 -1
  10. package/dist/{chunk-YPB3A3EY.cjs → chunk-3R3QVKY5.cjs} +314 -285
  11. package/dist/chunk-3R3QVKY5.cjs.map +1 -0
  12. package/dist/{chunk-GDKE6RQW.cjs → chunk-4R2LWV7E.cjs} +691 -413
  13. package/dist/chunk-4R2LWV7E.cjs.map +1 -0
  14. package/dist/{chunk-RVS4G4MR.cjs → chunk-76ZBTRG2.cjs} +198 -198
  15. package/dist/{chunk-RVS4G4MR.cjs.map → chunk-76ZBTRG2.cjs.map} +1 -1
  16. package/dist/{chunk-X6RJAHII.js → chunk-7KG3RTYS.js} +2 -2
  17. package/dist/{chunk-PQL7E5F6.js → chunk-AGOVW7U6.js} +1 -1
  18. package/dist/{chunk-PQL7E5F6.js.map → chunk-AGOVW7U6.js.map} +1 -1
  19. package/dist/{chunk-5KW7DNCJ.cjs → chunk-B2PW6EHN.cjs} +2423 -453
  20. package/dist/chunk-B2PW6EHN.cjs.map +1 -0
  21. package/dist/{chunk-J772DL3B.cjs → chunk-CGBADIO5.cjs} +53 -53
  22. package/dist/{chunk-J772DL3B.cjs.map → chunk-CGBADIO5.cjs.map} +1 -1
  23. package/dist/{chunk-R5VUXQMP.js → chunk-CPMB7P75.js} +1978 -8
  24. package/dist/chunk-CPMB7P75.js.map +1 -0
  25. package/dist/{chunk-VLE5R7PF.js → chunk-GNVN4PPJ.js} +1874 -8
  26. package/dist/chunk-GNVN4PPJ.js.map +1 -0
  27. package/dist/{chunk-Q6R3QAZD.cjs → chunk-IFZDWIKM.cjs} +2199 -333
  28. package/dist/chunk-IFZDWIKM.cjs.map +1 -0
  29. package/dist/{chunk-DKICR7AN.js → chunk-IPEF6NWB.js} +296 -18
  30. package/dist/chunk-IPEF6NWB.js.map +1 -0
  31. package/dist/{chunk-AWEMD747.js → chunk-M5RYMAFI.js} +3 -3
  32. package/dist/{chunk-HSY2VQXZ.js → chunk-MLBPXA4Z.js} +330 -728
  33. package/dist/chunk-MLBPXA4Z.js.map +1 -0
  34. package/dist/{chunk-H66ARFU5.js → chunk-NB25P3EH.js} +3 -3
  35. package/dist/{chunk-5JJ6EHEZ.cjs → chunk-NM7UAMC3.cjs} +62 -62
  36. package/dist/{chunk-5JJ6EHEZ.cjs.map → chunk-NM7UAMC3.cjs.map} +1 -1
  37. package/dist/{chunk-R7B5N2JK.cjs → chunk-PM4XJE2Y.cjs} +47 -47
  38. package/dist/{chunk-R7B5N2JK.cjs.map → chunk-PM4XJE2Y.cjs.map} +1 -1
  39. package/dist/{chunk-7GOKQJTQ.js → chunk-PUKJP2Z5.js} +2 -2
  40. package/dist/{chunk-QCXYKSZS.cjs → chunk-PWC4CRWT.cjs} +19 -19
  41. package/dist/{chunk-QCXYKSZS.cjs.map → chunk-PWC4CRWT.cjs.map} +1 -1
  42. package/dist/{chunk-FPBZFNCD.js → chunk-RFIBF2RR.js} +47 -18
  43. package/dist/{chunk-FPBZFNCD.js.map → chunk-RFIBF2RR.js.map} +1 -1
  44. package/dist/{chunk-XKSO2V5I.cjs → chunk-S5BKZZGM.cjs} +1 -1
  45. package/dist/{chunk-XKSO2V5I.cjs.map → chunk-S5BKZZGM.cjs.map} +1 -1
  46. package/dist/{chunk-HOHFYGKW.js → chunk-UMWZ4ZET.js} +2 -2
  47. package/dist/{chunk-XVMJO3QF.cjs → chunk-YFA7X2F6.cjs} +489 -887
  48. package/dist/chunk-YFA7X2F6.cjs.map +1 -0
  49. package/dist/{chunk-57WB2EDF.js → chunk-ZBUROTJQ.js} +3 -3
  50. package/dist/{coerce-wwdELNYS.d.ts → coerce-DP0vYu-x.d.ts} +77 -1
  51. package/dist/{coerce-CJlgULrQ.d.cts → coerce-DRERzdve.d.cts} +77 -1
  52. package/dist/core/index.cjs +5 -5
  53. package/dist/core/index.d.cts +2 -2
  54. package/dist/core/index.d.ts +2 -2
  55. package/dist/core/index.js +4 -4
  56. package/dist/generate/index.cjs +20 -8
  57. package/dist/generate/index.cjs.map +1 -1
  58. package/dist/generate/index.d.cts +87 -9
  59. package/dist/generate/index.d.ts +87 -9
  60. package/dist/generate/index.js +19 -7
  61. package/dist/{index-BaoKVVhE.d.cts → index-B9QLziDe.d.cts} +2 -2
  62. package/dist/{index-CnHQgqNh.d.ts → index-BHIUyjhZ.d.ts} +2 -2
  63. package/dist/{index-CBCP84rv.d.cts → index-BL5N2Oyz.d.cts} +1 -1
  64. package/dist/{index-D_hzxD8w.d.cts → index-BMweUlm5.d.cts} +3 -0
  65. package/dist/{index-Ci3xyows.d.ts → index-CL4b4gUQ.d.ts} +3 -0
  66. package/dist/{index-BzLNkmA7.d.cts → index-CY-3NVfy.d.cts} +486 -5
  67. package/dist/{index-CnIdP4EZ.d.ts → index-Dw2DP7vm.d.ts} +1 -1
  68. package/dist/{index-DpC-mDlV.d.ts → index-zaZdmnU4.d.ts} +486 -5
  69. package/dist/index.cjs +49 -13
  70. package/dist/index.cjs.map +1 -1
  71. package/dist/index.d.cts +10 -10
  72. package/dist/index.d.ts +10 -10
  73. package/dist/index.js +55 -19
  74. package/dist/{masks-O73Rhj5d.d.ts → masks-Cc7-MzzY.d.ts} +1 -1
  75. package/dist/{masks-C8TWLFIi.d.cts → masks-pADfTOiD.d.cts} +1 -1
  76. package/dist/model/index.cjs +12 -12
  77. package/dist/model/index.d.cts +213 -16
  78. package/dist/model/index.d.ts +213 -16
  79. package/dist/model/index.js +11 -11
  80. package/dist/{index-DTsKaPaC.d.cts → profile-CQMEqdH9.d.cts} +88 -601
  81. package/dist/{index-BUtIf2go.d.ts → profile-DLdlIpS9.d.ts} +88 -601
  82. package/dist/theory/index.cjs +5 -5
  83. package/dist/theory/index.d.cts +7 -7
  84. package/dist/theory/index.d.ts +7 -7
  85. package/dist/theory/index.js +4 -4
  86. package/dist/{index-BpWOhkkE.d.ts → types-D-XgxGvp.d.cts} +1170 -14
  87. package/dist/{index-B3WCj_Hm.d.cts → types-Dh7C064C.d.ts} +1170 -14
  88. package/package.json +6 -5
  89. package/dist/chunk-5KW7DNCJ.cjs.map +0 -1
  90. package/dist/chunk-DKICR7AN.js.map +0 -1
  91. package/dist/chunk-GDKE6RQW.cjs.map +0 -1
  92. package/dist/chunk-HSY2VQXZ.js.map +0 -1
  93. package/dist/chunk-Q6R3QAZD.cjs.map +0 -1
  94. package/dist/chunk-R5VUXQMP.js.map +0 -1
  95. package/dist/chunk-VLE5R7PF.js.map +0 -1
  96. package/dist/chunk-XVMJO3QF.cjs.map +0 -1
  97. package/dist/chunk-YPB3A3EY.cjs.map +0 -1
  98. /package/dist/{chunk-X6RJAHII.js.map → chunk-7KG3RTYS.js.map} +0 -0
  99. /package/dist/{chunk-AWEMD747.js.map → chunk-M5RYMAFI.js.map} +0 -0
  100. /package/dist/{chunk-H66ARFU5.js.map → chunk-NB25P3EH.js.map} +0 -0
  101. /package/dist/{chunk-7GOKQJTQ.js.map → chunk-PUKJP2Z5.js.map} +0 -0
  102. /package/dist/{chunk-HOHFYGKW.js.map → chunk-UMWZ4ZET.js.map} +0 -0
  103. /package/dist/{chunk-57WB2EDF.js.map → chunk-ZBUROTJQ.js.map} +0 -0
package/README.md CHANGED
@@ -35,6 +35,10 @@ Composer.of({ key: chords.key, bpm: 120, seed: 1 }).bass(chords, { style: 'walki
35
35
 
36
36
  Chord boundaries are searched for rather than assumed, and so is the key, so a piece that modulates is not read against the key it started in. Answers carry their evidence: a chord analysis, a cadence and a Roman numeral each come with a `rationale` and the readings they turned down, and where the input cannot settle a question the field comes back `null` rather than a plausible guess.
37
37
 
38
+ Another piece is read the same way and measured against the first dimension by dimension — form, harmony, motif derivation, rhythm — never folded into one score: `analyzeReference` compresses a piece into a portable profile, and `compareReferences` reads two of them against each other.
39
+
40
+ That same profile doubles as a target for new material: `deriveCompositionPlan` turns it into a `CompositionPlan` — form, harmony and a motif derivation forest stated as instructions a generator can follow exactly — and `generateMelody` writes a melody to it, with `evaluateComposition` reading the result back against the plan. See [Generating from a reference](https://github.com/libraz/libcantus/blob/main/docs/en/generation.md#generating-from-a-reference).
41
+
38
42
  ## Use cases
39
43
 
40
44
  | Use case | What it does | Worked guide |
package/README_ja.md CHANGED
@@ -35,6 +35,10 @@ Composer.of({ key: chords.key, bpm: 120, seed: 1 }).bass(chords, { style: 'walki
35
35
 
36
36
  コードの境界は決め打ちせずに探索し、キーも同様に探します。転調する曲を、冒頭のキーのまま読み続けることはありません。答えには根拠が伴います。コード分析・終止・ローマ数字はいずれも `rationale` と、退けた候補を併せて返し、入力だけでは決まらない項目は、もっともらしい推測ではなく `null` を返します。
37
37
 
38
+ もう1曲も同じように読み取り、フォーム・和声・モチーフの派生・リズムを次元ごとに比較できます。単一のスコアにまとめることはありません。`analyzeReference` が曲を持ち運び可能なプロファイルに圧縮し、`compareReferences` がその2つを突き合わせます。
39
+
40
+ そのプロファイルは、新しい素材を書くための目標にもなります。`deriveCompositionPlan` はプロファイルを `CompositionPlan` に変換します。フォーム・和声・モチーフの派生の森を、ジェネレータがそのまま辿れる指示として持つ値です。`generateMelody` はその計画に沿って旋律を書き、`evaluateComposition` は結果を計画に照らして読み返します。[リファレンスからの生成](https://github.com/libraz/libcantus/blob/main/docs/ja/generation.md#リファレンスからの生成)を参照してください。
41
+
38
42
  ## ユースケース
39
43
 
40
44
  | ユースケース | 内容 | 実例のガイド |
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkQCXYKSZScjs = require('../chunk-QCXYKSZS.cjs');
3
+ var _chunkPWC4CRWTcjs = require('../chunk-PWC4CRWT.cjs');
4
4
 
5
5
 
6
6
 
@@ -13,12 +13,12 @@ var _chunkQCXYKSZScjs = require('../chunk-QCXYKSZS.cjs');
13
13
 
14
14
 
15
15
 
16
+ var _chunkYFA7X2F6cjs = require('../chunk-YFA7X2F6.cjs');
16
17
 
17
18
 
18
19
 
19
20
 
20
21
 
21
- var _chunkXVMJO3QFcjs = require('../chunk-XVMJO3QF.cjs');
22
22
 
23
23
 
24
24
 
@@ -52,12 +52,8 @@ var _chunkXVMJO3QFcjs = require('../chunk-XVMJO3QF.cjs');
52
52
 
53
53
 
54
54
 
55
- var _chunkQ6R3QAZDcjs = require('../chunk-Q6R3QAZD.cjs');
56
- require('../chunk-TT6PKMPR.cjs');
57
55
 
58
56
 
59
- var _chunkYPB3A3EYcjs = require('../chunk-YPB3A3EY.cjs');
60
- require('../chunk-XKSO2V5I.cjs');
61
57
 
62
58
 
63
59
 
@@ -68,8 +64,12 @@ require('../chunk-XKSO2V5I.cjs');
68
64
 
69
65
 
70
66
 
67
+ var _chunkIFZDWIKMcjs = require('../chunk-IFZDWIKM.cjs');
68
+ require('../chunk-35NBV2FT.cjs');
71
69
 
72
70
 
71
+ var _chunk3R3QVKY5cjs = require('../chunk-3R3QVKY5.cjs');
72
+ require('../chunk-S5BKZZGM.cjs');
73
73
 
74
74
 
75
75
 
@@ -109,5 +109,29 @@ require('../chunk-XKSO2V5I.cjs');
109
109
 
110
110
 
111
111
 
112
- exports.MODAL_SCALE_NAMES = _chunkQ6R3QAZDcjs.MODAL_SCALE_NAMES; exports.NoteSafety = _chunkYPB3A3EYcjs.NoteSafety; exports.analyzeArrangement = _chunkXVMJO3QFcjs.analyzeArrangement; exports.analyzeChord = _chunkQ6R3QAZDcjs.analyzeChord; exports.analyzePolyphony = _chunkXVMJO3QFcjs.analyzePolyphony; exports.analyzeVoice = _chunkQ6R3QAZDcjs.analyzeVoice; exports.assertChordTimeline = _chunkQ6R3QAZDcjs.assertChordTimeline; exports.augmentedSixthChord = _chunkQ6R3QAZDcjs.augmentedSixthChord; exports.augmentedSixthFromPitchClasses = _chunkQ6R3QAZDcjs.augmentedSixthFromPitchClasses; exports.augmentedSixthKind = _chunkQ6R3QAZDcjs.augmentedSixthKind; exports.borrowedSource = _chunkQ6R3QAZDcjs.borrowedSource; exports.chordTimelineFromChords = _chunkQ6R3QAZDcjs.chordTimelineFromChords; exports.chordTimelineFromNotes = _chunkQ6R3QAZDcjs.chordTimelineFromNotes; exports.chordToRoman = _chunkQ6R3QAZDcjs.chordToRoman; exports.compareMelodies = _chunkXVMJO3QFcjs.compareMelodies; exports.createArrangementSession = _chunkXVMJO3QFcjs.createArrangementSession; exports.detectCadence = _chunkQ6R3QAZDcjs.detectCadence; exports.detectCadences = _chunkQ6R3QAZDcjs.detectCadences; exports.detectChord = _chunkQ6R3QAZDcjs.detectChord; exports.detectChordBest = _chunkQ6R3QAZDcjs.detectChordBest; exports.detectKey = _chunkQ6R3QAZDcjs.detectKey; exports.detectKeyBest = _chunkQ6R3QAZDcjs.detectKeyBest; exports.detectKeyFromNotes = _chunkQ6R3QAZDcjs.detectKeyFromNotes; exports.detectModulations = _chunkQ6R3QAZDcjs.detectModulations; exports.explainRoman = _chunkQ6R3QAZDcjs.explainRoman; exports.extractMotifs = _chunkXVMJO3QFcjs.extractMotifs; exports.functionOf = _chunkQ6R3QAZDcjs.functionOf; exports.hypermeter = _chunkXVMJO3QFcjs.hypermeter; exports.isBorrowedChord = _chunkQ6R3QAZDcjs.isBorrowedChord; exports.isDiatonic = _chunkQ6R3QAZDcjs.isDiatonic; exports.isMinorKey = _chunkQ6R3QAZDcjs.isMinorKey; exports.keyTimelineFromNotes = _chunkQ6R3QAZDcjs.keyTimelineFromNotes; exports.melodicContour = _chunkXVMJO3QFcjs.melodicContour; exports.melodicSimilarity = _chunkXVMJO3QFcjs.melodicSimilarity; exports.motifFromNotes = _chunkXVMJO3QFcjs.motifFromNotes; exports.phrasesFromTimeline = _chunkXVMJO3QFcjs.phrasesFromTimeline; exports.pivotChords = _chunkQ6R3QAZDcjs.pivotChords; exports.prevailingKeyOf = _chunkQ6R3QAZDcjs.prevailingKeyOf; exports.reduceProgression = _chunkXVMJO3QFcjs.reduceProgression; exports.relateMotifs = _chunkXVMJO3QFcjs.relateMotifs; exports.romanToChord = _chunkQ6R3QAZDcjs.romanToChord; exports.secondaryDominant = _chunkQ6R3QAZDcjs.secondaryDominant; exports.secondaryDominantOf = _chunkQ6R3QAZDcjs.secondaryDominantOf; exports.sectionsFromNotes = _chunkXVMJO3QFcjs.sectionsFromNotes; exports.spellAugmentedSixth = _chunkQ6R3QAZDcjs.spellAugmentedSixth; exports.spellLine = _chunkQCXYKSZScjs.spellLine; exports.structuralCadences = _chunkXVMJO3QFcjs.structuralCadences; exports.tensionCurve = _chunkXVMJO3QFcjs.tensionCurve; exports.tensionCurveFrom = _chunkXVMJO3QFcjs.tensionCurveFrom; exports.toVoiceNotes = _chunkQ6R3QAZDcjs.toVoiceNotes;
112
+
113
+
114
+
115
+
116
+
117
+
118
+
119
+
120
+
121
+
122
+
123
+
124
+
125
+
126
+
127
+
128
+
129
+
130
+
131
+
132
+
133
+
134
+
135
+
136
+ exports.CADENCE_TYPES = _chunkIFZDWIKMcjs.CADENCE_TYPES; exports.HARMONIC_FUNCTIONS = _chunkIFZDWIKMcjs.HARMONIC_FUNCTIONS; exports.MELODIC_CONTOUR_SHAPES = _chunkIFZDWIKMcjs.MELODIC_CONTOUR_SHAPES; exports.MODAL_SCALE_NAMES = _chunkIFZDWIKMcjs.MODAL_SCALE_NAMES; exports.MOTIF_RELATION_KINDS = _chunkIFZDWIKMcjs.MOTIF_RELATION_KINDS; exports.NoteSafety = _chunk3R3QVKY5cjs.NoteSafety; exports.REDUCTION_LEVELS = _chunkIFZDWIKMcjs.REDUCTION_LEVELS; exports.REFERENCE_PROFILE_VERSION = _chunkIFZDWIKMcjs.REFERENCE_PROFILE_VERSION; exports.RHYTHM_IOI_BINS = _chunkIFZDWIKMcjs.RHYTHM_IOI_BINS; exports.analyzeArrangement = _chunkYFA7X2F6cjs.analyzeArrangement; exports.analyzeChord = _chunkIFZDWIKMcjs.analyzeChord; exports.analyzePolyphony = _chunkYFA7X2F6cjs.analyzePolyphony; exports.analyzeReference = _chunkYFA7X2F6cjs.analyzeReference; exports.analyzeRhythm = _chunkIFZDWIKMcjs.analyzeRhythm; exports.analyzeVoice = _chunkIFZDWIKMcjs.analyzeVoice; exports.assertChordTimeline = _chunkIFZDWIKMcjs.assertChordTimeline; exports.assertReferenceProfile = _chunkIFZDWIKMcjs.assertReferenceProfile; exports.augmentedSixthChord = _chunkIFZDWIKMcjs.augmentedSixthChord; exports.augmentedSixthFromPitchClasses = _chunkIFZDWIKMcjs.augmentedSixthFromPitchClasses; exports.augmentedSixthKind = _chunkIFZDWIKMcjs.augmentedSixthKind; exports.borrowedSource = _chunkIFZDWIKMcjs.borrowedSource; exports.chordTimelineFromChords = _chunkIFZDWIKMcjs.chordTimelineFromChords; exports.chordTimelineFromNotes = _chunkIFZDWIKMcjs.chordTimelineFromNotes; exports.chordToRoman = _chunkIFZDWIKMcjs.chordToRoman; exports.compareMelodies = _chunkIFZDWIKMcjs.compareMelodies; exports.compareReferences = _chunkYFA7X2F6cjs.compareReferences; exports.createArrangementSession = _chunkYFA7X2F6cjs.createArrangementSession; exports.detectCadence = _chunkIFZDWIKMcjs.detectCadence; exports.detectCadences = _chunkIFZDWIKMcjs.detectCadences; exports.detectChord = _chunkIFZDWIKMcjs.detectChord; exports.detectChordBest = _chunkIFZDWIKMcjs.detectChordBest; exports.detectKey = _chunkIFZDWIKMcjs.detectKey; exports.detectKeyBest = _chunkIFZDWIKMcjs.detectKeyBest; exports.detectKeyFromNotes = _chunkIFZDWIKMcjs.detectKeyFromNotes; exports.detectModulations = _chunkIFZDWIKMcjs.detectModulations; exports.explainRoman = _chunkIFZDWIKMcjs.explainRoman; exports.extractMotifs = _chunkIFZDWIKMcjs.extractMotifs; exports.functionOf = _chunkIFZDWIKMcjs.functionOf; exports.hypermeter = _chunkYFA7X2F6cjs.hypermeter; exports.isBorrowedChord = _chunkIFZDWIKMcjs.isBorrowedChord; exports.isDiatonic = _chunkIFZDWIKMcjs.isDiatonic; exports.isMinorKey = _chunkIFZDWIKMcjs.isMinorKey; exports.keyTimelineFromNotes = _chunkIFZDWIKMcjs.keyTimelineFromNotes; exports.melodicContour = _chunkIFZDWIKMcjs.melodicContour; exports.melodicSimilarity = _chunkIFZDWIKMcjs.melodicSimilarity; exports.motifFromNotes = _chunkIFZDWIKMcjs.motifFromNotes; exports.motifGraph = _chunkIFZDWIKMcjs.motifGraph; exports.phrasesFromTimeline = _chunkYFA7X2F6cjs.phrasesFromTimeline; exports.pivotChords = _chunkIFZDWIKMcjs.pivotChords; exports.prevailingKeyOf = _chunkIFZDWIKMcjs.prevailingKeyOf; exports.reduceProgression = _chunkIFZDWIKMcjs.reduceProgression; exports.relateMotifs = _chunkIFZDWIKMcjs.relateMotifs; exports.romanToChord = _chunkIFZDWIKMcjs.romanToChord; exports.secondaryDominant = _chunkIFZDWIKMcjs.secondaryDominant; exports.secondaryDominantOf = _chunkIFZDWIKMcjs.secondaryDominantOf; exports.sectionsFromNotes = _chunkYFA7X2F6cjs.sectionsFromNotes; exports.spellAugmentedSixth = _chunkIFZDWIKMcjs.spellAugmentedSixth; exports.spellLine = _chunkPWC4CRWTcjs.spellLine; exports.structuralCadences = _chunkYFA7X2F6cjs.structuralCadences; exports.tensionCurve = _chunkYFA7X2F6cjs.tensionCurve; exports.tensionCurveFrom = _chunkYFA7X2F6cjs.tensionCurveFrom; exports.toVoiceNotes = _chunkIFZDWIKMcjs.toVoiceNotes;
113
137
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/libcantus/libcantus/dist/analyze/index.cjs"],"names":[],"mappings":"AAAA;AACE;AACF,yDAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B,iCAA8B;AAC9B;AACE;AACF,yDAA8B;AAC9B,iCAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,+/FAAC","file":"/home/runner/work/libcantus/libcantus/dist/analyze/index.cjs"}
1
+ {"version":3,"sources":["/home/runner/work/libcantus/libcantus/dist/analyze/index.cjs"],"names":[],"mappings":"AAAA;AACE;AACF,yDAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B,iCAA8B;AAC9B;AACE;AACF,yDAA8B;AAC9B,iCAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,ixHAAC","file":"/home/runner/work/libcantus/libcantus/dist/analyze/index.cjs"}
@@ -1,13 +1,12 @@
1
1
  import { i as NoteLike, h as NoteEvent, g as Note } from '../index-Cy15oTvh.cjs';
2
2
  export { a as Articulation, I as IntervalData, c as IntervalQualityLabel, e as KeyScale, S as SpelledInterval } from '../index-Cy15oTvh.cjs';
3
- export { M as MeterChange, b as MeterLike, c as MeterMap, T as TimeSignature } from '../index-D_hzxD8w.cjs';
4
- import { q as SpelledKeyLike } from '../coerce-CJlgULrQ.cjs';
5
- export { b as ChordData, c as ChordLike, d as ChordQuality, e as ChordSegment, g as ChordSpan, i as ChordToneRole, K as KeyLike, j as KeyRelation, k as KeyVariant, N as NoteSafety, l as PitchSpelling, n as ResolvedKey, S as SafetyProfile, r as SpelledKeyScale, V as VoiceSnapshot } from '../coerce-CJlgULrQ.cjs';
6
- export { r as ScaleName } from '../masks-C8TWLFIi.cjs';
7
- import { e as ChordTimeline } from '../index-B3WCj_Hm.cjs';
8
- export { A as AnalyzeChordOptions, a as AnalyzedNote, B as BorrowedSource, C as CadenceHit, b as CadenceResult, c as ChordAnalysis, d as ChordSegmentation, f as ChordTimelineOptions, g as ChordTimelineResult, h as ChordToRomanOptions, D as DetectCadenceOptions, E as ExplainRomanOptions, H as HarmonicFunction, I as IdentifiedVoiceNote, K as KeyContext, i as KeyProfileName, j as KeyProfilePair, k as KeyRegion, l as KeyTimelineOptions, P as PivotChord, R as RejectedCandidate, m as RomanExplanation, S as SuspensionFigure, T as TheoryLabel, V as VoiceNote, n as analyzeChord, o as analyzeVoice, p as assertChordTimeline, q as borrowedSource, r as chordTimelineFromChords, s as chordTimelineFromNotes, t as chordToRoman, u as detectCadence, v as detectCadences, w as detectModulations, x as explainRoman, y as functionOf, z as isBorrowedChord, F as isDiatonic, G as isMinorKey, J as keyTimelineFromNotes, L as pivotChords, M as prevailingKeyOf, N as romanToChord, O as secondaryDominant, Q as secondaryDominantOf, U as toVoiceNotes } from '../index-B3WCj_Hm.cjs';
9
- import { l as MelodicPhrase } from '../index-DTsKaPaC.cjs';
10
- export { A as ArrangementAnalysis, a as ArrangementOptions, b as ArrangementSession, c as ArrangementTrack, d as AugmentedSixthKind, C as ChordMatch, e as Conflict, f as ContourDirection, D as DetectChordOptions, g as DetectKeyOptions, E as ExtractMotifsOptions, F as FormSection, h as FormSectionOptions, H as Hypermeter, i as HypermeterOptions, K as KeyMatch, M as MODAL_SCALE_NAMES, j as MelodicContour, k as MelodicContourShape, m as ModalCandidate, n as ModalScaleName, o as MotifData, p as MotifOccurrence, q as MotifRelation, r as MotifRelationKind, P as Phrase, s as PhraseOptions, t as PhraseSignal, R as ReduceProgressionOptions, u as ReducedChord, v as ReductionBasis, w as ReductionLevel, S as StructuralCadence, T as TensionPoint, x as TrackAnalysis, y as TrackEdit, z as TrackRole, B as analyzeArrangement, G as analyzePolyphony, I as augmentedSixthChord, J as augmentedSixthFromPitchClasses, L as augmentedSixthKind, N as createArrangementSession, O as detectChord, Q as detectChordBest, U as detectKey, V as detectKeyBest, W as detectKeyFromNotes, X as extractMotifs, Y as hypermeter, Z as melodicContour, _ as motifFromNotes, $ as phrasesFromTimeline, a0 as reduceProgression, a1 as relateMotifs, a2 as sectionsFromNotes, a3 as spellAugmentedSixth, a4 as structuralCadences, a5 as tensionCurve, a6 as tensionCurveFrom } from '../index-DTsKaPaC.cjs';
3
+ export { M as MeterChange, b as MeterLike, c as MeterMap, T as TimeSignature } from '../index-BMweUlm5.cjs';
4
+ import { r as SpelledKeyLike } from '../coerce-DRERzdve.cjs';
5
+ export { b as ChordData, c as ChordLike, d as ChordQuality, e as ChordSegment, g as ChordSpan, i as ChordToneRole, K as KeyLike, j as KeyRelation, k as KeyVariant, N as NoteSafety, l as PitchSpelling, n as ResolvedKey, o as SafetyProfile, s as SpelledKeyScale, V as VoiceSnapshot } from '../coerce-DRERzdve.cjs';
6
+ export { r as ScaleName } from '../masks-pADfTOiD.cjs';
7
+ import { w as MelodicPhrase, a5 as ReferenceProfile, h as ChordTimeline } from '../types-D-XgxGvp.cjs';
8
+ export { A as AnalyzeChordOptions, a as AnalyzedNote, B as BarPositionProfile, b as BorrowedSource, C as CADENCE_TYPES, c as CadenceHit, d as CadenceResult, e as CadenceType, f as ChordAnalysis, g as ChordSegmentation, i as ChordTimelineOptions, j as ChordTimelineResult, k as ChordToRomanOptions, l as ContourDirection, D as DetectCadenceOptions, E as ExplainRomanOptions, m as ExtractMotifsOptions, F as FormSection, n as FormSectionOptions, H as HARMONIC_FUNCTIONS, o as HarmonicFunction, I as IdentifiedVoiceNote, K as KeyContext, p as KeyProfileName, q as KeyProfilePair, r as KeyRegion, s as KeyTimelineOptions, M as MELODIC_CONTOUR_SHAPES, t as MOTIF_RELATION_KINDS, u as MelodicContour, v as MelodicContourShape, x as MotifData, y as MotifGraph, z as MotifGraphEdge, G as MotifGraphNode, J as MotifGraphOptions, L as MotifOccurrence, N as MotifRelation, O as MotifRelationKind, P as MotifRelationSummary, Q as PivotChord, R as REDUCTION_LEVELS, S as REFERENCE_PROFILE_VERSION, T as RHYTHM_IOI_BINS, U as ReduceProgressionOptions, V as ReducedChord, W as ReductionBasis, X as ReductionLevel, Y as ReferenceCadence, Z as ReferenceChord, _ as ReferenceForm, $ as ReferenceHarmony, a0 as ReferenceKeyRegion, a1 as ReferenceMelody, a2 as ReferenceMotif, a3 as ReferencePhrase, a4 as ReferencePhraseMelody, a6 as RejectedCandidate, a7 as RhythmAnalysis, a8 as RhythmAnalysisOptions, a9 as RomanExplanation, aa as SuspensionFigure, ab as TheoryLabel, ac as VoiceNote, ad as analyzeChord, ae as analyzeRhythm, af as analyzeVoice, ag as assertChordTimeline, ah as borrowedSource, ai as chordTimelineFromChords, aj as chordTimelineFromNotes, ak as chordToRoman, al as detectCadence, am as detectCadences, an as detectModulations, ao as explainRoman, ap as extractMotifs, aq as functionOf, ar as isBorrowedChord, as as isDiatonic, at as isMinorKey, au as keyTimelineFromNotes, av as melodicContour, aw as motifFromNotes, ax as motifGraph, ay as pivotChords, az as prevailingKeyOf, aA as reduceProgression, aB as relateMotifs, aC as romanToChord, aD as secondaryDominant, aE as secondaryDominantOf, aF as sectionsFromNotes, aG as toVoiceNotes } from '../types-D-XgxGvp.cjs';
9
+ export { A as ArrangementAnalysis, a as ArrangementOptions, b as ArrangementSession, c as ArrangementTrack, d as AugmentedSixthKind, C as ChordMatch, e as Conflict, f as ConflictPartner, D as DetectChordOptions, g as DetectKeyOptions, H as Hypermeter, h as HypermeterOptions, K as KeyMatch, M as MODAL_SCALE_NAMES, i as ModalCandidate, j as ModalScaleName, P as Phrase, k as PhraseOptions, l as PhraseSignal, R as ReferenceProfileOptions, S as StructuralCadence, T as TensionPoint, m as TrackAnalysis, n as TrackEdit, o as TrackRole, p as analyzeArrangement, q as analyzePolyphony, r as analyzeReference, s as augmentedSixthChord, t as augmentedSixthFromPitchClasses, u as augmentedSixthKind, v as createArrangementSession, w as detectChord, x as detectChordBest, y as detectKey, z as detectKeyBest, B as detectKeyFromNotes, E as hypermeter, F as phrasesFromTimeline, G as spellAugmentedSixth, I as structuralCadences, J as tensionCurve, L as tensionCurveFrom } from '../profile-CQMEqdH9.cjs';
11
10
 
12
11
  /**
13
12
  * How alike two phrases are, when they stand in no named relation.
@@ -95,6 +94,153 @@ declare function compareMelodies(a: MelodicPhrase, b: MelodicPhrase): MelodicCom
95
94
  */
96
95
  declare function melodicSimilarity(a: MelodicPhrase, b: MelodicPhrase): number;
97
96
 
97
+ /**
98
+ * Comparing two {@link ReferenceProfile}s dimension by dimension.
99
+ *
100
+ * The answer is never folded into one number: each field names the aspect it
101
+ * measures, so "a different song built the same way" reads as high structural
102
+ * fields beside a low surface one. Only `melody.surfaceSimilarity` reads the
103
+ * motifs' intervals; every other field is invariant under transposition, tempo
104
+ * and a change of motif intervals.
105
+ */
106
+
107
+ /**
108
+ * Options for {@link compareReferences}.
109
+ *
110
+ * @category Arrangement & Analysis
111
+ */
112
+ type ReferenceComparisonOptions = {
113
+ /**
114
+ * Upper bound on the cells of the progression alignment.
115
+ *
116
+ * @defaultValue {@link DEFAULT_GENERATION_BUDGET}
117
+ */
118
+ budget?: number;
119
+ };
120
+ /**
121
+ * How alike two profiled pieces are, one field per aspect.
122
+ *
123
+ * Every value is in [0, 1] and symmetric in the two profiles. A value is
124
+ * `null` when neither profile has anything to measure it on, and 0 when only
125
+ * one does.
126
+ *
127
+ * @category Arrangement & Analysis
128
+ */
129
+ type ReferenceComparison = {
130
+ /** Formal layout. */
131
+ form: {
132
+ /** Likeness of the section-label sequences. */
133
+ sectionSequenceSimilarity: number | null;
134
+ /** Likeness of the phrase-length sequences. */
135
+ phraseLengthSimilarity: number | null;
136
+ };
137
+ /** Harmony. */
138
+ harmony: {
139
+ /** Likeness of the structural Roman-numeral progressions. */
140
+ progressionSimilarity: number | null;
141
+ /** Likeness of how long each harmonic function is held. */
142
+ functionSimilarity: number | null;
143
+ /** Likeness of the phrase-by-phrase cadence sequences. */
144
+ cadenceSimilarity: number | null;
145
+ /** Likeness of the key plans, read relative to each piece's first key. */
146
+ keyPlanSimilarity: number | null;
147
+ /** Likeness of where in the bar the chords change. */
148
+ harmonicRhythmOnsetSimilarity: number | null;
149
+ /** Likeness of how often the chords change. */
150
+ harmonicRhythmDensitySimilarity: number | null;
151
+ };
152
+ /** Melody. */
153
+ melody: {
154
+ /** Likeness of the motifs' interval content: the one field that reads the surface. */
155
+ surfaceSimilarity: number | null;
156
+ /** Likeness of how the motifs derive from one another. */
157
+ motifStructureSimilarity: number | null;
158
+ /** Likeness of the phrases' melodic outlines, each scaled by its own range. */
159
+ contourSimilarity: number | null;
160
+ /** Likeness of the phrases' registers, each relative to its piece's melodic mean. */
161
+ registerSimilarity: number | null;
162
+ };
163
+ /** Melodic rhythm. */
164
+ rhythm: {
165
+ /** Likeness of where in the bar the melody's onsets fall. */
166
+ onsetSimilarity: number | null;
167
+ /** Likeness of the melodies' onsets per bar. */
168
+ densitySimilarity: number | null;
169
+ /** Likeness of the melodies' inter-onset-interval distributions. */
170
+ durationSimilarity: number | null;
171
+ /** Likeness of the melodies' syncopation. */
172
+ syncopationSimilarity: number | null;
173
+ };
174
+ /** The two most and the two least alike fields, by name. */
175
+ rationale: string;
176
+ };
177
+ /**
178
+ * Compare two profiled pieces aspect by aspect: form, harmony, melody and
179
+ * melodic rhythm.
180
+ *
181
+ * Sequences — sections, phrase lengths, cadences, key plans, structural
182
+ * chords, phrase contours and registers — are aligned by a graded edit
183
+ * distance; distributions — harmonic function, onset placement, inter-onset
184
+ * intervals, motif derivations — by histogram intersection. The surface field
185
+ * compares the motifs' interval cells, so a transposition of the same piece
186
+ * reads 1 on every field. No aggregate is returned: which aspects agree is the
187
+ * answer.
188
+ *
189
+ * @param a The first profile.
190
+ * @param b The second profile.
191
+ * @param opts The work budget.
192
+ * @returns One likeness per aspect, and a rationale naming the extremes.
193
+ * @throws {InvalidInputError} If either profile or the options cannot be read.
194
+ * @throws {BudgetExceededError} If the progression alignment would exceed the budget.
195
+ * @category Arrangement & Analysis
196
+ */
197
+ declare function compareReferences(a: ReferenceProfile, b: ReferenceProfile, opts?: ReferenceComparisonOptions): ReferenceComparison;
198
+
199
+ /**
200
+ * Boundary validation for {@link ReferenceProfile}: a caller can hand this a
201
+ * value restored from JSON, a config file, or a plugin host, and every field
202
+ * is checked before anything downstream reads it. A violation names the path
203
+ * to the offending field, so a malformed document is diagnosed at the field
204
+ * that is wrong rather than wherever the first bad read happens to land.
205
+ */
206
+
207
+ /**
208
+ * Reject a value that is not a {@link ReferenceProfile}.
209
+ *
210
+ * A profile is the shape a caller's stored JSON, a config file, or a plugin
211
+ * host most plausibly hands back malformed: a missing field, a distribution
212
+ * that no longer sums to 1, an index a later edit left dangling, a numeral no
213
+ * reader can parse. Every field is checked before {@link compareReferences} or
214
+ * a caller's own code reads it, and a violation names the path to the field
215
+ * that is wrong.
216
+ *
217
+ * @param value The value to check.
218
+ * @param name What the value is, for the error message.
219
+ * @returns The same profile.
220
+ * @throws {InvalidInputError} If the value is not a valid reference profile.
221
+ * @example
222
+ * ```ts
223
+ * import { assertReferenceProfile } from '@libraz/libcantus';
224
+ * const emptyRhythm = {
225
+ * startBeat: 0, endBeat: 0, bars: 0, onsets: 0, onsetDensity: 0,
226
+ * barOnsets: [], onsetLevels: [0, 0, 0, 0, 0, 0], barPositions: [],
227
+ * interOnsetShares: new Array(17).fill(0), restRatio: 0, syncopation: 0,
228
+ * offGridRatio: 0, rationale: 'nothing sounds',
229
+ * };
230
+ * const profile = {
231
+ * profileVersion: 1,
232
+ * span: { startBeat: 0, endBeat: 0, bars: 0 },
233
+ * meters: [{ startBeat: 0, ts: { numerator: 4, denominator: 4 } }],
234
+ * form: { hypermeter: { groupBars: 1, confidence: 0 }, sections: [], phrases: [] },
235
+ * harmony: { keys: [], chords: [], rhythm: emptyRhythm },
236
+ * melody: { register: null, shape: null, motifs: [], graph: { nodes: [], edges: [] }, rhythm: emptyRhythm },
237
+ * };
238
+ * assertReferenceProfile(profile); // the profile, unchanged
239
+ * ```
240
+ * @category Arrangement & Analysis
241
+ */
242
+ declare function assertReferenceProfile(value: unknown, name?: string): ReferenceProfile;
243
+
98
244
  /**
99
245
  * Line spelling: name every note of a melodic line in one pass.
100
246
  *
@@ -190,4 +336,4 @@ type SpellLineOptions = {
190
336
  */
191
337
  declare function spellLine(notes: readonly NoteEvent[], timeline: ChordTimeline | null, key: SpelledKeyLike, opts?: SpellLineOptions): Note[];
192
338
 
193
- export { ChordTimeline, type MelodicComparison, MelodicPhrase, Note as NoteData, NoteEvent, NoteLike, type SpellLineOptions, SpelledKeyLike, compareMelodies, melodicSimilarity, spellLine };
339
+ export { ChordTimeline, type MelodicComparison, MelodicPhrase, Note as NoteData, NoteEvent, NoteLike, type ReferenceComparison, type ReferenceComparisonOptions, ReferenceProfile, type SpellLineOptions, SpelledKeyLike, assertReferenceProfile, compareMelodies, compareReferences, melodicSimilarity, spellLine };
@@ -1,13 +1,12 @@
1
1
  import { i as NoteLike, h as NoteEvent, g as Note } from '../index-Cy15oTvh.js';
2
2
  export { a as Articulation, I as IntervalData, c as IntervalQualityLabel, e as KeyScale, S as SpelledInterval } from '../index-Cy15oTvh.js';
3
- export { M as MeterChange, b as MeterLike, c as MeterMap, T as TimeSignature } from '../index-Ci3xyows.js';
4
- import { q as SpelledKeyLike } from '../coerce-wwdELNYS.js';
5
- export { b as ChordData, c as ChordLike, d as ChordQuality, e as ChordSegment, g as ChordSpan, i as ChordToneRole, K as KeyLike, j as KeyRelation, k as KeyVariant, N as NoteSafety, l as PitchSpelling, n as ResolvedKey, S as SafetyProfile, r as SpelledKeyScale, V as VoiceSnapshot } from '../coerce-wwdELNYS.js';
6
- export { r as ScaleName } from '../masks-O73Rhj5d.js';
7
- import { e as ChordTimeline } from '../index-BpWOhkkE.js';
8
- export { A as AnalyzeChordOptions, a as AnalyzedNote, B as BorrowedSource, C as CadenceHit, b as CadenceResult, c as ChordAnalysis, d as ChordSegmentation, f as ChordTimelineOptions, g as ChordTimelineResult, h as ChordToRomanOptions, D as DetectCadenceOptions, E as ExplainRomanOptions, H as HarmonicFunction, I as IdentifiedVoiceNote, K as KeyContext, i as KeyProfileName, j as KeyProfilePair, k as KeyRegion, l as KeyTimelineOptions, P as PivotChord, R as RejectedCandidate, m as RomanExplanation, S as SuspensionFigure, T as TheoryLabel, V as VoiceNote, n as analyzeChord, o as analyzeVoice, p as assertChordTimeline, q as borrowedSource, r as chordTimelineFromChords, s as chordTimelineFromNotes, t as chordToRoman, u as detectCadence, v as detectCadences, w as detectModulations, x as explainRoman, y as functionOf, z as isBorrowedChord, F as isDiatonic, G as isMinorKey, J as keyTimelineFromNotes, L as pivotChords, M as prevailingKeyOf, N as romanToChord, O as secondaryDominant, Q as secondaryDominantOf, U as toVoiceNotes } from '../index-BpWOhkkE.js';
9
- import { l as MelodicPhrase } from '../index-BUtIf2go.js';
10
- export { A as ArrangementAnalysis, a as ArrangementOptions, b as ArrangementSession, c as ArrangementTrack, d as AugmentedSixthKind, C as ChordMatch, e as Conflict, f as ContourDirection, D as DetectChordOptions, g as DetectKeyOptions, E as ExtractMotifsOptions, F as FormSection, h as FormSectionOptions, H as Hypermeter, i as HypermeterOptions, K as KeyMatch, M as MODAL_SCALE_NAMES, j as MelodicContour, k as MelodicContourShape, m as ModalCandidate, n as ModalScaleName, o as MotifData, p as MotifOccurrence, q as MotifRelation, r as MotifRelationKind, P as Phrase, s as PhraseOptions, t as PhraseSignal, R as ReduceProgressionOptions, u as ReducedChord, v as ReductionBasis, w as ReductionLevel, S as StructuralCadence, T as TensionPoint, x as TrackAnalysis, y as TrackEdit, z as TrackRole, B as analyzeArrangement, G as analyzePolyphony, I as augmentedSixthChord, J as augmentedSixthFromPitchClasses, L as augmentedSixthKind, N as createArrangementSession, O as detectChord, Q as detectChordBest, U as detectKey, V as detectKeyBest, W as detectKeyFromNotes, X as extractMotifs, Y as hypermeter, Z as melodicContour, _ as motifFromNotes, $ as phrasesFromTimeline, a0 as reduceProgression, a1 as relateMotifs, a2 as sectionsFromNotes, a3 as spellAugmentedSixth, a4 as structuralCadences, a5 as tensionCurve, a6 as tensionCurveFrom } from '../index-BUtIf2go.js';
3
+ export { M as MeterChange, b as MeterLike, c as MeterMap, T as TimeSignature } from '../index-CL4b4gUQ.js';
4
+ import { r as SpelledKeyLike } from '../coerce-DP0vYu-x.js';
5
+ export { b as ChordData, c as ChordLike, d as ChordQuality, e as ChordSegment, g as ChordSpan, i as ChordToneRole, K as KeyLike, j as KeyRelation, k as KeyVariant, N as NoteSafety, l as PitchSpelling, n as ResolvedKey, o as SafetyProfile, s as SpelledKeyScale, V as VoiceSnapshot } from '../coerce-DP0vYu-x.js';
6
+ export { r as ScaleName } from '../masks-Cc7-MzzY.js';
7
+ import { w as MelodicPhrase, a5 as ReferenceProfile, h as ChordTimeline } from '../types-Dh7C064C.js';
8
+ export { A as AnalyzeChordOptions, a as AnalyzedNote, B as BarPositionProfile, b as BorrowedSource, C as CADENCE_TYPES, c as CadenceHit, d as CadenceResult, e as CadenceType, f as ChordAnalysis, g as ChordSegmentation, i as ChordTimelineOptions, j as ChordTimelineResult, k as ChordToRomanOptions, l as ContourDirection, D as DetectCadenceOptions, E as ExplainRomanOptions, m as ExtractMotifsOptions, F as FormSection, n as FormSectionOptions, H as HARMONIC_FUNCTIONS, o as HarmonicFunction, I as IdentifiedVoiceNote, K as KeyContext, p as KeyProfileName, q as KeyProfilePair, r as KeyRegion, s as KeyTimelineOptions, M as MELODIC_CONTOUR_SHAPES, t as MOTIF_RELATION_KINDS, u as MelodicContour, v as MelodicContourShape, x as MotifData, y as MotifGraph, z as MotifGraphEdge, G as MotifGraphNode, J as MotifGraphOptions, L as MotifOccurrence, N as MotifRelation, O as MotifRelationKind, P as MotifRelationSummary, Q as PivotChord, R as REDUCTION_LEVELS, S as REFERENCE_PROFILE_VERSION, T as RHYTHM_IOI_BINS, U as ReduceProgressionOptions, V as ReducedChord, W as ReductionBasis, X as ReductionLevel, Y as ReferenceCadence, Z as ReferenceChord, _ as ReferenceForm, $ as ReferenceHarmony, a0 as ReferenceKeyRegion, a1 as ReferenceMelody, a2 as ReferenceMotif, a3 as ReferencePhrase, a4 as ReferencePhraseMelody, a6 as RejectedCandidate, a7 as RhythmAnalysis, a8 as RhythmAnalysisOptions, a9 as RomanExplanation, aa as SuspensionFigure, ab as TheoryLabel, ac as VoiceNote, ad as analyzeChord, ae as analyzeRhythm, af as analyzeVoice, ag as assertChordTimeline, ah as borrowedSource, ai as chordTimelineFromChords, aj as chordTimelineFromNotes, ak as chordToRoman, al as detectCadence, am as detectCadences, an as detectModulations, ao as explainRoman, ap as extractMotifs, aq as functionOf, ar as isBorrowedChord, as as isDiatonic, at as isMinorKey, au as keyTimelineFromNotes, av as melodicContour, aw as motifFromNotes, ax as motifGraph, ay as pivotChords, az as prevailingKeyOf, aA as reduceProgression, aB as relateMotifs, aC as romanToChord, aD as secondaryDominant, aE as secondaryDominantOf, aF as sectionsFromNotes, aG as toVoiceNotes } from '../types-Dh7C064C.js';
9
+ export { A as ArrangementAnalysis, a as ArrangementOptions, b as ArrangementSession, c as ArrangementTrack, d as AugmentedSixthKind, C as ChordMatch, e as Conflict, f as ConflictPartner, D as DetectChordOptions, g as DetectKeyOptions, H as Hypermeter, h as HypermeterOptions, K as KeyMatch, M as MODAL_SCALE_NAMES, i as ModalCandidate, j as ModalScaleName, P as Phrase, k as PhraseOptions, l as PhraseSignal, R as ReferenceProfileOptions, S as StructuralCadence, T as TensionPoint, m as TrackAnalysis, n as TrackEdit, o as TrackRole, p as analyzeArrangement, q as analyzePolyphony, r as analyzeReference, s as augmentedSixthChord, t as augmentedSixthFromPitchClasses, u as augmentedSixthKind, v as createArrangementSession, w as detectChord, x as detectChordBest, y as detectKey, z as detectKeyBest, B as detectKeyFromNotes, E as hypermeter, F as phrasesFromTimeline, G as spellAugmentedSixth, I as structuralCadences, J as tensionCurve, L as tensionCurveFrom } from '../profile-DLdlIpS9.js';
11
10
 
12
11
  /**
13
12
  * How alike two phrases are, when they stand in no named relation.
@@ -95,6 +94,153 @@ declare function compareMelodies(a: MelodicPhrase, b: MelodicPhrase): MelodicCom
95
94
  */
96
95
  declare function melodicSimilarity(a: MelodicPhrase, b: MelodicPhrase): number;
97
96
 
97
+ /**
98
+ * Comparing two {@link ReferenceProfile}s dimension by dimension.
99
+ *
100
+ * The answer is never folded into one number: each field names the aspect it
101
+ * measures, so "a different song built the same way" reads as high structural
102
+ * fields beside a low surface one. Only `melody.surfaceSimilarity` reads the
103
+ * motifs' intervals; every other field is invariant under transposition, tempo
104
+ * and a change of motif intervals.
105
+ */
106
+
107
+ /**
108
+ * Options for {@link compareReferences}.
109
+ *
110
+ * @category Arrangement & Analysis
111
+ */
112
+ type ReferenceComparisonOptions = {
113
+ /**
114
+ * Upper bound on the cells of the progression alignment.
115
+ *
116
+ * @defaultValue {@link DEFAULT_GENERATION_BUDGET}
117
+ */
118
+ budget?: number;
119
+ };
120
+ /**
121
+ * How alike two profiled pieces are, one field per aspect.
122
+ *
123
+ * Every value is in [0, 1] and symmetric in the two profiles. A value is
124
+ * `null` when neither profile has anything to measure it on, and 0 when only
125
+ * one does.
126
+ *
127
+ * @category Arrangement & Analysis
128
+ */
129
+ type ReferenceComparison = {
130
+ /** Formal layout. */
131
+ form: {
132
+ /** Likeness of the section-label sequences. */
133
+ sectionSequenceSimilarity: number | null;
134
+ /** Likeness of the phrase-length sequences. */
135
+ phraseLengthSimilarity: number | null;
136
+ };
137
+ /** Harmony. */
138
+ harmony: {
139
+ /** Likeness of the structural Roman-numeral progressions. */
140
+ progressionSimilarity: number | null;
141
+ /** Likeness of how long each harmonic function is held. */
142
+ functionSimilarity: number | null;
143
+ /** Likeness of the phrase-by-phrase cadence sequences. */
144
+ cadenceSimilarity: number | null;
145
+ /** Likeness of the key plans, read relative to each piece's first key. */
146
+ keyPlanSimilarity: number | null;
147
+ /** Likeness of where in the bar the chords change. */
148
+ harmonicRhythmOnsetSimilarity: number | null;
149
+ /** Likeness of how often the chords change. */
150
+ harmonicRhythmDensitySimilarity: number | null;
151
+ };
152
+ /** Melody. */
153
+ melody: {
154
+ /** Likeness of the motifs' interval content: the one field that reads the surface. */
155
+ surfaceSimilarity: number | null;
156
+ /** Likeness of how the motifs derive from one another. */
157
+ motifStructureSimilarity: number | null;
158
+ /** Likeness of the phrases' melodic outlines, each scaled by its own range. */
159
+ contourSimilarity: number | null;
160
+ /** Likeness of the phrases' registers, each relative to its piece's melodic mean. */
161
+ registerSimilarity: number | null;
162
+ };
163
+ /** Melodic rhythm. */
164
+ rhythm: {
165
+ /** Likeness of where in the bar the melody's onsets fall. */
166
+ onsetSimilarity: number | null;
167
+ /** Likeness of the melodies' onsets per bar. */
168
+ densitySimilarity: number | null;
169
+ /** Likeness of the melodies' inter-onset-interval distributions. */
170
+ durationSimilarity: number | null;
171
+ /** Likeness of the melodies' syncopation. */
172
+ syncopationSimilarity: number | null;
173
+ };
174
+ /** The two most and the two least alike fields, by name. */
175
+ rationale: string;
176
+ };
177
+ /**
178
+ * Compare two profiled pieces aspect by aspect: form, harmony, melody and
179
+ * melodic rhythm.
180
+ *
181
+ * Sequences — sections, phrase lengths, cadences, key plans, structural
182
+ * chords, phrase contours and registers — are aligned by a graded edit
183
+ * distance; distributions — harmonic function, onset placement, inter-onset
184
+ * intervals, motif derivations — by histogram intersection. The surface field
185
+ * compares the motifs' interval cells, so a transposition of the same piece
186
+ * reads 1 on every field. No aggregate is returned: which aspects agree is the
187
+ * answer.
188
+ *
189
+ * @param a The first profile.
190
+ * @param b The second profile.
191
+ * @param opts The work budget.
192
+ * @returns One likeness per aspect, and a rationale naming the extremes.
193
+ * @throws {InvalidInputError} If either profile or the options cannot be read.
194
+ * @throws {BudgetExceededError} If the progression alignment would exceed the budget.
195
+ * @category Arrangement & Analysis
196
+ */
197
+ declare function compareReferences(a: ReferenceProfile, b: ReferenceProfile, opts?: ReferenceComparisonOptions): ReferenceComparison;
198
+
199
+ /**
200
+ * Boundary validation for {@link ReferenceProfile}: a caller can hand this a
201
+ * value restored from JSON, a config file, or a plugin host, and every field
202
+ * is checked before anything downstream reads it. A violation names the path
203
+ * to the offending field, so a malformed document is diagnosed at the field
204
+ * that is wrong rather than wherever the first bad read happens to land.
205
+ */
206
+
207
+ /**
208
+ * Reject a value that is not a {@link ReferenceProfile}.
209
+ *
210
+ * A profile is the shape a caller's stored JSON, a config file, or a plugin
211
+ * host most plausibly hands back malformed: a missing field, a distribution
212
+ * that no longer sums to 1, an index a later edit left dangling, a numeral no
213
+ * reader can parse. Every field is checked before {@link compareReferences} or
214
+ * a caller's own code reads it, and a violation names the path to the field
215
+ * that is wrong.
216
+ *
217
+ * @param value The value to check.
218
+ * @param name What the value is, for the error message.
219
+ * @returns The same profile.
220
+ * @throws {InvalidInputError} If the value is not a valid reference profile.
221
+ * @example
222
+ * ```ts
223
+ * import { assertReferenceProfile } from '@libraz/libcantus';
224
+ * const emptyRhythm = {
225
+ * startBeat: 0, endBeat: 0, bars: 0, onsets: 0, onsetDensity: 0,
226
+ * barOnsets: [], onsetLevels: [0, 0, 0, 0, 0, 0], barPositions: [],
227
+ * interOnsetShares: new Array(17).fill(0), restRatio: 0, syncopation: 0,
228
+ * offGridRatio: 0, rationale: 'nothing sounds',
229
+ * };
230
+ * const profile = {
231
+ * profileVersion: 1,
232
+ * span: { startBeat: 0, endBeat: 0, bars: 0 },
233
+ * meters: [{ startBeat: 0, ts: { numerator: 4, denominator: 4 } }],
234
+ * form: { hypermeter: { groupBars: 1, confidence: 0 }, sections: [], phrases: [] },
235
+ * harmony: { keys: [], chords: [], rhythm: emptyRhythm },
236
+ * melody: { register: null, shape: null, motifs: [], graph: { nodes: [], edges: [] }, rhythm: emptyRhythm },
237
+ * };
238
+ * assertReferenceProfile(profile); // the profile, unchanged
239
+ * ```
240
+ * @category Arrangement & Analysis
241
+ */
242
+ declare function assertReferenceProfile(value: unknown, name?: string): ReferenceProfile;
243
+
98
244
  /**
99
245
  * Line spelling: name every note of a melodic line in one pass.
100
246
  *
@@ -190,4 +336,4 @@ type SpellLineOptions = {
190
336
  */
191
337
  declare function spellLine(notes: readonly NoteEvent[], timeline: ChordTimeline | null, key: SpelledKeyLike, opts?: SpellLineOptions): Note[];
192
338
 
193
- export { ChordTimeline, type MelodicComparison, MelodicPhrase, Note as NoteData, NoteEvent, NoteLike, type SpellLineOptions, SpelledKeyLike, compareMelodies, melodicSimilarity, spellLine };
339
+ export { ChordTimeline, type MelodicComparison, MelodicPhrase, Note as NoteData, NoteEvent, NoteLike, type ReferenceComparison, type ReferenceComparisonOptions, ReferenceProfile, type SpellLineOptions, SpelledKeyLike, assertReferenceProfile, compareMelodies, compareReferences, melodicSimilarity, spellLine };
@@ -1,29 +1,33 @@
1
1
  import {
2
2
  spellLine
3
- } from "../chunk-57WB2EDF.js";
3
+ } from "../chunk-ZBUROTJQ.js";
4
4
  import {
5
5
  analyzeArrangement,
6
6
  analyzePolyphony,
7
- compareMelodies,
7
+ analyzeReference,
8
+ compareReferences,
8
9
  createArrangementSession,
9
- extractMotifs,
10
10
  hypermeter,
11
- melodicContour,
12
- melodicSimilarity,
13
- motifFromNotes,
14
11
  phrasesFromTimeline,
15
- reduceProgression,
16
- relateMotifs,
17
12
  sectionsFromNotes,
18
13
  structuralCadences,
19
14
  tensionCurve,
20
15
  tensionCurveFrom
21
- } from "../chunk-HSY2VQXZ.js";
16
+ } from "../chunk-MLBPXA4Z.js";
22
17
  import {
18
+ CADENCE_TYPES,
19
+ HARMONIC_FUNCTIONS,
20
+ MELODIC_CONTOUR_SHAPES,
23
21
  MODAL_SCALE_NAMES,
22
+ MOTIF_RELATION_KINDS,
23
+ REDUCTION_LEVELS,
24
+ REFERENCE_PROFILE_VERSION,
25
+ RHYTHM_IOI_BINS,
24
26
  analyzeChord,
27
+ analyzeRhythm,
25
28
  analyzeVoice,
26
29
  assertChordTimeline,
30
+ assertReferenceProfile,
27
31
  augmentedSixthChord,
28
32
  augmentedSixthFromPitchClasses,
29
33
  augmentedSixthKind,
@@ -31,6 +35,7 @@ import {
31
35
  chordTimelineFromChords,
32
36
  chordTimelineFromNotes,
33
37
  chordToRoman,
38
+ compareMelodies,
34
39
  detectCadence,
35
40
  detectCadences,
36
41
  detectChord,
@@ -40,32 +45,49 @@ import {
40
45
  detectKeyFromNotes,
41
46
  detectModulations,
42
47
  explainRoman,
48
+ extractMotifs,
43
49
  functionOf,
44
50
  isBorrowedChord,
45
51
  isDiatonic,
46
52
  isMinorKey,
47
53
  keyTimelineFromNotes,
54
+ melodicContour,
55
+ melodicSimilarity,
56
+ motifFromNotes,
57
+ motifGraph,
48
58
  pivotChords,
49
59
  prevailingKeyOf,
60
+ reduceProgression,
61
+ relateMotifs,
50
62
  romanToChord,
51
63
  secondaryDominant,
52
64
  secondaryDominantOf,
53
65
  spellAugmentedSixth,
54
66
  toVoiceNotes
55
- } from "../chunk-VLE5R7PF.js";
56
- import "../chunk-7GOKQJTQ.js";
67
+ } from "../chunk-GNVN4PPJ.js";
68
+ import "../chunk-PUKJP2Z5.js";
57
69
  import {
58
70
  NoteSafety
59
- } from "../chunk-FPBZFNCD.js";
60
- import "../chunk-PQL7E5F6.js";
71
+ } from "../chunk-RFIBF2RR.js";
72
+ import "../chunk-AGOVW7U6.js";
61
73
  export {
74
+ CADENCE_TYPES,
75
+ HARMONIC_FUNCTIONS,
76
+ MELODIC_CONTOUR_SHAPES,
62
77
  MODAL_SCALE_NAMES,
78
+ MOTIF_RELATION_KINDS,
63
79
  NoteSafety,
80
+ REDUCTION_LEVELS,
81
+ REFERENCE_PROFILE_VERSION,
82
+ RHYTHM_IOI_BINS,
64
83
  analyzeArrangement,
65
84
  analyzeChord,
66
85
  analyzePolyphony,
86
+ analyzeReference,
87
+ analyzeRhythm,
67
88
  analyzeVoice,
68
89
  assertChordTimeline,
90
+ assertReferenceProfile,
69
91
  augmentedSixthChord,
70
92
  augmentedSixthFromPitchClasses,
71
93
  augmentedSixthKind,
@@ -74,6 +96,7 @@ export {
74
96
  chordTimelineFromNotes,
75
97
  chordToRoman,
76
98
  compareMelodies,
99
+ compareReferences,
77
100
  createArrangementSession,
78
101
  detectCadence,
79
102
  detectCadences,
@@ -94,6 +117,7 @@ export {
94
117
  melodicContour,
95
118
  melodicSimilarity,
96
119
  motifFromNotes,
120
+ motifGraph,
97
121
  phrasesFromTimeline,
98
122
  pivotChords,
99
123
  prevailingKeyOf,