@libraz/libcantus 0.9.2 → 0.9.4

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 (200) hide show
  1. package/README.md +6 -5
  2. package/dist/analyze/index.cjs +41 -1676
  3. package/dist/analyze/index.cjs.map +1 -1
  4. package/dist/analyze/index.d.cts +194 -122
  5. package/dist/analyze/index.d.ts +194 -122
  6. package/dist/analyze/index.js +19 -8
  7. package/dist/chunk-36N73KZ3.cjs +246 -0
  8. package/dist/chunk-36N73KZ3.cjs.map +1 -0
  9. package/dist/chunk-4HLLZPXT.cjs +3077 -0
  10. package/dist/chunk-4HLLZPXT.cjs.map +1 -0
  11. package/dist/chunk-7MGZ7D62.cjs +498 -0
  12. package/dist/chunk-7MGZ7D62.cjs.map +1 -0
  13. package/dist/{chunk-R3S2LUBH.js → chunk-7NKDPF74.js} +660 -305
  14. package/dist/chunk-7NKDPF74.js.map +1 -0
  15. package/dist/chunk-CAN76NCU.cjs +679 -0
  16. package/dist/chunk-CAN76NCU.cjs.map +1 -0
  17. package/dist/{chunk-7Y7WF64D.js → chunk-D2FAJBYL.js} +104 -35
  18. package/dist/chunk-D2FAJBYL.js.map +1 -0
  19. package/dist/{chunk-COKTX2G5.js → chunk-EHVEBWM5.js} +1052 -510
  20. package/dist/chunk-EHVEBWM5.js.map +1 -0
  21. package/dist/chunk-FCANXBAT.cjs +30 -0
  22. package/dist/chunk-FCANXBAT.cjs.map +1 -0
  23. package/dist/chunk-FNDWXRRI.cjs +479 -0
  24. package/dist/chunk-FNDWXRRI.cjs.map +1 -0
  25. package/dist/{chunk-GQKN5KDT.js → chunk-GQSGS2N4.js} +43 -29
  26. package/dist/chunk-GQSGS2N4.js.map +1 -0
  27. package/dist/chunk-HKGYCQ34.js +53 -0
  28. package/dist/chunk-HKGYCQ34.js.map +1 -0
  29. package/dist/chunk-I24MV65U.js +106 -0
  30. package/dist/chunk-I24MV65U.js.map +1 -0
  31. package/dist/{chunk-LN7ZZMD2.js → chunk-KMHOICIY.js} +322 -173
  32. package/dist/chunk-KMHOICIY.js.map +1 -0
  33. package/dist/chunk-LW53AHQU.cjs +1117 -0
  34. package/dist/chunk-LW53AHQU.cjs.map +1 -0
  35. package/dist/chunk-N6IHQUOX.js +1 -0
  36. package/dist/chunk-N6IHQUOX.js.map +1 -0
  37. package/dist/chunk-NKIBQ6PT.js +30 -0
  38. package/dist/chunk-NKIBQ6PT.js.map +1 -0
  39. package/dist/chunk-NP4NA2FB.cjs +106 -0
  40. package/dist/chunk-NP4NA2FB.cjs.map +1 -0
  41. package/dist/chunk-NVE34YGZ.cjs +1449 -0
  42. package/dist/chunk-NVE34YGZ.cjs.map +1 -0
  43. package/dist/{chunk-A4532ZFR.js → chunk-NYYWMV2C.js} +115 -47
  44. package/dist/chunk-NYYWMV2C.js.map +1 -0
  45. package/dist/{chunk-5HTNMQW4.js → chunk-Q2XUP227.js} +310 -118
  46. package/dist/chunk-Q2XUP227.js.map +1 -0
  47. package/dist/chunk-Q6OP4U43.cjs +327 -0
  48. package/dist/chunk-Q6OP4U43.cjs.map +1 -0
  49. package/dist/chunk-RC6GBMCD.cjs +845 -0
  50. package/dist/chunk-RC6GBMCD.cjs.map +1 -0
  51. package/dist/{chunk-XTC3X6MS.js → chunk-RK35RIN7.js} +453 -152
  52. package/dist/chunk-RK35RIN7.js.map +1 -0
  53. package/dist/chunk-RUMU3UA6.cjs +53 -0
  54. package/dist/chunk-RUMU3UA6.cjs.map +1 -0
  55. package/dist/chunk-T64C7ZD7.cjs +1 -0
  56. package/dist/chunk-T64C7ZD7.cjs.map +1 -0
  57. package/dist/chunk-XEBG3G53.js +498 -0
  58. package/dist/chunk-XEBG3G53.js.map +1 -0
  59. package/dist/chunk-YLEMGEFH.js +246 -0
  60. package/dist/chunk-YLEMGEFH.js.map +1 -0
  61. package/dist/chunk-ZEJR4TKL.cjs +173 -0
  62. package/dist/chunk-ZEJR4TKL.cjs.map +1 -0
  63. package/dist/core/index.cjs +130 -431
  64. package/dist/core/index.cjs.map +1 -1
  65. package/dist/core/index.d.cts +331 -17
  66. package/dist/core/index.d.ts +331 -17
  67. package/dist/core/index.js +71 -13
  68. package/dist/{function-2bJW1Zp_.d.ts → function-BtiZb9i9.d.ts} +28 -7
  69. package/dist/{function-r2sh-jOO.d.cts → function-DNugAOrt.d.cts} +28 -7
  70. package/dist/generate/index.cjs +30 -3751
  71. package/dist/generate/index.cjs.map +1 -1
  72. package/dist/generate/index.d.cts +373 -59
  73. package/dist/generate/index.d.ts +373 -59
  74. package/dist/generate/index.js +23 -9
  75. package/dist/{index-DZ1M21do.d.cts → index-6VR8-kit.d.ts} +20 -4
  76. package/dist/index-70p168VM.d.ts +192 -0
  77. package/dist/{index-D_ZTUNKp.d.cts → index-Be74mcon.d.cts} +18 -17
  78. package/dist/index-BtXT6UQ0.d.cts +192 -0
  79. package/dist/{index-BMPxwjwV.d.ts → index-C5UBbQ4G.d.ts} +18 -17
  80. package/dist/{index-BOBXBNwP.d.cts → index-C83mZI1P.d.ts} +93 -8
  81. package/dist/{index-BdeQ1r_p.d.cts → index-D6b6na69.d.cts} +14 -11
  82. package/dist/{index-Cl7mhOFM.d.cts → index-DXd9JikN.d.cts} +92 -10
  83. package/dist/{index-Cl7mhOFM.d.ts → index-DXd9JikN.d.ts} +92 -10
  84. package/dist/index-OG65ocOr.d.cts +272 -0
  85. package/dist/index-OG65ocOr.d.ts +272 -0
  86. package/dist/{index-BreoJRw0.d.ts → index-tJhkmQgE.d.cts} +20 -4
  87. package/dist/{index-CP3wAfEH.d.ts → index-tSQh-xwY.d.ts} +14 -11
  88. package/dist/{index-CM5W4rcm.d.ts → index-y_ak9_Hi.d.cts} +93 -8
  89. package/dist/index.cjs +419 -6848
  90. package/dist/index.cjs.map +1 -1
  91. package/dist/index.d.cts +14 -13
  92. package/dist/index.d.ts +14 -13
  93. package/dist/index.js +132 -27
  94. package/dist/model/index.cjs +8 -2423
  95. package/dist/model/index.cjs.map +1 -1
  96. package/dist/model/index.d.cts +433 -74
  97. package/dist/model/index.d.ts +433 -74
  98. package/dist/model/index.js +6 -7
  99. package/dist/styled-DIRkk9Uz.d.ts +506 -0
  100. package/dist/styled-DJbkJQfj.d.cts +506 -0
  101. package/dist/theory/index.cjs +172 -1676
  102. package/dist/theory/index.cjs.map +1 -1
  103. package/dist/theory/index.d.cts +151 -233
  104. package/dist/theory/index.d.ts +151 -233
  105. package/dist/theory/index.js +31 -7
  106. package/dist/{types-MGP29r3t.d.cts → types-BN6_Q9Kl.d.cts} +11 -2
  107. package/dist/{types-MGP29r3t.d.ts → types-BN6_Q9Kl.d.ts} +11 -2
  108. package/package.json +73 -24
  109. package/dist/chunk-5HTNMQW4.js.map +0 -1
  110. package/dist/chunk-7Y7WF64D.js.map +0 -1
  111. package/dist/chunk-A4532ZFR.js.map +0 -1
  112. package/dist/chunk-BHUT2S5G.js +0 -22
  113. package/dist/chunk-BHUT2S5G.js.map +0 -1
  114. package/dist/chunk-CCBLVAPK.js +0 -42
  115. package/dist/chunk-CCBLVAPK.js.map +0 -1
  116. package/dist/chunk-COKTX2G5.js.map +0 -1
  117. package/dist/chunk-DYWFNC4A.js +0 -152
  118. package/dist/chunk-DYWFNC4A.js.map +0 -1
  119. package/dist/chunk-GQKN5KDT.js.map +0 -1
  120. package/dist/chunk-LN7ZZMD2.js.map +0 -1
  121. package/dist/chunk-MSWFZF7J.js +0 -118
  122. package/dist/chunk-MSWFZF7J.js.map +0 -1
  123. package/dist/chunk-R3S2LUBH.js.map +0 -1
  124. package/dist/chunk-SDM3VJJ5.js +0 -41
  125. package/dist/chunk-SDM3VJJ5.js.map +0 -1
  126. package/dist/chunk-XTC3X6MS.js.map +0 -1
  127. package/dist/chunk-ZXW5YIWK.js +0 -55
  128. package/dist/chunk-ZXW5YIWK.js.map +0 -1
  129. package/dist/index-CGMZNCx6.d.cts +0 -140
  130. package/dist/index-CGMZNCx6.d.ts +0 -140
  131. package/dist/styled-BjXtOFNk.d.cts +0 -282
  132. package/dist/styled-D7BAx3S3.d.ts +0 -282
  133. package/src/analyze/arrange/index.ts +0 -21
  134. package/src/analyze/arrange/internal.ts +0 -125
  135. package/src/analyze/arrange/tension.ts +0 -187
  136. package/src/analyze/arrange/tracks.ts +0 -279
  137. package/src/analyze/detect/index.ts +0 -235
  138. package/src/analyze/functional/borrowed.ts +0 -84
  139. package/src/analyze/functional/cadence.ts +0 -66
  140. package/src/analyze/functional/function.ts +0 -184
  141. package/src/analyze/functional/index.ts +0 -23
  142. package/src/analyze/functional/internal.ts +0 -29
  143. package/src/analyze/functional/roman.ts +0 -393
  144. package/src/analyze/index.ts +0 -49
  145. package/src/analyze/timeline/index.ts +0 -415
  146. package/src/analyze/voice/index.ts +0 -330
  147. package/src/core/index.ts +0 -47
  148. package/src/core/interval/index.ts +0 -81
  149. package/src/core/meter/index.ts +0 -282
  150. package/src/core/pitch/index.ts +0 -311
  151. package/src/core/random/index.ts +0 -53
  152. package/src/core/tuning/index.ts +0 -156
  153. package/src/core/types.ts +0 -29
  154. package/src/generate/bass/index.ts +0 -350
  155. package/src/generate/countermelody/index.ts +0 -379
  156. package/src/generate/drums/beat.ts +0 -266
  157. package/src/generate/drums/euclid.ts +0 -58
  158. package/src/generate/drums/fills.ts +0 -356
  159. package/src/generate/drums/ghost.ts +0 -119
  160. package/src/generate/drums/hihat.ts +0 -285
  161. package/src/generate/drums/hit.ts +0 -31
  162. package/src/generate/drums/index.ts +0 -329
  163. package/src/generate/drums/internal.ts +0 -257
  164. package/src/generate/drums/kick.ts +0 -160
  165. package/src/generate/drums/percussion.ts +0 -121
  166. package/src/generate/drums/rng.ts +0 -7
  167. package/src/generate/drums/swing.ts +0 -71
  168. package/src/generate/groove/index.ts +0 -326
  169. package/src/generate/harmonize/index.ts +0 -440
  170. package/src/generate/index.ts +0 -59
  171. package/src/generate/motif/index.ts +0 -398
  172. package/src/generate/progression/index.ts +0 -370
  173. package/src/generate/reharmony/index.ts +0 -330
  174. package/src/generate/rhythm/index.ts +0 -165
  175. package/src/index.ts +0 -247
  176. package/src/model/chord.ts +0 -423
  177. package/src/model/index.ts +0 -15
  178. package/src/model/interval.ts +0 -82
  179. package/src/model/key.ts +0 -266
  180. package/src/model/note.ts +0 -176
  181. package/src/model/progression.ts +0 -161
  182. package/src/model/shared.ts +0 -12
  183. package/src/theory/chord/index.ts +0 -373
  184. package/src/theory/chordscale/index.ts +0 -374
  185. package/src/theory/counterpoint/index.ts +0 -230
  186. package/src/theory/harmony/index.ts +0 -92
  187. package/src/theory/index.ts +0 -107
  188. package/src/theory/safety/index.ts +0 -419
  189. package/src/theory/scale/degrees.ts +0 -123
  190. package/src/theory/scale/index.ts +0 -28
  191. package/src/theory/scale/key.ts +0 -56
  192. package/src/theory/scale/masks.ts +0 -153
  193. package/src/theory/spelling/index.ts +0 -182
  194. package/src/theory/symbol/index.ts +0 -268
  195. package/src/theory/voicing/index.ts +0 -5
  196. package/src/theory/voicing/internal.ts +0 -168
  197. package/src/theory/voicing/leading.ts +0 -112
  198. package/src/theory/voicing/satb.ts +0 -195
  199. package/src/theory/voicing/styled.ts +0 -176
  200. package/tsconfig.json +0 -23
