@libraz/libcantus 0.9.5 → 1.0.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 (185) hide show
  1. package/README.md +61 -270
  2. package/README_ja.md +61 -214
  3. package/dist/analyze/index.cjs +54 -7
  4. package/dist/analyze/index.cjs.map +1 -1
  5. package/dist/analyze/index.d.cts +200 -353
  6. package/dist/analyze/index.d.ts +200 -353
  7. package/dist/analyze/index.js +56 -9
  8. package/dist/chunk-3JXCW6DX.cjs +3220 -0
  9. package/dist/chunk-3JXCW6DX.cjs.map +1 -0
  10. package/dist/chunk-4A2RMUCC.js +7647 -0
  11. package/dist/chunk-4A2RMUCC.js.map +1 -0
  12. package/dist/chunk-6XPTBE7Y.cjs +49 -0
  13. package/dist/chunk-6XPTBE7Y.cjs.map +1 -0
  14. package/dist/chunk-AFM2ULJH.cjs +5121 -0
  15. package/dist/chunk-AFM2ULJH.cjs.map +1 -0
  16. package/dist/chunk-E3F4AHAH.cjs +690 -0
  17. package/dist/chunk-E3F4AHAH.cjs.map +1 -0
  18. package/dist/{chunk-2PTFGVD7.js → chunk-ELCTZUJJ.js} +250 -132
  19. package/dist/chunk-ELCTZUJJ.js.map +1 -0
  20. package/dist/chunk-FVSI36UV.js +690 -0
  21. package/dist/chunk-FVSI36UV.js.map +1 -0
  22. package/dist/chunk-GEDTJHAC.cjs +1 -0
  23. package/dist/chunk-GEDTJHAC.cjs.map +1 -0
  24. package/dist/chunk-GOZG57ER.js +3220 -0
  25. package/dist/chunk-GOZG57ER.js.map +1 -0
  26. package/dist/chunk-H3VORETI.js +2243 -0
  27. package/dist/chunk-H3VORETI.js.map +1 -0
  28. package/dist/chunk-H42UHPYW.js +1577 -0
  29. package/dist/chunk-H42UHPYW.js.map +1 -0
  30. package/dist/chunk-HFPS7JFD.js +1 -0
  31. package/dist/chunk-INHVXP6Z.js +3053 -0
  32. package/dist/chunk-INHVXP6Z.js.map +1 -0
  33. package/dist/chunk-K4ZJUGF4.cjs +379 -0
  34. package/dist/chunk-K4ZJUGF4.cjs.map +1 -0
  35. package/dist/chunk-KNJEKLKV.js +49 -0
  36. package/dist/chunk-KNJEKLKV.js.map +1 -0
  37. package/dist/chunk-M4CWTJWJ.cjs +7647 -0
  38. package/dist/chunk-M4CWTJWJ.cjs.map +1 -0
  39. package/dist/chunk-MXO72PLY.cjs +211 -0
  40. package/dist/chunk-MXO72PLY.cjs.map +1 -0
  41. package/dist/chunk-NLEU4QSE.cjs +360 -0
  42. package/dist/chunk-NLEU4QSE.cjs.map +1 -0
  43. package/dist/chunk-OE6WK2Y2.cjs +1577 -0
  44. package/dist/chunk-OE6WK2Y2.cjs.map +1 -0
  45. package/dist/chunk-Q2WGKJNN.cjs +1064 -0
  46. package/dist/chunk-Q2WGKJNN.cjs.map +1 -0
  47. package/dist/chunk-QYQQ5J6E.js +1 -0
  48. package/dist/chunk-QYQQ5J6E.js.map +1 -0
  49. package/dist/chunk-RHIJ3S4I.cjs +1 -0
  50. package/dist/chunk-RHIJ3S4I.cjs.map +1 -0
  51. package/dist/chunk-TTCLJX6D.js +211 -0
  52. package/dist/chunk-TTCLJX6D.js.map +1 -0
  53. package/dist/chunk-UADYAYAT.cjs +3053 -0
  54. package/dist/chunk-UADYAYAT.cjs.map +1 -0
  55. package/dist/chunk-VOHZB45S.js +5121 -0
  56. package/dist/chunk-VOHZB45S.js.map +1 -0
  57. package/dist/chunk-VTI6FOLB.js +1064 -0
  58. package/dist/chunk-VTI6FOLB.js.map +1 -0
  59. package/dist/chunk-WWURE4XT.cjs +2243 -0
  60. package/dist/chunk-WWURE4XT.cjs.map +1 -0
  61. package/dist/chunk-YH3BIKHH.js +360 -0
  62. package/dist/chunk-YH3BIKHH.js.map +1 -0
  63. package/dist/core/index.cjs +93 -6
  64. package/dist/core/index.cjs.map +1 -1
  65. package/dist/core/index.d.cts +87 -346
  66. package/dist/core/index.d.ts +87 -346
  67. package/dist/core/index.js +94 -7
  68. package/dist/generate/index.cjs +89 -10
  69. package/dist/generate/index.cjs.map +1 -1
  70. package/dist/generate/index.d.cts +436 -1094
  71. package/dist/generate/index.d.ts +436 -1094
  72. package/dist/generate/index.js +94 -15
  73. package/dist/index-9wcMhG73.d.ts +1095 -0
  74. package/dist/{index-Cfx8xgH0.d.ts → index-B4o55NDr.d.cts} +13 -9
  75. package/dist/index-B9MNZboQ.d.cts +770 -0
  76. package/dist/index-B9MNZboQ.d.ts +770 -0
  77. package/dist/index-BGFW-8P2.d.cts +2307 -0
  78. package/dist/index-BO6xE9YU.d.cts +1804 -0
  79. package/dist/index-BkGmlyI3.d.cts +470 -0
  80. package/dist/index-CCNJRG-P.d.cts +1095 -0
  81. package/dist/index-CGpRv5sl.d.cts +643 -0
  82. package/dist/index-C_8o--VE.d.cts +1242 -0
  83. package/dist/index-CgHqxdps.d.ts +2307 -0
  84. package/dist/index-Chbst3Jx.d.ts +1343 -0
  85. package/dist/index-Cj49F892.d.ts +470 -0
  86. package/dist/{index-x2vcsduE.d.cts → index-CunYKLiu.d.ts} +13 -9
  87. package/dist/index-D57QRbVn.d.ts +1804 -0
  88. package/dist/index-DInQqT8Q.d.cts +66 -0
  89. package/dist/index-DInQqT8Q.d.ts +66 -0
  90. package/dist/index-Dzr13q3d.d.cts +1343 -0
  91. package/dist/index-G1uwGGWQ.d.ts +643 -0
  92. package/dist/index-szBv3496.d.ts +1242 -0
  93. package/dist/index.cjs +348 -15
  94. package/dist/index.cjs.map +1 -1
  95. package/dist/index.d.cts +17 -15
  96. package/dist/index.d.ts +17 -15
  97. package/dist/index.js +397 -64
  98. package/dist/masks-DYbE485J.d.cts +445 -0
  99. package/dist/masks-DYbE485J.d.ts +445 -0
  100. package/dist/model/index.cjs +39 -7
  101. package/dist/model/index.cjs.map +1 -1
  102. package/dist/model/index.d.cts +4659 -249
  103. package/dist/model/index.d.ts +4659 -249
  104. package/dist/model/index.js +40 -8
  105. package/dist/positional-Cptlj-xs.d.ts +287 -0
  106. package/dist/positional-DvH_sd8u.d.cts +287 -0
  107. package/dist/theory/index.cjs +101 -7
  108. package/dist/theory/index.cjs.map +1 -1
  109. package/dist/theory/index.d.cts +511 -171
  110. package/dist/theory/index.d.ts +511 -171
  111. package/dist/theory/index.js +118 -24
  112. package/package.json +6 -4
  113. package/dist/chunk-2A2QMA74.cjs +0 -261
  114. package/dist/chunk-2A2QMA74.cjs.map +0 -1
  115. package/dist/chunk-2PTFGVD7.js.map +0 -1
  116. package/dist/chunk-357ZDPVU.cjs +0 -162
  117. package/dist/chunk-357ZDPVU.cjs.map +0 -1
  118. package/dist/chunk-3KX76RLG.js +0 -1548
  119. package/dist/chunk-3KX76RLG.js.map +0 -1
  120. package/dist/chunk-4VZ5MZAM.cjs +0 -889
  121. package/dist/chunk-4VZ5MZAM.cjs.map +0 -1
  122. package/dist/chunk-7EONYVI5.js +0 -1204
  123. package/dist/chunk-7EONYVI5.js.map +0 -1
  124. package/dist/chunk-7JEP3MFY.js +0 -162
  125. package/dist/chunk-7JEP3MFY.js.map +0 -1
  126. package/dist/chunk-AID75RN3.js +0 -3176
  127. package/dist/chunk-AID75RN3.js.map +0 -1
  128. package/dist/chunk-BSLTLGM3.cjs +0 -497
  129. package/dist/chunk-BSLTLGM3.cjs.map +0 -1
  130. package/dist/chunk-CU6VG2YM.cjs +0 -109
  131. package/dist/chunk-CU6VG2YM.cjs.map +0 -1
  132. package/dist/chunk-DZMHIGI4.js +0 -337
  133. package/dist/chunk-DZMHIGI4.js.map +0 -1
  134. package/dist/chunk-EDOTEABK.js +0 -109
  135. package/dist/chunk-EDOTEABK.js.map +0 -1
  136. package/dist/chunk-HN2OEUN2.js +0 -33
  137. package/dist/chunk-HN2OEUN2.js.map +0 -1
  138. package/dist/chunk-KBTTEX7Q.js +0 -497
  139. package/dist/chunk-KBTTEX7Q.js.map +0 -1
  140. package/dist/chunk-KQN2ZYND.cjs +0 -724
  141. package/dist/chunk-KQN2ZYND.cjs.map +0 -1
  142. package/dist/chunk-MPTVJIVG.cjs +0 -3176
  143. package/dist/chunk-MPTVJIVG.cjs.map +0 -1
  144. package/dist/chunk-MTMZTMWM.cjs +0 -53
  145. package/dist/chunk-MTMZTMWM.cjs.map +0 -1
  146. package/dist/chunk-N6IHQUOX.js +0 -1
  147. package/dist/chunk-NNB67XA2.js +0 -724
  148. package/dist/chunk-NNB67XA2.js.map +0 -1
  149. package/dist/chunk-OL3IHHSJ.cjs +0 -1204
  150. package/dist/chunk-OL3IHHSJ.cjs.map +0 -1
  151. package/dist/chunk-PI3UXRWK.cjs +0 -528
  152. package/dist/chunk-PI3UXRWK.cjs.map +0 -1
  153. package/dist/chunk-R2VVFAIN.js +0 -528
  154. package/dist/chunk-R2VVFAIN.js.map +0 -1
  155. package/dist/chunk-T64C7ZD7.cjs +0 -1
  156. package/dist/chunk-T64C7ZD7.cjs.map +0 -1
  157. package/dist/chunk-WFDXOLUB.cjs +0 -337
  158. package/dist/chunk-WFDXOLUB.cjs.map +0 -1
  159. package/dist/chunk-WTAN4ACG.cjs +0 -1548
  160. package/dist/chunk-WTAN4ACG.cjs.map +0 -1
  161. package/dist/chunk-YFJXS3AU.cjs +0 -33
  162. package/dist/chunk-YFJXS3AU.cjs.map +0 -1
  163. package/dist/chunk-YUE6TJ4M.js +0 -889
  164. package/dist/chunk-YUE6TJ4M.js.map +0 -1
  165. package/dist/chunk-ZGLJM4A4.js +0 -53
  166. package/dist/chunk-ZGLJM4A4.js.map +0 -1
  167. package/dist/function-CxixTB02.d.cts +0 -299
  168. package/dist/function-DTCt675z.d.ts +0 -299
  169. package/dist/index-B2Ulxxpo.d.cts +0 -144
  170. package/dist/index-BkYJ0xMq.d.cts +0 -152
  171. package/dist/index-BuaB-ypt.d.ts +0 -144
  172. package/dist/index-CAN7v-kw.d.ts +0 -199
  173. package/dist/index-COw1Ky9g.d.ts +0 -242
  174. package/dist/index-DRtIhlJj.d.ts +0 -152
  175. package/dist/index-DXd9JikN.d.cts +0 -246
  176. package/dist/index-DXd9JikN.d.ts +0 -246
  177. package/dist/index-alrRninU.d.cts +0 -199
  178. package/dist/index-oTQbYYIs.d.cts +0 -242
  179. package/dist/index-tR9jTn26.d.cts +0 -275
  180. package/dist/index-tR9jTn26.d.ts +0 -275
  181. package/dist/styled-Bl0ZK28h.d.ts +0 -543
  182. package/dist/styled-Crv6SA4S.d.cts +0 -543
  183. package/dist/types-BN6_Q9Kl.d.cts +0 -39
  184. package/dist/types-BN6_Q9Kl.d.ts +0 -39
  185. /package/dist/{chunk-N6IHQUOX.js.map → chunk-HFPS7JFD.js.map} +0 -0