@@ -1,159 +1,11 @@
1
- import { C as Chord } from '../index-BOBXBNwP.cjs';
2
- export { a as ChordQuality, c as chordFromDegree, d as chordPitchClasses, e as chordQualities, f as chordToneRole, g as diatonicSeventh, h as diatonicTriad, m as makeChord } from '../index-BOBXBNwP.cjs';
3
- import { d as VoicingOptions } from '../styled-BjXtOFNk.cjs';
4
- export { C as ChordScaleMatch, a as ChordScaleReportEntry, S as SATB_RANGES, b as ScaleChoice, c as StyledVoicingOptions, V as VoiceRange, e as VoicingStyle, f as availableTensions, g as avoidNotes, h as chordScaleReport, i as chordScales, s as scaleMatchesChord, j as scalesForChanges, v as voiceChord, k as voiceChordStyled, l as voiceProgression } from '../styled-BjXtOFNk.cjs';
5
- import { K as KeyScale } from '../types-MGP29r3t.cjs';
6
- export { H as HarmonyRole, L as LockLevel, V as VoicedRole, r as roleOf } from '../index-BdeQ1r_p.cjs';
7
- export { N as NoteSafety, R as ReasonFlag, S as SafetyProfile, a as SafetyQuery, b as SafetyResult, V as VoiceSnapshot, e as enumerateSafePitches, c as evaluateSafety } from '../index-DZ1M21do.cjs';
8
- import { N as Note } from '../index-CGMZNCx6.cjs';
9
-
10
- /**
11
- * Total voice-leading cost between two voicings: the sum of absolute semitone
12
- * motion across voices, plus a moderate {@link HIDDEN_PERFECT_PENALTY} when the
13
- * outer-voice (bass–soprano) pair reaches a hidden/direct perfect fifth or
14
- * octave by similar motion. The arrays must be the same length; when they
15
- * differ the voicings are not comparable and the cost is `Infinity`.
16
- *
17
- * @param from The previous voicing, one MIDI pitch per voice.
18
- * @param to The next voicing, one MIDI pitch per voice.
19
- * @returns The summed absolute motion (plus any hidden-perfect penalty), or
20
- * `Infinity` when lengths differ.
21
- * @category Voicing & Counterpoint
22
- */
23
- declare function voiceLeadingCost(from: number[], to: number[]): number;
24
- /**
25
- * Voice a single chord to follow smoothly from an arbitrary current voicing.
26
- *
27
- * Candidate voicings of `chord` are enumerated within ranges taken from `opts`,
28
- * or — when neither `voices` nor `ranges` is given — from a one-octave window
29
- * around each pitch of `current` (so the result matches `current`'s voice
30
- * count). Each candidate is scored by structural quality, voice-leading motion
31
- * from `current`, and a large penalty per counterpoint violation; the lowest
32
- * scoring candidate is returned, ascending.
33
- *
34
- * @param current The current voicing to lead from, ascending (index 0 = lowest).
35
- * @param chord The next chord to voice.
36
- * @param opts Voicing options; when omitted, ranges follow `current`'s span.
37
- * @returns The chosen voicing, ascending with one MIDI pitch per voice.
38
- * @throws If no voicing fits the derived ranges.
39
- * @category Voicing & Counterpoint
40
- */
41
- declare function nextVoicing(current: number[], chord: Chord, opts?: VoicingOptions): number[];
42
-
43
- /**
44
- * Whether an upper voice has crossed below a lower voice.
45
- *
46
- * @param upperPitch Pitch of the nominally higher voice.
47
- * @param lowerPitch Pitch of the nominally lower voice.
48
- * @returns True when the upper voice sits below the lower voice.
49
- * @category Voicing & Counterpoint
50
- */
51
- declare function createsVoiceCrossing(upperPitch: number, lowerPitch: number): boolean;
52
- /**
53
- * Whether two simultaneous pitches form a dissonance.
54
- *
55
- * @param a First pitch.
56
- * @param b Second pitch.
57
- * @param twoVoice When true, the perfect fourth counts as dissonant.
58
- * @returns True when the vertical interval is dissonant.
59
- * @category Voicing & Counterpoint
60
- */
61
- declare function createsVerticalDissonance(a: number, b: number, twoVoice: boolean): boolean;
62
- /**
63
- * Whether a melodic move is a forbidden leap: a tritone, either seventh (minor
64
- * or major), or any leap wider than an octave.
65
- *
66
- * Operates on the raw absolute distance, so compound leaps are not reduced to
67
- * their simple class before the octave check.
68
- *
69
- * @param prev Starting pitch.
70
- * @param cur Ending pitch.
71
- * @returns True when the leap is forbidden in strict counterpoint.
72
- * @category Voicing & Counterpoint
73
- */
74
- declare function isForbiddenMelodicLeap(prev: number, cur: number): boolean;
75
- /**
76
- * Whether two voices move into consecutive perfect intervals of the same kind
77
- * (fifth-to-fifth, octave-to-octave, unison-to-unison).
78
- *
79
- * Both true parallels (similar motion) and anti-parallels — the same perfect
80
- * class reached by contrary motion, e.g. octave to octave with the voices moving
81
- * in opposite directions — are flagged, as both are forbidden in strict two-voice
82
- * counterpoint. The rule requires that both voices actually move: oblique motion
83
- * (either voice stationary) and the no-change case (identical pitches) are excluded.
84
- *
85
- * A fifth expanding to a twelfth counts (same perfect class); a fifth moving to
86
- * an octave does not (different perfect kinds — the direct/hidden case owned by
87
- * {@link createsHiddenParallelPerfect}).
88
- *
89
- * @category Voicing & Counterpoint
90
- */
91
- declare function createsParallelPerfect(aPrev: number, aCur: number, bPrev: number, bCur: number): boolean;
92
- /**
93
- * Whether two voices move in consecutive parallel octaves (or unisons) by
94
- * similar motion.
95
- *
96
- * This is a strict subset of {@link createsParallelPerfect}: a similar-motion
97
- * octave-to-octave is the perfect-class-zero case that predicate already flags
98
- * (and it additionally catches the contrary-motion anti-parallel). Callers that
99
- * tally parallel violations should therefore use {@link createsParallelPerfect}
100
- * alone to avoid double counting; this predicate remains for callers wanting a
101
- * dedicated similar-motion octave test.
102
- *
103
- * @category Voicing & Counterpoint
104
- */
105
- declare function createsParallelOctave(aPrev: number, aCur: number, bPrev: number, bCur: number): boolean;
106
- /**
107
- * Whether two voices move in consecutive parallel unisons — both landing on the
108
- * same pitch, having shared a pitch on the previous move.
109
- *
110
- * @category Voicing & Counterpoint
111
- */
112
- declare function createsParallelUnison(aPrev: number, aCur: number, bPrev: number, bCur: number): boolean;
113
- /**
114
- * Whether two voices reach a perfect interval by similar motion from an
115
- * imperfect one (a hidden/direct fifth or octave).
116
- *
117
- * The traditional step exception is applied: the approach is allowed when the
118
- * upper of the two voices moves by step, so only leaps into the perfect
119
- * interval are flagged.
120
- *
121
- * @category Voicing & Counterpoint
122
- */
123
- declare function createsHiddenParallelPerfect(aPrev: number, aCur: number, bPrev: number, bCur: number): boolean;
124
- /**
125
- * Whether two voices overlap: the upper voice descends below where the lower
126
- * voice just was, or the lower voice rises above where the upper voice just was.
127
- * Distinct from a simultaneous voice crossing.
128
- *
129
- * @param upperPrev Previous pitch of the upper voice.
130
- * @param upperCur Current pitch of the upper voice.
131
- * @param lowerPrev Previous pitch of the lower voice.
132
- * @param lowerCur Current pitch of the lower voice.
133
- * @category Voicing & Counterpoint
134
- */
135
- declare function createsVoiceOverlap(upperPrev: number, upperCur: number, lowerPrev: number, lowerCur: number): boolean;
136
- /**
137
- * Whether two adjacent upper voices are spaced more than a maximum apart
138
- * (commonly an octave). Bass-to-tenor spacing is conventionally exempt, so this
139
- * is meant for the upper voice pairs.
140
- *
141
- * @param upperPitch Pitch of the higher voice.
142
- * @param lowerPitch Pitch of the lower voice.
143
- * @param maxSemitones Maximum allowed spacing in semitones (default an octave).
144
- * @category Voicing & Counterpoint
145
- */
146
- declare function exceedsSpacing(upperPitch: number, lowerPitch: number, maxSemitones?: number): boolean;
147
- /**
148
- * Whether a leading tone resolves correctly upward to the tonic.
149
- *
150
- * @param prev The leading-tone pitch.
151
- * @param cur The following pitch.
152
- * @param key Key context supplying the tonic.
153
- * @returns True when `prev` is the leading tone and `cur` is the tonic a step above.
154
- * @category Voicing & Counterpoint
155
- */
156
- declare function isLeadingToneResolution(prev: number, cur: number, key: KeyScale): boolean;
1
+ import { N as Note } from '../index-OG65ocOr.cjs';
2
+ import { K as KeyScale } from '../types-BN6_Q9Kl.cjs';
3
+ import { C as Chord } from '../index-y_ak9_Hi.cjs';
4
+ export { a as ChordQuality, b as ChordSegment, c as ChordSpan, d as ChordToneRole, P as PitchSpelling, e as chordFromDegree, f as chordPitchClasses, g as chordQualities, h as chordToneRole, i as diatonicSeventh, j as diatonicTriad, k as intervalAboveRoot, l as isChordMember, m as makeChord, t as transposeChord } from '../index-y_ak9_Hi.cjs';
5
+ import { p as ScaleNameInput, r as VoicingOptions } from '../styled-DJbkJQfj.cjs';
6
+ export { A as ALTERED_MASK, B as BLUES_MASK, C as CHROMATIC_MASK, a as ChordScaleMatch, b as ChordScaleReportEntry, D as DORIAN_MASK, H as HARMONIC_MINOR_MASK, L as LOCRIAN_MASK, c as LOCRIAN_NATURAL2_MASK, d as LYDIAN_DOMINANT_MASK, e as LYDIAN_MASK, M as MAJOR_MASK, f as MAJOR_PENTATONIC_MASK, g as MELODIC_MINOR_MASK, h as MINOR_PENTATONIC_MASK, i as MIXOLYDIAN_B13_MASK, j as MIXOLYDIAN_MASK, N as NAMED_SCALES, k as NATURAL_MINOR_MASK, O as OCTATONIC_HALF_WHOLE_MASK, l as OCTATONIC_WHOLE_HALF_MASK, P as PHRYGIAN_DOMINANT_MASK, m as PHRYGIAN_MASK, S as SATB_RANGES, n as ScaleChoice, o as ScaleName, q as StyledVoicingOptions, V as VoiceRange, s as VoicingStyle, W as WHOLE_TONE_MASK, t as availableTensions, u as avoidNotes, v as chordScaleReport, w as chordScales, x as maskFromOffsets, y as namedScaleMask, z as requireScaleMask, E as scaleMatchesChord, F as scalesForChanges, G as voiceChord, I as voiceChordStyled, J as voiceProgression } from '../styled-DJbkJQfj.cjs';
7
+ export { H as HarmonyRole, L as LockLevel, V as VoicedRole, r as roleOf } from '../index-D6b6na69.cjs';
8
+ export { E as EvaluateSafetyOptions, N as NoteSafety, R as ReasonFlag, S as SafetyProfile, a as SafetyQuery, b as SafetyResult, V as VoiceSnapshot, e as enumerateSafePitches, c as evaluateSafety } from '../index-tJhkmQgE.cjs';
157
9
 
158
10
  /**
159
11
  * Test whether a pitch belongs to the scale.
@@ -258,119 +110,156 @@ declare function minorKey(rootPc: number): KeyScale;
258
110
  *
259
111
  * @category Scales
260
112
  */
261
- declare function scaleByName(name: string, rootPc: number): KeyScale;
113
+ declare function scaleByName(name: ScaleNameInput, rootPc: number): KeyScale;
262
114
 
263
115
  /**
264
- * Build a 12-bit mode mask from a list of semitone offsets above the root.
265
- *
266
- * Bit 0 (the root) is always set, enforcing the `KeyScale` invariant that the
267
- * root is a scale tone even when the offset list omits 0.
116
+ * Total voice-leading cost between two voicings: the sum of absolute semitone
117
+ * motion across voices, plus a moderate `HIDDEN_PERFECT_PENALTY` when the
118
+ * outer-voice (bass–soprano) pair reaches a hidden/direct perfect fifth or
119
+ * octave by similar motion. The arrays must be the same length; when they
120
+ * differ the voicings are not comparable and the cost is `Infinity`.
268
121
  *
269
- * @category Scales
122
+ * @param from The previous voicing, one MIDI pitch per voice.
123
+ * @param to The next voicing, one MIDI pitch per voice.
124
+ * @returns The summed absolute motion (plus any hidden-perfect penalty), or
125
+ * `Infinity` when lengths differ.
126
+ * @category Voicing & Counterpoint
270
127
  */