@@ -1,543 +0,0 @@
1
- import { C as Chord } from './index-COw1Ky9g.js';
2
- import { K as KeyScale } from './types-BN6_Q9Kl.js';
3
-
4
- /**
5
- * Build a 12-bit mode mask from a list of semitone offsets above the root.
6
- *
7
- * Bit 0 (the root) is always set, enforcing the `KeyScale` invariant that the
8
- * root is a scale tone even when the offset list omits 0.
9
- *
10
- * @category Scales
11
- */
12
- declare function maskFromOffsets(offsets: readonly number[]): number;
13
- /**
14
- * Mode mask for the major (Ionian) scale: offsets {0, 2, 4, 5, 7, 9, 11}.
15
- *
16
- * @category Scales
17
- */
18
- declare const MAJOR_MASK = 2741;
19
- /**
20
- * Mode mask for the natural minor (Aeolian) scale: offsets {0, 2, 3, 5, 7, 8, 10}.
21
- *
22
- * @category Scales
23
- */
24
- declare const NATURAL_MINOR_MASK = 1453;
25
- /**
26
- * Harmonic minor: natural minor with a raised seventh — offsets {0,2,3,5,7,8,11}.
27
- *
28
- * @category Scales
29
- */
30
- declare const HARMONIC_MINOR_MASK: number;
31
- /**
32
- * Ascending melodic minor: offsets {0,2,3,5,7,9,11}.
33
- *
34
- * @category Scales
35
- */
36
- declare const MELODIC_MINOR_MASK: number;
37
- /**
38
- * Dorian mode: offsets {0,2,3,5,7,9,10}.
39
- *
40
- * @category Scales
41
- */
42
- declare const DORIAN_MASK: number;
43
- /**
44
- * Phrygian mode: offsets {0,1,3,5,7,8,10}.
45
- *
46
- * @category Scales
47
- */
48
- declare const PHRYGIAN_MASK: number;
49
- /**
50
- * Lydian mode: offsets {0,2,4,6,7,9,11}.
51
- *
52
- * @category Scales
53
- */
54
- declare const LYDIAN_MASK: number;
55
- /**
56
- * Mixolydian mode: offsets {0,2,4,5,7,9,10}.
57
- *
58
- * @category Scales
59
- */
60
- declare const MIXOLYDIAN_MASK: number;
61
- /**
62
- * Locrian mode: offsets {0,1,3,5,6,8,10}.
63
- *
64
- * @category Scales
65
- */
66
- declare const LOCRIAN_MASK: number;
67
- /**
68
- * Major pentatonic: offsets {0,2,4,7,9}.
69
- *
70
- * @category Scales
71
- */
72
- declare const MAJOR_PENTATONIC_MASK: number;
73
- /**
74
- * Minor pentatonic: offsets {0,3,5,7,10}.
75
- *
76
- * @category Scales
77
- */
78
- declare const MINOR_PENTATONIC_MASK: number;
79
- /**
80
- * Hexatonic blues scale: minor pentatonic plus the flat-fifth — {0,3,5,6,7,10}.
81
- *
82
- * @category Scales
83
- */
84
- declare const BLUES_MASK: number;
85
- /**
86
- * Whole-tone scale: offsets {0,2,4,6,8,10}.
87
- *
88
- * @category Scales
89
- */
90
- declare const WHOLE_TONE_MASK: number;
91
- /**
92
- * Octatonic (half-step first): offsets {0,1,3,4,6,7,9,10}.
93
- *
94
- * @category Scales
95
- */
96
- declare const OCTATONIC_HALF_WHOLE_MASK: number;
97
- /**
98
- * Octatonic (whole-step first): offsets {0,2,3,5,6,8,9,11}.
99
- *
100
- * @category Scales
101
- */
102
- declare const OCTATONIC_WHOLE_HALF_MASK: number;
103
- /**
104
- * Chromatic scale: all twelve pitch classes.
105
- *
106
- * @category Scales
107
- */
108
- declare const CHROMATIC_MASK = 4095;
109
- /**
110
- * Lydian dominant (melodic minor's fourth mode): offsets {0,2,4,6,7,9,10}.
111
- *
112
- * The scale over an unaltered dominant with a raised eleventh.
113
- *
114
- * @category Scales
115
- */
116
- declare const LYDIAN_DOMINANT_MASK: number;
117
- /**
118
- * Mixolydian b13, the aeolian dominant (melodic minor's fifth mode): offsets
119
- * {0,2,4,5,7,8,10}.
120
- *
121
- * The scale over a dominant with a flat thirteenth.
122
- *
123
- * @category Scales
124
- */
125
- declare const MIXOLYDIAN_B13_MASK: number;
126
- /**
127
- * Locrian natural 2 (melodic minor's sixth mode): offsets {0,2,3,5,6,8,10}.
128
- *
129
- * The scale over a half-diminished chord used as a minor ii.
130
- *
131
- * @category Scales
132
- */
133
- declare const LOCRIAN_NATURAL2_MASK: number;
134
- /**
135
- * The altered scale, or superlocrian (melodic minor's seventh mode): offsets
136
- * {0,1,3,4,6,8,10}.
137
- *
138
- * The scale over an altered dominant: every tension raised or lowered.
139
- *
140
- * @category Scales
141
- */
142
- declare const ALTERED_MASK: number;
143
- /**
144
- * Phrygian dominant (harmonic minor's fifth mode): offsets {0,1,4,5,7,8,10}.
145
- *
146
- * The scale over the dominant of a minor key, and the characteristic sound of
147
- * the flamenco and maqam repertoires.
148
- *
149
- * @category Scales
150
- */
151
- declare const PHRYGIAN_DOMINANT_MASK: number;
152
- /**
153
- * Named scale masks addressable by {@link scaleByName}.
154
- *
155
- * @category Scales
156
- */
157
- declare const NAMED_SCALES: Readonly<{
158
- major: 2741;
159
- ionian: 2741;
160
- naturalMinor: 1453;
161
- aeolian: 1453;
162
- harmonicMinor: number;
163
- melodicMinor: number;
164
- dorian: number;
165
- phrygian: number;
166
- lydian: number;
167
- mixolydian: number;
168
- locrian: number;
169
- lydianDominant: number;
170
- mixolydianB13: number;
171
- locrianNatural2: number;
172
- altered: number;
173
- phrygianDominant: number;
174
- majorPentatonic: number;
175
- minorPentatonic: number;
176
- blues: number;
177
- wholeTone: number;
178
- octatonicHalfWhole: number;
179
- octatonicWholeHalf: number;
180
- chromatic: 4095;
181
- }>;
182
- /**
183
- * The name of a built-in scale, as accepted by {@link scaleByName},
184
- * {@link avoidNotes}, and {@link availableTensions}.
185
- *
186
- * @category Scales
187
- */
188
- type ScaleName = keyof typeof NAMED_SCALES;
189
- /**
190
- * A scale name that completes to the built-in names but still accepts any
191
- * string, so a caller with a name from configuration is not forced to cast.
192
- *
193
- * @category Scales
194
- */
195
- type ScaleNameInput = ScaleName | (string & {});
196
- /**
197
- * The mask of a named scale, or undefined when the name is not one.
198
- *
199
- * Looking the name up through this helper is what keeps `'constructor'` or
200
- * `'toString'` from resolving to something inherited from `Object.prototype`
201
- * and producing a scale whose mask is a function.
202
- *
203
- * @param name The scale name.
204
- * @returns The 12-bit mask, or undefined for an unknown name.
205
- * @category Scales
206
- */
207
- declare function namedScaleMask(name: ScaleNameInput): number | undefined;
208
- /**
209
- * The mask of a named scale, rejecting an unknown name.
210
- *
211
- * Every public entry point that takes a scale name funnels through here, so a
212
- * typo is reported the same way everywhere instead of being answered with an
213
- * empty result that also means "this scale has none".
214
- *
215
- * @param name The scale name.
216
- * @param label What the name is, for the error message.
217
- * @returns The 12-bit mask.
218
- * @throws If the name is not a built-in scale.
219
- * @category Scales
220
- */
221
- declare function requireScaleMask(name: ScaleNameInput, label?: string): number;
222
-
223
- /**
224
- * Test whether every chord pitch class is contained in a scale.
225
- *
226
- * @param chordPcs The chord's pitch classes (0..11).
227
- * @param scaleMask The scale's 12-bit mode mask.
228
- * @param scaleRootPc The pitch class the mask is rooted on.
229
- * @returns True if the scale is a superset of the chord.
230
- *
231
- * @category Scales
232
- */
233
- declare function scaleMatchesChord(chordPcs: number[], scaleMask: number, scaleRootPc: number): boolean;
234
- /**
235
- * A named scale rooted on a pitch class that fits over a chord.
236
- *
237
- * @category Scales
238
- */
239
- type ChordScaleMatch = {
240
- name: string;
241
- rootPc: number;
242
- };
243
- /**
244
- * List the scales that fit over a chord, best fit first.
245
- *
246
- * Only the chord root is considered as the scale root, matching the
247
- * conventional chord-scale relationship. Every entry of {@link NAMED_SCALES}
248
- * whose pitch-class set is a superset of the chord's is returned once per
249
- * distinct pitch-class set (aliased masks such as major/ionian report only the
250
- * modal name), ranked by fewest extra scale tones beyond the chord and then by
251
- * conventional
252
- * preference. For bare triads and smaller chords, heptatonic scales rank before
253
- * pentatonics and other sizes: a pentatonic adds no modal color over a triad,
254
- * so the seven-note modes are the more useful answer. The chromatic scale is
255
- * only returned as a fallback when no other scale contains the chord.
256
- *
257
- * The ranking is by fit, so the first entry is the tightest-fitting scale
258
- * rather than the idiomatic choice: a four-note chord that a pentatonic covers
259
- * exactly puts that pentatonic ahead of the mode a player would name. Read the
260
- * whole list, or pick by name, when the idiomatic scale is what is wanted;
261
- * {@link scalesForChanges} makes that choice for a progression.
262
- *
263
- * @param chord The chord to fit scales over.
264
- * @returns The matching scales rooted on the chord root, best fit first.
265
- *
266
- * @example
267
- * ```ts
268
- * import { makeChord, chordScales } from '@libraz/libcantus';
269
- * const scales = chordScales(makeChord(0, 'maj7'));
270
- * // scales for Cmaj7, best fit first; each is { name, rootPc: 0 }
271
- * ```
272
- *
273
- * @category Scales
274
- */
275
- declare function chordScales(chord: Chord): ChordScaleMatch[];
276
- /**
277
- * List a scale's avoid notes over a chord.
278
- *
279
- * An avoid note is a non-chord scale tone that lies a semitone directly above a
280
- * chord tone; sounding it against the chord clashes. The scale is rooted on the
281
- * chord root. If the scale does not contain the chord, no avoid notes exist.
282
- *
283
- * @param chord The chord providing the chord tones.
284
- * @param scaleName A key of {@link NAMED_SCALES}.
285
- * @returns The avoid-note pitch classes, sorted ascending in [0, 11].
286
- * @throws If `scaleName` is not a built-in scale. An empty result already
287
- * means "this scale has no avoid notes over this chord"; answering a typo
288
- * the same way would make the two indistinguishable.
289
- *
290
- * @category Scales
291
- */
292
- declare function avoidNotes(chord: Chord, scaleName: ScaleNameInput): number[];
293
- /**
294
- * List a scale's available tensions over a chord.
295
- *
296
- * Available tensions are scale tones that are neither chord tones nor avoid
297
- * notes, i.e. the usable color tones (typically the 9/11/13 region). The scale
298
- * is rooted on the chord root. If the scale does not contain the chord, there
299
- * are no available tensions.
300
- *
301
- * @param chord The chord providing the chord tones.
302
- * @param scaleName A key of {@link NAMED_SCALES}.
303
- * @returns The available-tension pitch classes, sorted ascending in [0, 11].
304
- * @throws If `scaleName` is not a built-in scale, as {@link avoidNotes} does.
305
- *
306
- * @example
307
- * ```ts
308
- * import { makeChord, availableTensions } from '@libraz/libcantus';
309
- * availableTensions(makeChord(0, 'maj7'), 'ionian'); // [2, 9] — color tones over Cmaj7
310
- * ```
311
- *
312
- * @category Scales
313
- */
314
- declare function availableTensions(chord: Chord, scaleName: ScaleNameInput): number[];
315
- /**
316
- * A scale fit over a chord together with its avoid notes and tensions.
317
- *
318
- * @category Scales
319
- */
320
- type ChordScaleReportEntry = {
321
- name: string;
322
- rootPc: number;
323
- avoid: number[];
324
- tensions: number[];
325
- };
326
- /**
327
- * Report the best-fitting scales for a chord with their avoid notes and tensions.
328
- *
329
- * Combines {@link chordScales}, {@link avoidNotes}, and {@link availableTensions}
330
- * into a single ergonomic result, ordered best fit first.
331
- *
332
- * @param chord The chord to analyze.
333
- * @param limit Optional maximum number of scales to report; all by default.
334
- * @returns One entry per reported scale, best fit first.
335
- *
336
- * @category Scales
337
- */
338
- declare function chordScaleReport(chord: Chord, limit?: number): ChordScaleReportEntry[];
339
- /**
340
- * A chord paired with the scale chosen for it by {@link scalesForChanges}.
341
- *
342
- * @category Scales
343
- */
344
- type ScaleChoice = {
345
- chord: Chord;
346
- scale: ChordScaleMatch;
347
- };
348
- /**
349
- * Choose one scale per chord across a progression, favoring continuity.
350
- *
351
- * Each chord's {@link chordScales} candidates form a stage in a Viterbi-style
352
- * dynamic program. The transition cost between adjacent choices is the number
353
- * of pitch classes that differ between their pitch-class sets (the symmetric
354
- * difference), plus a small penalty for straying from a chord's best-fit scale
355
- * so that ties break toward the tighter fit. The minimum-total-cost path is
356
- * returned, one {@link ScaleChoice} per input chord in the original order.
357
- *
358
- * @param chords The chord sequence to choose scales for.
359
- * @returns One scale choice per chord, in input order.
360
- *
361
- * @category Scales
362
- */
363
- declare function scalesForChanges(chords: Chord[]): ScaleChoice[];
364
-
365
- /**
366
- * An inclusive MIDI pitch range for a single voice.
367
- *
368
- * @category Voicing & Counterpoint
369
- */
370
- type VoiceRange = {
371
- readonly min: number;
372
- readonly max: number;
373
- };
374
- /**
375
- * Default four-voice SATB ranges, ascending (index 0 = lowest):
376
- * bass E2–C4 (40–60), tenor C3–G4 (48–67), alto G3–D5 (55–74),
377
- * soprano C4–G5 (60–79).
378
- *
379
- * @category Voicing & Counterpoint
380
- */
381
- declare const SATB_RANGES: readonly Readonly<VoiceRange>[];
382
- /**
383
- * Options controlling {@link voiceChord} and {@link voiceProgression}.
384
- *
385
- * @category Voicing & Counterpoint
386
- */
387
- type VoicingOptions = {
388
- /**
389
- * Number of voices to realize. Ignored when `ranges` is given.
390
- *
391
- * @defaultValue 4
392
- */
393
- voices?: number;
394
- /** Explicit per-voice ranges, ascending (index 0 = lowest). Takes precedence over `voices`. */
395
- ranges?: VoiceRange[];
396
- /**
397
- * Maximum spacing in semitones between adjacent upper voices.
398
- *
399
- * @defaultValue 12
400
- */
401
- maxSpacing?: number;
402
- /**
403
- * Maximum candidate voicings evaluated for one chord.
404
- *
405
- * Raise this for large voicings when exact optimum matters more than bounded
406
- * search time.
407
- *
408
- * @defaultValue 4000
409
- */
410
- maxCandidates?: number;
411
- /**
412
- * Maximum number of chords {@link voiceProgression} will voice. The search
413
- * per chord is bounded internally, so the cost of a progression is linear in
414
- * its length; this is the guard against an unbounded caller, not a limit on
415
- * the search.
416
- *
417
- * @defaultValue 1000000
418
- */
419
- budget?: number;
420
- /**
421
- * The prevailing key. Supplying it enables the rules that only make sense
422
- * relative to a tonic: the leading tone is neither doubled nor left
423
- * unresolved. Without it, voicings are chosen from chord structure and
424
- * voice-leading distance alone.
425
- */
426
- key?: KeyScale;
427
- /**
428
- * The chord that produced the current voicing passed to {@link nextVoicing}.
429
- * When supplied, chordal-seventh resolution is scored exactly as it is by
430
- * {@link voiceProgression}.
431
- */
432
- previousChord?: Chord;
433
- };
434
- /**
435
- * Realize a single chord as one MIDI pitch per voice, ascending (index 0 =
436
- * lowest). The bass voice takes the chord's `bassPc` when set, otherwise the
437
- * root; upper voices take chord pitch classes, doubling the root or fifth as
438
- * needed to fill all voices. The result stays inside each voice's range, keeps
439
- * adjacent upper voices within `maxSpacing`, avoids voice crossing, and is
440
- * deterministic: a compact close-position voicing centered in the ranges.
441
- *
442
- * @param chord The chord to voice.
443
- * @param opts Voicing options; defaults to four voices in {@link SATB_RANGES}.
444
- * @returns MIDI pitches, ascending, one per voice.
445
- * @throws If no voicing fits the given ranges.
446
- * @example
447
- * ```ts
448
- * import { parseChordSymbol, voiceChord } from '@libraz/libcantus';
449
- * const chord = parseChordSymbol('Cmaj7');
450
- * voiceChord(chord); // four ascending MIDI pitches within the SATB ranges
451
- * ```
452
- * @category Voicing & Counterpoint
453
- */
454
- declare function voiceChord(chord: Chord, opts?: VoicingOptions): number[];
455
- /**
456
- * Voice a chord progression with smooth, bounded SATB-style leading.
457
- *
458
- * Each chord is chosen from a deterministic candidate set, minimizing motion
459
- * while penalizing counterpoint violations. A supplied key additionally
460
- * resolves leading tones and chordal sevenths.
461
- *
462
- * @param chords The chords to voice in order.
463
- * @param opts Voicing options; defaults to four voices in {@link SATB_RANGES}.
464
- * @returns One ascending MIDI voicing per chord.
465
- * @throws {@link NoSolutionError} with the failing chord index when a chord
466
- * cannot fit the requested ranges.
467
- * @category Voicing & Counterpoint
468
- */
469
- declare function voiceProgression(chords: readonly Chord[], opts?: VoicingOptions): number[][];
470
-
471
- /**
472
- * A tertian voicing style for {@link voiceChordStyled}.
473
- *
474
- * - `close`: the plain close-position tertian stack.
475
- * - `drop2`: the second voice from the top dropped an octave (drop-2 voicing).
476
- * - `drop3`: the third voice from the top dropped an octave (drop-3 voicing).
477
- * - `shell`: root plus guide tones (third and seventh) for seventh chords, or
478
- * root/third/fifth for triads; the fifth and tensions are omitted.
479
- * - `rootless`: the root omitted, keeping third/fifth/seventh and tensions
480
- * (a typical left-hand jazz voicing).
481
- *
482
- * @category Voicing & Counterpoint
483
- */
484
- type VoicingStyle = 'close' | 'drop2' | 'drop3' | 'shell' | 'rootless';
485
- /**
486
- * Options controlling {@link voiceChordStyled}.
487
- *
488
- * @category Voicing & Counterpoint
489
- */
490
- type StyledVoicingOptions = {
491
- /**
492
- * Voicing style to build.
493
- *
494
- * @defaultValue 'close'
495
- */
496
- style?: VoicingStyle;
497
- /** Constrain the highest voice to this pitch class (0..11) when given. */
498
- topNote?: number;
499
- /**
500
- * Base octave in scientific pitch notation: octave 4 starts the stack near
501
- * middle C (MIDI 60), i.e. near `12 * (octave + 1)`.
502
- *
503
- * @defaultValue 4
504
- */
505
- octave?: number;
506
- /**
507
- * Omit the root regardless of style (relevant for jazz voicings).
508
- *
509
- * @defaultValue false
510
- */
511
- rootless?: boolean;
512
- };
513
- /**
514
- * Realize a single chord as an explicit tertian voicing in a chosen style,
515
- * independent of the SATB range search used by {@link voiceChord}.
516
- *
517
- * The chord tones are stacked in close position from the bass (`bassPc`, else
518
- * `rootPc`) in the given scientific-pitch `octave` upward (octave 4 starts the
519
- * bass near C4 = MIDI 60, matching {@link midiToNote} and the bass module).
520
- * When `topNote` is given the stack is rotated so the highest voice's pitch
521
- * class equals that note (or the nearest chord tone). The chosen
522
- * {@link VoicingStyle} then transforms the stack, and the result is returned as
523
- * ascending MIDI pitches (index 0 = lowest).
524
- *
525
- * Every returned pitch is a valid MIDI number: an octave whose stack would run
526
- * off either end of the 0..127 range is rejected rather than voiced out of
527
- * range, matching {@link nextVoicing}, which clamps its derived ranges.
528
- *
529
- * @param chord The chord to voice.
530
- * @param opts Styled voicing options; defaults to a close voicing at octave 4.
531
- * @returns MIDI pitches, ascending, one per retained voice.
532
- * @throws If the voicing would not fit inside MIDI 0..127 at the given octave.
533
- * @example
534
- * ```ts
535
- * import { parseChordSymbol, voiceChordStyled } from '@libraz/libcantus';
536
- * const chord = parseChordSymbol('Dm7');
537
- * voiceChordStyled(chord, { style: 'drop2' }); // ascending MIDI pitches, drop-2 voicing
538
- * ```
539
- * @category Voicing & Counterpoint
540
- */
541
- declare function voiceChordStyled(chord: Chord, opts?: StyledVoicingOptions): number[];
542
-
543
- export { ALTERED_MASK as A, BLUES_MASK as B, CHROMATIC_MASK as C, DORIAN_MASK as D, scaleMatchesChord as E, scalesForChanges as F, voiceChord as G, HARMONIC_MINOR_MASK as H, voiceChordStyled as I, voiceProgression as J, LOCRIAN_MASK as L, MAJOR_MASK as M, NAMED_SCALES as N, OCTATONIC_HALF_WHOLE_MASK as O, PHRYGIAN_DOMINANT_MASK as P, SATB_RANGES as S, type VoiceRange as V, WHOLE_TONE_MASK as W, type ChordScaleMatch as a, type ChordScaleReportEntry as b, LOCRIAN_NATURAL2_MASK as c, LYDIAN_DOMINANT_MASK as d, LYDIAN_MASK as e, MAJOR_PENTATONIC_MASK as f, MELODIC_MINOR_MASK as g, MINOR_PENTATONIC_MASK as h, MIXOLYDIAN_B13_MASK as i, MIXOLYDIAN_MASK as j, NATURAL_MINOR_MASK as k, OCTATONIC_WHOLE_HALF_MASK as l, PHRYGIAN_MASK as m, type ScaleChoice as n, type ScaleName as o, type ScaleNameInput as p, type StyledVoicingOptions as q, type VoicingOptions as r, type VoicingStyle as s, availableTensions as t, avoidNotes as u, chordScaleReport as v, chordScales as w, maskFromOffsets as x, namedScaleMask as y, requireScaleMask as z };