271
- declare function maskFromOffsets(offsets: readonly number[]): number;
128
+ declare function voiceLeadingCost(from: number[], to: number[]): number;
272
129
  /**
273
- * Mode mask for the major (Ionian) scale: offsets {0, 2, 4, 5, 7, 9, 11}.
130
+ * Voice a single chord to follow smoothly from an arbitrary current voicing.
274
131
  *
275
- * @category Scales
276
- */
277
- declare const MAJOR_MASK = 2741;
278
- /**
279
- * Mode mask for the natural minor (Aeolian) scale: offsets {0, 2, 3, 5, 7, 8, 10}.
132
+ * Candidate voicings of `chord` are enumerated within ranges taken from `opts`,
133
+ * or — when neither `voices` nor `ranges` is given — from a one-octave window
134
+ * around each pitch of `current` (so the result matches `current`'s voice
135
+ * count). Each candidate is scored by structural quality, voice-leading motion
136
+ * from `current`, and a large penalty per counterpoint violation; the lowest
137
+ * scoring candidate is returned, ascending.
280
138
  *
281
- * @category Scales
139
+ * @param current The current voicing to lead from, ascending (index 0 = lowest).
140
+ * @param chord The next chord to voice.
141
+ * @param opts Voicing options; when omitted, ranges follow `current`'s span.
142
+ * @returns The chosen voicing, ascending with one MIDI pitch per voice.
143
+ * @throws If `current` is empty or holds a non-finite pitch while the ranges
144
+ * are derived from it, or if no voicing fits the ranges.
145
+ * @category Voicing & Counterpoint
282
146
  */
283
- declare const NATURAL_MINOR_MASK = 1453;
147
+ declare function nextVoicing(current: number[], chord: Chord, opts?: VoicingOptions): number[];
148
+
284
149
  /**
285
- * Harmonic minor: natural minor with a raised seventh — offsets {0,2,3,5,7,8,11}.
150
+ * Whether an upper voice has crossed below a lower voice.
286
151
  *
287
- * @category Scales
152
+ * @param upperPitch Pitch of the nominally higher voice.
153
+ * @param lowerPitch Pitch of the nominally lower voice.
154
+ * @returns True when the upper voice sits below the lower voice.
155
+ * @category Voicing & Counterpoint
288
156
  */
289
- declare const HARMONIC_MINOR_MASK: number;
157
+ declare function createsVoiceCrossing(upperPitch: number, lowerPitch: number): boolean;
290
158
  /**
291
- * Ascending melodic minor: offsets {0,2,3,5,7,9,11}.
159
+ * Whether two simultaneous pitches form a dissonance.
292
160
  *
293
- * @category Scales
161
+ * @param a First pitch.
162
+ * @param b Second pitch.
163
+ * @param twoVoice When true, the perfect fourth counts as dissonant.
164
+ * @returns True when the vertical interval is dissonant.
165
+ * @category Voicing & Counterpoint
294
166
  */
295
- declare const MELODIC_MINOR_MASK: number;
167
+ declare function createsVerticalDissonance(a: number, b: number, twoVoice: boolean): boolean;
296
168
  /**
297
- * Dorian mode: offsets {0,2,3,5,7,9,10}.
169
+ * Whether a melodic move is a forbidden leap: a tritone, either seventh (minor
170
+ * or major), or any leap wider than an octave.
298
171
  *
299
- * @category Scales
300
- */
301
- declare const DORIAN_MASK: number;
302
- /**
303
- * Phrygian mode: offsets {0,1,3,5,7,8,10}.
172
+ * Operates on the raw absolute distance, so compound leaps are not reduced to
173
+ * their simple class before the octave check.
304
174
  *
305
- * @category Scales
175
+ * @param prev Starting pitch.
176
+ * @param cur Ending pitch.
177
+ * @returns True when the leap is forbidden in strict counterpoint.
178
+ * @category Voicing & Counterpoint
306
179
  */
307
- declare const PHRYGIAN_MASK: number;
180
+ declare function isForbiddenMelodicLeap(prev: number, cur: number): boolean;
308
181
  /**
309
- * Lydian mode: offsets {0,2,4,6,7,9,11}.
182
+ * Whether two voices move into consecutive perfect intervals of the same kind
183
+ * (fifth-to-fifth, octave-to-octave, unison-to-unison).
310
184
  *
311
- * @category Scales
312
- */
313
- declare const LYDIAN_MASK: number;
314
- /**
315
- * Mixolydian mode: offsets {0,2,4,5,7,9,10}.
185
+ * Both true parallels (similar motion) and anti-parallels — the same perfect
186
+ * class reached by contrary motion, e.g. octave to octave with the voices moving
187
+ * in opposite directions — are flagged, as both are forbidden in strict two-voice
188
+ * counterpoint. The rule requires that both voices actually move: oblique motion
189
+ * (either voice stationary) and the no-change case (identical pitches) are excluded.
316
190
  *
317
- * @category Scales
318
- */
319
- declare const MIXOLYDIAN_MASK: number;
320
- /**
321
- * Locrian mode: offsets {0,1,3,5,6,8,10}.
191
+ * A fifth expanding to a twelfth counts (same perfect class); a fifth moving to
192
+ * an octave does not (different perfect kinds — the direct/hidden case owned by
193
+ * {@link createsHiddenParallelPerfect}).
322
194
  *
323
- * @category Scales
195
+ * @category Voicing & Counterpoint
324
196
  */
325
- declare const LOCRIAN_MASK: number;
197
+ declare function createsParallelPerfect(aPrev: number, aCur: number, bPrev: number, bCur: number): boolean;
326
198
  /**
327
- * Major pentatonic: offsets {0,2,4,7,9}.
199
+ * Whether two voices move in consecutive parallel octaves (or unisons) by
200
+ * similar motion.
328
201
  *
329
- * @category Scales
330
- */
331
- declare const MAJOR_PENTATONIC_MASK: number;
332
- /**
333
- * Minor pentatonic: offsets {0,3,5,7,10}.
202
+ * This is a strict subset of {@link createsParallelPerfect}: a similar-motion
203
+ * octave-to-octave is the perfect-class-zero case that predicate already flags
204
+ * (and it additionally catches the contrary-motion anti-parallel). Callers that
205
+ * tally parallel violations should therefore use {@link createsParallelPerfect}
206
+ * alone to avoid double counting; this predicate remains for callers wanting a
207
+ * dedicated similar-motion octave test.
334
208
  *
335
- * @category Scales
209
+ * @category Voicing & Counterpoint
336
210
  */
337
- declare const MINOR_PENTATONIC_MASK: number;
211
+ declare function createsParallelOctave(aPrev: number, aCur: number, bPrev: number, bCur: number): boolean;
338
212
  /**
339
- * Hexatonic blues scale: minor pentatonic plus the flat-fifth — {0,3,5,6,7,10}.
213
+ * Whether two voices move in consecutive parallel unisons — both landing on the
214
+ * same pitch, having shared a pitch on the previous move.
340
215
  *
341
- * @category Scales
216
+ * @category Voicing & Counterpoint
342
217
  */
343
- declare const BLUES_MASK: number;
218
+ declare function createsParallelUnison(aPrev: number, aCur: number, bPrev: number, bCur: number): boolean;
344
219
  /**
345
- * Whole-tone scale: offsets {0,2,4,6,8,10}.
220
+ * Whether two voices reach a perfect interval by similar motion from an
221
+ * imperfect one (a hidden/direct fifth or octave).
346
222
  *
347
- * @category Scales
348
- */
349
- declare const WHOLE_TONE_MASK: number;
350
- /**
351
- * Octatonic (half-step first): offsets {0,1,3,4,6,7,9,10}.
223
+ * The traditional step exception is applied: the approach is allowed when the
224
+ * upper of the two voices moves by step, so only leaps into the perfect
225
+ * interval are flagged.
352
226
  *
353
- * @category Scales
227
+ * @category Voicing & Counterpoint
354
228
  */
355
- declare const OCTATONIC_HALF_WHOLE_MASK: number;
229
+ declare function createsHiddenParallelPerfect(aPrev: number, aCur: number, bPrev: number, bCur: number): boolean;
356
230
  /**
357
- * Octatonic (whole-step first): offsets {0,2,3,5,6,8,9,11}.
231
+ * Whether two voices overlap: the upper voice descends below where the lower
232
+ * voice just was, or the lower voice rises above where the upper voice just was.
233
+ * Distinct from a simultaneous voice crossing.
358
234
  *
359
- * @category Scales
235
+ * @param upperPrev Previous pitch of the upper voice.
236
+ * @param upperCur Current pitch of the upper voice.
237
+ * @param lowerPrev Previous pitch of the lower voice.
238
+ * @param lowerCur Current pitch of the lower voice.
239
+ * @category Voicing & Counterpoint
360
240
  */
361
- declare const OCTATONIC_WHOLE_HALF_MASK: number;
241
+ declare function createsVoiceOverlap(upperPrev: number, upperCur: number, lowerPrev: number, lowerCur: number): boolean;
362
242
  /**
363
- * Chromatic scale: all twelve pitch classes.
243
+ * Whether two adjacent upper voices are spaced more than a maximum apart
244
+ * (commonly an octave). Bass-to-tenor spacing is conventionally exempt, so this
245
+ * is meant for the upper voice pairs.
364
246
  *
365
- * @category Scales
247
+ * @param upperPitch Pitch of the higher voice.
248
+ * @param lowerPitch Pitch of the lower voice.
249
+ * @param maxSemitones Maximum allowed spacing in semitones (default an octave).
250
+ * @category Voicing & Counterpoint
366
251
  */
367
- declare const CHROMATIC_MASK = 4095;
252
+ declare function exceedsSpacing(upperPitch: number, lowerPitch: number, maxSemitones?: number): boolean;
368
253
  /**
369
- * Named scale masks addressable by {@link scaleByName}.
254
+ * Whether a leading tone resolves correctly upward to the tonic.
370
255
  *
371
- * @category Scales
256
+ * @param prev The leading-tone pitch.
257
+ * @param cur The following pitch.
258
+ * @param key Key context supplying the tonic.
259
+ * @returns True when `prev` is the leading tone and `cur` is the tonic a step above.
260
+ * @category Voicing & Counterpoint
372
261
  */
373
- declare const NAMED_SCALES: Record<string, number>;
262
+ declare function isLeadingToneResolution(prev: number, cur: number, key: KeyScale): boolean;
374
263
 
375
264
  /**
376
265
  * Spelling: derive letter-name notes for scales and chords from a spelled tonic.
@@ -384,10 +273,12 @@ declare const NAMED_SCALES: Record<string, number>;
384
273
  /**
385
274
  * Spell a single pitch class relative to a spelled tonic and key.
386
275
  *
387
- * Diatonic pitch classes take the scale's letter for their degree; the common
388
- * chromatic tones (b2, b3, #4, b6, b7) and a minor key's raised degrees (#6, #7)
389
- * take their conventional, key-correct accidental spelling; anything else falls
390
- * back to a sharp spelling of the nearest natural.
276
+ * The tonic always spells as itself. In a heptatonic key each scale degree takes
277
+ * the next letter above the tonic, so the scale spells with one letter per
278
+ * degree. Every other pitch class — a chromatic tone in a heptatonic key, or any
279
+ * tone of a scale that is not heptatonic (pentatonic, blues, octatonic) — takes
280
+ * the conventional interval spelling above the tonic's letter, so a flat-side
281
+ * key keeps flat-side names.
391
282
  *
392
283
  * @param pc The pitch class to spell.
393
284
  * @param tonic The spelled tonic (its letter anchors the spelling).
@@ -399,8 +290,9 @@ declare function spellPitchClass(pc: number, tonic: Note, key: KeyScale): Note;
399
290
  /**
400
291
  * Spell every pitch class of a scale, in ascending scale-degree order.
401
292
  *
402
- * Correct for heptatonic scales (each degree gets the next letter). Non-standard
403
- * scales are spelled tone-by-tone with a sharp preference.
293
+ * Correct for heptatonic scales (each degree gets the next letter). A scale that
294
+ * is not heptatonic is spelled tone by tone, on the accidental side the scale
295
+ * leans towards.
404
296
  *
405
297
  * @param tonic The spelled tonic.
406
298
  * @param key The key/scale.
@@ -424,6 +316,13 @@ declare function spellScale(tonic: Note, key: KeyScale): Note[];
424
316
  * @category Pitch & Intervals
425
317
  */
426
318
  declare function spellPitchClasses(pcs: number[], tonic: Note, key: KeyScale): Note[];
319
+ /**
320
+ * Spell chord tones from an already chosen root spelling.
321
+ *
322
+ * This is exported for the model layer's inversion support; the package
323
+ * barrels intentionally expose the key-aware {@link spellChord} entry point.
324
+ */
325
+ declare function spellChordFromRoot(chord: Chord, root: Note): Note[];
427
326
  /**
428
327
  * Spell a chord's tones, in the chord's own (tertian) order, relative to a key.
429
328
  *
@@ -446,6 +345,25 @@ declare function spellPitchClasses(pcs: number[], tonic: Note, key: KeyScale): N
446
345
  * @category Pitch & Intervals
447
346
  */
448
347
  declare function spellChord(chord: Chord, tonic: Note, key: KeyScale): Note[];
348
+ /**
349
+ * Spell a MIDI pitch relative to a key, keeping its octave.
350
+ *
351
+ * The octave-less sibling of this function, {@link spellPitchClass}, is enough
352
+ * for chord and scale spelling; this one is for naming actual sounding pitches
353
+ * (a generated line, an imported track) without losing the register.
354
+ *
355
+ * @param pitch The MIDI pitch; rounded to the nearest integer.
356
+ * @param tonic The spelled tonic of the key.
357
+ * @param key The key/scale.
358
+ * @returns The spelled note, carrying the octave that reproduces `pitch`.
359
+ * @example
360
+ * ```ts
361
+ * import { spellPitch, formatNote, parseNote, majorKey } from '@libraz/libcantus';
362
+ * formatNote(spellPitch(70, parseNote('Eb'), majorKey(3))); // 'Bb4'
363
+ * ```
364
+ * @category Pitch & Intervals
365
+ */
366
+ declare function spellPitch(pitch: number, tonic: Note, key: KeyScale): Note;
449
367
  /**
450
368
  * Convenience: render spelled notes as letter-name strings.
451
369
  *
@@ -532,4 +450,4 @@ declare function transposeChordSymbol(text: string, semitones: number, opts?: {
532
450
  flats?: boolean;
533
451
  }): string;
534
452
 
535
- export { BLUES_MASK, CHROMATIC_MASK, Chord as ChordData, DORIAN_MASK, HARMONIC_MINOR_MASK, LOCRIAN_MASK, LYDIAN_MASK, MAJOR_MASK, MAJOR_PENTATONIC_MASK, MELODIC_MINOR_MASK, MINOR_PENTATONIC_MASK, MIXOLYDIAN_MASK, NAMED_SCALES, NATURAL_MINOR_MASK, OCTATONIC_HALF_WHOLE_MASK, OCTATONIC_WHOLE_HALF_MASK, PHRYGIAN_MASK, VoicingOptions, WHOLE_TONE_MASK, createsHiddenParallelPerfect, createsParallelOctave, createsParallelPerfect, createsParallelUnison, createsVerticalDissonance, createsVoiceCrossing, createsVoiceOverlap, diatonicPitchClasses, exceedsSpacing, formatChordSymbol, isForbiddenMelodicLeap, isLeadingToneResolution, isScaleTone, majorKey, maskFromOffsets, minorKey, nearestScaleTone, nextVoicing, noteNames, parseChordSymbol, pitchToScaleDegree, scaleByName, scaleTonesInDegreeOrder, spellChord, spellPitchClass, spellPitchClasses, spellScale, transposeChordSymbol, voiceLeadingCost };
453
+ export { Chord as ChordData, KeyScale, Note as NoteData, ScaleNameInput, VoicingOptions, createsHiddenParallelPerfect, createsParallelOctave, createsParallelPerfect, createsParallelUnison, createsVerticalDissonance, createsVoiceCrossing, createsVoiceOverlap, diatonicPitchClasses, exceedsSpacing, formatChordSymbol, isForbiddenMelodicLeap, isLeadingToneResolution, isScaleTone, majorKey, minorKey, nearestScaleTone, nextVoicing, noteNames, parseChordSymbol, pitchToScaleDegree, scaleByName, scaleTonesInDegreeOrder, spellChord, spellChordFromRoot, spellPitch, spellPitchClass, spellPitchClasses, spellScale, transposeChordSymbol, voiceLeadingCost };