@libraz/libcantus 0.9.0 → 0.9.2

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 (155) hide show
  1. package/README.md +25 -2
  2. package/dist/analyze/index.cjs +1697 -0
  3. package/dist/analyze/index.cjs.map +1 -0
  4. package/dist/analyze/index.d.cts +429 -0
  5. package/dist/analyze/index.d.ts +429 -0
  6. package/dist/analyze/index.js +51 -0
  7. package/dist/analyze/index.js.map +1 -0
  8. package/dist/chunk-5HTNMQW4.js +653 -0
  9. package/dist/chunk-5HTNMQW4.js.map +1 -0
  10. package/dist/chunk-7Y7WF64D.js +410 -0
  11. package/dist/chunk-7Y7WF64D.js.map +1 -0
  12. package/dist/chunk-A4532ZFR.js +259 -0
  13. package/dist/chunk-A4532ZFR.js.map +1 -0
  14. package/dist/chunk-BHUT2S5G.js +22 -0
  15. package/dist/chunk-BHUT2S5G.js.map +1 -0
  16. package/dist/chunk-CCBLVAPK.js +42 -0
  17. package/dist/chunk-CCBLVAPK.js.map +1 -0
  18. package/dist/chunk-COKTX2G5.js +907 -0
  19. package/dist/chunk-COKTX2G5.js.map +1 -0
  20. package/dist/chunk-DYWFNC4A.js +152 -0
  21. package/dist/chunk-DYWFNC4A.js.map +1 -0
  22. package/dist/chunk-GQKN5KDT.js +159 -0
  23. package/dist/chunk-GQKN5KDT.js.map +1 -0
  24. package/dist/chunk-LN7ZZMD2.js +530 -0
  25. package/dist/chunk-LN7ZZMD2.js.map +1 -0
  26. package/dist/chunk-MSWFZF7J.js +118 -0
  27. package/dist/chunk-MSWFZF7J.js.map +1 -0
  28. package/dist/chunk-R3S2LUBH.js +2722 -0
  29. package/dist/chunk-R3S2LUBH.js.map +1 -0
  30. package/dist/chunk-SDM3VJJ5.js +41 -0
  31. package/dist/chunk-SDM3VJJ5.js.map +1 -0
  32. package/dist/chunk-XTC3X6MS.js +816 -0
  33. package/dist/chunk-XTC3X6MS.js.map +1 -0
  34. package/dist/chunk-ZXW5YIWK.js +55 -0
  35. package/dist/chunk-ZXW5YIWK.js.map +1 -0
  36. package/dist/core/index.cjs +432 -0
  37. package/dist/core/index.cjs.map +1 -0
  38. package/dist/core/index.d.cts +210 -0
  39. package/dist/core/index.d.ts +210 -0
  40. package/dist/core/index.js +73 -0
  41. package/dist/core/index.js.map +1 -0
  42. package/dist/function-2bJW1Zp_.d.ts +187 -0
  43. package/dist/function-r2sh-jOO.d.cts +187 -0
  44. package/dist/generate/index.cjs +3787 -0
  45. package/dist/generate/index.cjs.map +1 -0
  46. package/dist/generate/index.d.cts +980 -0
  47. package/dist/generate/index.d.ts +980 -0
  48. package/dist/generate/index.js +52 -0
  49. package/dist/generate/index.js.map +1 -0
  50. package/dist/index-BMPxwjwV.d.ts +151 -0
  51. package/dist/index-BOBXBNwP.d.cts +157 -0
  52. package/dist/index-BdeQ1r_p.d.cts +56 -0
  53. package/dist/index-BreoJRw0.d.ts +127 -0
  54. package/dist/index-CGMZNCx6.d.cts +140 -0
  55. package/dist/index-CGMZNCx6.d.ts +140 -0
  56. package/dist/index-CM5W4rcm.d.ts +157 -0
  57. package/dist/index-CP3wAfEH.d.ts +56 -0
  58. package/dist/index-Cl7mhOFM.d.cts +164 -0
  59. package/dist/index-Cl7mhOFM.d.ts +164 -0
  60. package/dist/index-DZ1M21do.d.cts +127 -0
  61. package/dist/index-D_ZTUNKp.d.cts +151 -0
  62. package/dist/index.cjs +5277 -4893
  63. package/dist/index.cjs.map +1 -1
  64. package/dist/index.d.cts +14 -2621
  65. package/dist/index.d.ts +14 -2621
  66. package/dist/index.js +170 -6152
  67. package/dist/index.js.map +1 -1
  68. package/dist/model/index.cjs +2435 -0
  69. package/dist/model/index.cjs.map +1 -0
  70. package/dist/model/index.d.cts +630 -0
  71. package/dist/model/index.d.ts +630 -0
  72. package/dist/model/index.js +21 -0
  73. package/dist/model/index.js.map +1 -0
  74. package/dist/styled-BjXtOFNk.d.cts +282 -0
  75. package/dist/styled-D7BAx3S3.d.ts +282 -0
  76. package/dist/theory/index.cjs +1677 -0
  77. package/dist/theory/index.cjs.map +1 -0
  78. package/dist/theory/index.d.cts +535 -0
  79. package/dist/theory/index.d.ts +535 -0
  80. package/dist/theory/index.js +149 -0
  81. package/dist/theory/index.js.map +1 -0
  82. package/dist/types-MGP29r3t.d.cts +30 -0
  83. package/dist/types-MGP29r3t.d.ts +30 -0
  84. package/package.json +31 -1
  85. package/src/analyze/arrange/index.ts +21 -0
  86. package/src/analyze/arrange/internal.ts +125 -0
  87. package/src/analyze/arrange/tension.ts +187 -0
  88. package/src/analyze/arrange/tracks.ts +279 -0
  89. package/src/{detect → analyze/detect}/index.ts +82 -23
  90. package/src/analyze/functional/borrowed.ts +84 -0
  91. package/src/analyze/functional/cadence.ts +66 -0
  92. package/src/analyze/functional/function.ts +184 -0
  93. package/src/analyze/functional/index.ts +23 -0
  94. package/src/analyze/functional/internal.ts +29 -0
  95. package/src/analyze/functional/roman.ts +393 -0
  96. package/src/analyze/index.ts +49 -0
  97. package/src/{timeline → analyze/timeline}/index.ts +87 -24
  98. package/src/{analysis → analyze/voice}/index.ts +81 -12
  99. package/src/core/index.ts +47 -0
  100. package/src/{interval → core/interval}/index.ts +15 -1
  101. package/src/{meter → core/meter}/index.ts +108 -5
  102. package/src/{pitch → core/pitch}/index.ts +58 -3
  103. package/src/{random → core/random}/index.ts +13 -1
  104. package/src/{tuning → core/tuning}/index.ts +28 -1
  105. package/src/{bass → generate/bass}/index.ts +66 -17
  106. package/src/{countermelody → generate/countermelody}/index.ts +54 -24
  107. package/src/{drums → generate/drums}/fills.ts +31 -20
  108. package/src/{drums → generate/drums}/index.ts +127 -9
  109. package/src/{drums → generate/drums}/internal.ts +7 -1
  110. package/src/{drums → generate/drums}/rng.ts +2 -2
  111. package/src/{drums → generate/drums}/swing.ts +7 -2
  112. package/src/{groove → generate/groove}/index.ts +118 -22
  113. package/src/{harmonize → generate/harmonize}/index.ts +96 -23
  114. package/src/generate/index.ts +59 -0
  115. package/src/{motif → generate/motif}/index.ts +94 -17
  116. package/src/{progression → generate/progression}/index.ts +61 -27
  117. package/src/{reharmony → generate/reharmony}/index.ts +46 -15
  118. package/src/{rhythm → generate/rhythm}/index.ts +47 -13
  119. package/src/index.ts +130 -116
  120. package/src/model/chord.ts +423 -0
  121. package/src/model/index.ts +5 -947
  122. package/src/model/interval.ts +82 -0
  123. package/src/model/key.ts +266 -0
  124. package/src/model/note.ts +176 -0
  125. package/src/model/progression.ts +161 -0
  126. package/src/model/shared.ts +12 -0
  127. package/src/{chord → theory/chord}/index.ts +85 -4
  128. package/src/{chordscale → theory/chordscale}/index.ts +67 -9
  129. package/src/{counterpoint → theory/counterpoint}/index.ts +23 -2
  130. package/src/{harmony → theory/harmony}/index.ts +19 -2
  131. package/src/theory/index.ts +107 -0
  132. package/src/{safety → theory/safety}/index.ts +59 -12
  133. package/src/theory/scale/degrees.ts +123 -0
  134. package/src/theory/scale/index.ts +28 -0
  135. package/src/theory/scale/key.ts +56 -0
  136. package/src/theory/scale/masks.ts +153 -0
  137. package/src/{spelling → theory/spelling}/index.ts +21 -3
  138. package/src/{symbol → theory/symbol}/index.ts +91 -36
  139. package/src/theory/voicing/index.ts +5 -0
  140. package/src/theory/voicing/internal.ts +168 -0
  141. package/src/theory/voicing/leading.ts +112 -0
  142. package/src/theory/voicing/satb.ts +195 -0
  143. package/src/theory/voicing/styled.ts +176 -0
  144. package/src/arrange/index.ts +0 -409
  145. package/src/functional/index.ts +0 -602
  146. package/src/scale/index.ts +0 -215
  147. package/src/voicing/index.ts +0 -523
  148. /package/src/{types.ts → core/types.ts} +0 -0
  149. /package/src/{drums → generate/drums}/beat.ts +0 -0
  150. /package/src/{drums → generate/drums}/euclid.ts +0 -0
  151. /package/src/{drums → generate/drums}/ghost.ts +0 -0
  152. /package/src/{drums → generate/drums}/hihat.ts +0 -0
  153. /package/src/{drums → generate/drums}/hit.ts +0 -0
  154. /package/src/{drums → generate/drums}/kick.ts +0 -0
  155. /package/src/{drums → generate/drums}/percussion.ts +0 -0
@@ -0,0 +1,630 @@
1
+ import { H as HarmonicFunction, a as ChordAnalysis, C as Cadence, B as BorrowedSource } from '../function-r2sh-jOO.cjs';
2
+ import { a as ChordQuality, C as Chord$1 } from '../index-BOBXBNwP.cjs';
3
+ import { d as VoicingOptions, c as StyledVoicingOptions, C as ChordScaleMatch } from '../styled-BjXtOFNk.cjs';
4
+ import { N as Note$1, S as SpelledInterval } from '../index-CGMZNCx6.cjs';
5
+ import { K as KeyScale } from '../types-MGP29r3t.cjs';
6
+
7
+ /**
8
+ * An immutable spelled note: a diatonic letter plus a chromatic alteration and
9
+ * an optional octave. Wraps the plain note object and delegates to the pitch
10
+ * module; every transformation returns a new instance.
11
+ *
12
+ * @category Class API
13
+ * @example
14
+ * ```ts
15
+ * import { Note } from '@libraz/libcantus';
16
+ * Note.of('C4').transpose(7).name; // 'G4'
17
+ * ```
18
+ */
19
+ declare class Note {
20
+ #private;
21
+ /**
22
+ * Wrap a plain note object.
23
+ *
24
+ * @param data The spelled note; it is copied, never retained or mutated.
25
+ */
26
+ constructor(data: Note$1);
27
+ /**
28
+ * Parse scientific pitch notation (e.g. `'C#4'`, `'Bb'`, `'F##3'`).
29
+ *
30
+ * @param name The note text.
31
+ * @returns The parsed note.
32
+ * @throws If the text is not a valid note.
33
+ */
34
+ static of(name: string): Note;
35
+ /**
36
+ * Name a MIDI number (middle C = C4 = 60) as a note.
37
+ *
38
+ * @param midi The MIDI number.
39
+ * @param spelling Whether to prefer sharps or flats for black keys.
40
+ * @returns The spelled note, with octave.
41
+ */
42
+ static fromMidi(midi: number, spelling?: 'sharp' | 'flat'): Note;
43
+ /**
44
+ * Wrap an existing plain note object.
45
+ *
46
+ * @param data The plain note.
47
+ * @returns The wrapped note.
48
+ */
49
+ static fromData(data: Note$1): Note;
50
+ /** The note rendered as scientific pitch notation, e.g. `'G4'` or `'Bb'`. */
51
+ get name(): string;
52
+ /** The pitch class (0..11), ignoring octave. */
53
+ get pitchClass(): number;
54
+ /**
55
+ * The MIDI number (middle C = C4 = 60).
56
+ *
57
+ * @throws If the note has no octave and therefore no fixed pitch.
58
+ */
59
+ get midi(): number;
60
+ /** The diatonic letter number: 0..6 for C..B. */
61
+ get letter(): number;
62
+ /** The chromatic alteration in semitones: -1 flat, 0 natural, +1 sharp, ... */
63
+ get alter(): number;
64
+ /** The octave (scientific pitch notation), or undefined for a bare pitch class. */
65
+ get octave(): number | undefined;
66
+ /** A copy of the underlying plain note object. */
67
+ get data(): Note$1;
68
+ /**
69
+ * Transpose by a signed number of semitones.
70
+ *
71
+ * When the note carries an octave the transposition happens in MIDI space and
72
+ * the result is spelled with a sharp preference. An octave-less note stays
73
+ * octave-less: only its pitch class is moved. Transposing by zero is the
74
+ * identity: the original spelling is preserved (no enharmonic respelling).
75
+ *
76
+ * @param semitones The signed semitone offset.
77
+ * @returns The transposed note.
78
+ */
79
+ transpose(semitones: number): Note;
80
+ /**
81
+ * The spelled interval from this note to another.
82
+ *
83
+ * @param other The second note.
84
+ * @returns The diatonic number, quality, and semitone span.
85
+ */
86
+ intervalTo(other: Note): SpelledInterval;
87
+ /**
88
+ * Whether another note has the same letter, alteration, and octave.
89
+ *
90
+ * @param other The note to compare.
91
+ * @returns True if the spellings are identical.
92
+ */
93
+ equals(other: Note): boolean;
94
+ /**
95
+ * The plain note data, for JSON serialization.
96
+ *
97
+ * Private class fields do not serialize, so an explicit `toJSON` keeps
98
+ * `JSON.stringify(note)` from collapsing to `{}`.
99
+ *
100
+ * @returns A copy of the underlying plain note object.
101
+ */
102
+ toJSON(): Note$1;
103
+ }
104
+
105
+ /**
106
+ * An immutable key/scale: a `KeyScale` (root pitch class plus mode mask) paired
107
+ * with a spelled tonic that anchors letter-name spelling. Acts as the factory
108
+ * for key-aware chords.
109
+ *
110
+ * @category Class API
111
+ * @example
112
+ * ```ts
113
+ * import { Key } from '@libraz/libcantus';
114
+ * Key.major('C').chord(4).symbol(); // 'G' (the diatonic triad on scale degree 4)
115
+ * ```
116
+ */
117
+ declare class Key {
118
+ #private;
119
+ /**
120
+ * Wrap a key/scale and its spelled tonic.
121
+ *
122
+ * @param scale The key/scale; its root is normalized to a pitch class.
123
+ * @param tonic The spelled tonic anchoring letter-name spelling.
124
+ */
125
+ constructor(scale: KeyScale, tonic: Note);
126
+ /**
127
+ * A major key.
128
+ *
129
+ * @param root Tonic as a note name (e.g. `'Eb'`) or a pitch class; a numeric
130
+ * root is spelled with whichever accidental side yields the fewest
131
+ * accidentals across the scale.
132
+ * @returns The major key.
133
+ */
134
+ static major(root: string | number): Key;
135
+ /**
136
+ * A natural-minor key.
137
+ *
138
+ * @param root Tonic as a note name or a pitch class; a numeric root is
139
+ * spelled with whichever accidental side yields the fewest accidentals
140
+ * across the scale.
141
+ * @returns The minor key.
142
+ */
143
+ static minor(root: string | number): Key;
144
+ /**
145
+ * A key on a named scale (e.g. `'dorian'`, `'harmonicMinor'`).
146
+ *
147
+ * @param name The scale name, a key of the scale module's named-scale table.
148
+ * @param root Tonic as a note name or a pitch class.
149
+ * @returns The key.
150
+ * @throws If the name is not a known scale.
151
+ */
152
+ static named(name: string, root: string | number): Key;
153
+ /**
154
+ * Wrap an existing `KeyScale`, synthesizing a spelled tonic when none is
155
+ * given (flat-preferred for minor-third scales, sharp-preferred otherwise).
156
+ *
157
+ * @param scale The key/scale to wrap.
158
+ * @param tonic Optional spelled tonic.
159
+ * @returns The key.
160
+ */
161
+ static of(scale: KeyScale, tonic?: Note): Key;
162
+ /** A copy of the underlying plain `KeyScale`. */
163
+ get scale(): KeyScale;
164
+ /** The spelled tonic. */
165
+ get tonic(): Note;
166
+ /** The tonic pitch class (0..11). */
167
+ get rootPc(): number;
168
+ /** Whether the scale has a minor third and no major third. */
169
+ get isMinor(): boolean;
170
+ /**
171
+ * The scale's pitch classes in ascending scale-degree order (degree 0 first).
172
+ *
173
+ * @returns One pitch class per scale degree.
174
+ */
175
+ pitchClasses(): number[];
176
+ /**
177
+ * The spelled scale, one note per degree (e.g. C D E F G A B for C major).
178
+ *
179
+ * @returns Spelled octave-less notes in scale-degree order.
180
+ */
181
+ notes(): Note[];
182
+ /**
183
+ * Alias of {@link Key.notes}.
184
+ *
185
+ * @returns Spelled octave-less notes in scale-degree order.
186
+ */
187
+ spell(): Note[];
188
+ /**
189
+ * The spelled scale as letter-name strings.
190
+ *
191
+ * @returns One name per scale degree.
192
+ */
193
+ noteNames(): string[];
194
+ /**
195
+ * Build a chord on a scale degree, carrying this key as context.
196
+ *
197
+ * With an explicit quality the quality's interval template is attached to the
198
+ * degree's diatonic root; without one the scale-correct diatonic triad is
199
+ * stacked (e.g. a diminished triad on the leading tone of a major key).
200
+ *
201
+ * @param degree 0-based scale degree of the chord root.
202
+ * @param quality Optional chord quality.
203
+ * @returns The chord, with this key attached.
204
+ */
205
+ chord(degree: number, quality?: ChordQuality): Chord;
206
+ /**
207
+ * The diatonic triad on a scale degree, carrying this key as context.
208
+ *
209
+ * @param degree 0-based scale degree of the chord root.
210
+ * @returns The triad, with this key attached.
211
+ */
212
+ diatonicTriad(degree: number): Chord;
213
+ /**
214
+ * The diatonic seventh chord on a scale degree, carrying this key as context.
215
+ *
216
+ * @param degree 0-based scale degree of the chord root.
217
+ * @returns The seventh chord, with this key attached.
218
+ */
219
+ diatonicSeventh(degree: number): Chord;
220
+ /**
221
+ * Build the chord denoted by a Roman numeral in this key (including applied
222
+ * chords such as `'V7/V'`), carrying this key as context.
223
+ *
224
+ * @param text The Roman numeral.
225
+ * @returns The chord, with this key attached.
226
+ * @throws If the numeral is not valid.
227
+ */
228
+ roman(text: string): Chord;
229
+ /**
230
+ * Whether a pitch belongs to the scale.
231
+ *
232
+ * @param x A MIDI pitch, bare pitch class, or note.
233
+ * @returns True if the pitch class is a scale tone.
234
+ */
235
+ contains(x: number | Note): boolean;
236
+ /**
237
+ * The plain key data, for JSON serialization.
238
+ *
239
+ * Private class fields do not serialize, so an explicit `toJSON` keeps
240
+ * `JSON.stringify(key)` from collapsing to `{}`. The result pairs the
241
+ * `KeyScale` with the spelled tonic, enough to reconstruct the key via
242
+ * {@link Key.of}.
243
+ *
244
+ * @returns The key/scale and its spelled tonic.
245
+ */
246
+ toJSON(): {
247
+ scale: KeyScale;
248
+ tonic: Note$1;
249
+ };
250
+ }
251
+
252
+ /**
253
+ * An immutable ordered sequence of chords, optionally carrying a {@link Key}
254
+ * context shared by its analysis methods.
255
+ *
256
+ * @category Class API
257
+ * @example
258
+ * ```ts
259
+ * import { Key } from '@libraz/libcantus';
260
+ * const key = Key.major('C');
261
+ * key.chord(1).progressionTo(key.chord(4), key.chord(0)).roman();
262
+ * // ['ii', 'V', 'I']
263
+ * ```
264
+ */
265
+ declare class Progression {
266
+ #private;
267
+ /**
268
+ * Wrap a chord sequence.
269
+ *
270
+ * @param chords The chords in order; the array is copied.
271
+ * @param key Optional key context for analysis methods.
272
+ */
273
+ constructor(chords: readonly Chord[], key?: Key);
274
+ /** A copy of the chord sequence. */
275
+ get chords(): readonly Chord[];
276
+ /** The carried key context, if any. */
277
+ get key(): Key | undefined;
278
+ /** The number of chords. */
279
+ get length(): number;
280
+ /**
281
+ * A copy of this progression with a chord appended.
282
+ *
283
+ * @param chord The chord to append.
284
+ * @returns The new progression.
285
+ */
286
+ add(chord: Chord): Progression;
287
+ /**
288
+ * A copy of this progression carrying the given key context.
289
+ *
290
+ * @param key The key context to attach.
291
+ * @returns The new progression.
292
+ */
293
+ withKey(key: Key): Progression;
294
+ /**
295
+ * Voice the progression with smooth voice leading.
296
+ *
297
+ * @param opts Voicing options; defaults to four SATB voices.
298
+ * @returns One ascending voicing (MIDI pitches) per chord.
299
+ * @throws If any chord admits no voicing within the given ranges.
300
+ */
301
+ voice(opts?: VoicingOptions): number[][];
302
+ /**
303
+ * The Roman numeral of each chord in a key.
304
+ *
305
+ * @param key Key to analyze in; falls back to the carried context.
306
+ * @returns One numeral per chord.
307
+ * @throws If no key is given and none is carried.
308
+ */
309
+ roman(key?: Key): string[];
310
+ /**
311
+ * The harmonic function of each chord in a key.
312
+ *
313
+ * @param key Key to analyze in; falls back to the carried context.
314
+ * @returns One function per chord.
315
+ * @throws If no key is given and none is carried.
316
+ */
317
+ functions(key?: Key): HarmonicFunction[];
318
+ /**
319
+ * Analyze every chord and classify the closing cadence.
320
+ *
321
+ * The cadence is detected on the final chord pair and is null when the
322
+ * progression has fewer than two chords.
323
+ *
324
+ * @param key Key to analyze in; falls back to the carried context.
325
+ * @returns Per-chord analyses and the closing cadence.
326
+ * @throws If no key is given and none is carried.
327
+ */
328
+ analyze(key?: Key): {
329
+ chords: ChordAnalysis[];
330
+ cadence: Cadence;
331
+ };
332
+ /**
333
+ * The plain progression data, for JSON serialization.
334
+ *
335
+ * Private class fields do not serialize, so an explicit `toJSON` keeps
336
+ * `JSON.stringify(progression)` from collapsing to `{}`. The chords are
337
+ * emitted as plain data and the carried key, when present, as its own data.
338
+ *
339
+ * @returns The chord data sequence and the carried key, if any.
340
+ */
341
+ toJSON(): {
342
+ chords: Chord$1[];
343
+ key: {
344
+ scale: KeyScale;
345
+ tonic: Note$1;
346
+ } | undefined;
347
+ };
348
+ }
349
+
350
+ /**
351
+ * An immutable chord: a root pitch class, quality, interval template, and
352
+ * optional slash bass, optionally carrying a {@link Key} context. Analysis
353
+ * methods (`roman`, `function`, `analyze`, ...) use an explicitly passed key
354
+ * first and fall back to the carried context.
355
+ *
356
+ * @category Class API
357
+ * @example
358
+ * ```ts
359
+ * import { Chord } from '@libraz/libcantus';
360
+ * Chord.parse('Cmaj7').invert(1).symbol(); // 'Cmaj7/E' (third in the bass)
361
+ * ```
362
+ */
363
+ declare class Chord {
364
+ #private;
365
+ /**
366
+ * Wrap a plain chord object.
367
+ *
368
+ * @param data The chord; it is copied, never retained or mutated.
369
+ * @param key Optional key context for analysis methods.
370
+ */
371
+ constructor(data: Chord$1, key?: Key);
372
+ /**
373
+ * Build a chord from a root and quality.
374
+ *
375
+ * @param root Root as a note name (e.g. `'Eb'`) or a pitch class.
376
+ * @param quality The chord quality.
377
+ * @param bass Optional slash-chord bass pitch class.
378
+ * @returns The chord (without key context).
379
+ */
380
+ static of(root: string | number, quality: ChordQuality, bass?: number): Chord;
381
+ /**
382
+ * Wrap an existing plain chord object.
383
+ *
384
+ * @param data The plain chord.
385
+ * @returns The wrapped chord (without key context).
386
+ */
387
+ static from(data: Chord$1): Chord;
388
+ /**
389
+ * Parse a lead-sheet chord symbol (e.g. `'Cmaj7'`, `'F#m7b5'`, `'C/G'`).
390
+ *
391
+ * @param symbol The chord symbol.
392
+ * @returns The chord (without key context).
393
+ * @throws If the root or quality is not recognized.
394
+ */
395
+ static parse(symbol: string): Chord;
396
+ /**
397
+ * Identify the chords matching a set of pitches, best interpretation first.
398
+ *
399
+ * @param pitches MIDI pitches or bare pitch classes.
400
+ * @returns Ranked chord interpretations (may be empty).
401
+ */
402
+ static detect(pitches: number[]): Chord[];
403
+ /**
404
+ * The single best chord interpretation of a pitch set.
405
+ *
406
+ * @param pitches MIDI pitches or bare pitch classes.
407
+ * @returns The top-ranked chord, or null when nothing matches.
408
+ */
409
+ static detectBest(pitches: number[]): Chord | null;
410
+ /** The root pitch class (0..11). */
411
+ get rootPc(): number;
412
+ /** The chord quality. */
413
+ get quality(): ChordQuality;
414
+ /** A copy of the semitone offsets above the root. */
415
+ get intervals(): number[];
416
+ /** The slash-chord bass pitch class, or undefined in root position. */
417
+ get bassPc(): number | undefined;
418
+ /** A copy of the underlying plain chord object. */
419
+ get data(): Chord$1;
420
+ /** The carried key context, if any. */
421
+ get key(): Key | undefined;
422
+ /**
423
+ * A copy of this chord carrying the given key context.
424
+ *
425
+ * @param key The key context to attach.
426
+ * @returns The new chord.
427
+ */
428
+ withKey(key: Key): Chord;
429
+ /**
430
+ * The chord's sorted, deduplicated pitch classes.
431
+ *
432
+ * @returns Pitch classes ascending in [0, 11].
433
+ */
434
+ pitchClasses(): number[];
435
+ /**
436
+ * The chord's Roman numeral in a key.
437
+ *
438
+ * @param key Key to analyze in; falls back to the carried context.
439
+ * @returns The Roman numeral string.
440
+ * @throws If no key is given and none is carried.
441
+ */
442
+ roman(key?: Key): string;
443
+ /**
444
+ * The chord's harmonic function (tonic / subdominant / dominant) in a key.
445
+ *
446
+ * @param key Key to analyze in; falls back to the carried context.
447
+ * @returns The harmonic function.
448
+ * @throws If no key is given and none is carried.
449
+ */
450
+ function(key?: Key): HarmonicFunction;
451
+ /**
452
+ * Full functional analysis: function, borrowing, and Roman numeral.
453
+ *
454
+ * @param key Key to analyze in; falls back to the carried context.
455
+ * @returns The chord analysis.
456
+ * @throws If no key is given and none is carried.
457
+ */
458
+ analyze(key?: Key): ChordAnalysis;
459
+ /**
460
+ * Whether the chord is borrowed from the parallel mode (modal interchange).
461
+ *
462
+ * @param key Key to analyze in; falls back to the carried context.
463
+ * @returns True if the chord is borrowed.
464
+ * @throws If no key is given and none is carried.
465
+ */
466
+ isBorrowed(key?: Key): boolean;
467
+ /**
468
+ * The origin of a non-diatonic chord (parallel mode or Neapolitan), or null.
469
+ *
470
+ * @param key Key to analyze in; falls back to the carried context.
471
+ * @returns The borrowing source, or null.
472
+ * @throws If no key is given and none is carried.
473
+ */
474
+ borrowedSource(key?: Key): BorrowedSource;
475
+ /**
476
+ * The chord rendered as a lead-sheet symbol (e.g. `'Cmaj7'`, `'F#m7'`, `'C/G'`).
477
+ *
478
+ * @param opts Set `flats: true` to spell the root/bass with flats.
479
+ * @returns The chord symbol.
480
+ */
481
+ symbol(opts?: {
482
+ flats?: boolean;
483
+ }): string;
484
+ /**
485
+ * Realize the chord as one MIDI pitch per voice, ascending.
486
+ *
487
+ * @param opts Voicing options; defaults to four SATB voices.
488
+ * @returns MIDI pitches, ascending, one per voice.
489
+ * @throws If no voicing fits the given ranges.
490
+ */
491
+ voice(opts?: VoicingOptions): number[];
492
+ /**
493
+ * Realize the chord as a single styled voicing (`close`, `drop2`, `drop3`,
494
+ * `shell`, or `rootless`), optionally constraining the top voice.
495
+ *
496
+ * @param opts Styled-voicing options; defaults to a close-position voicing.
497
+ * @returns MIDI pitches, ascending.
498
+ */
499
+ styledVoicing(opts?: StyledVoicingOptions): number[];
500
+ /**
501
+ * The negative-harmony mirror of the chord about the key's tonic–dominant
502
+ * axis (major becomes minor and vice versa).
503
+ *
504
+ * @param key Key providing the reflection axis; falls back to the carried
505
+ * context.
506
+ * @returns The mirrored chord, keeping any key context.
507
+ * @throws If no key is given and none is carried.
508
+ */
509
+ negativeHarmony(key?: Key): Chord;
510
+ /**
511
+ * The n-th inversion: a copy whose bass is the chord tone `n` steps above the
512
+ * root in the interval template (`invert(1)` puts the third in the bass).
513
+ * `n` wraps around the template length; negative values count backwards.
514
+ *
515
+ * `invert(0)` (and any `n` that wraps to it) is root position, so it carries
516
+ * no slash bass and equals the original chord.
517
+ *
518
+ * @param n The inversion number.
519
+ * @returns The inverted chord, keeping any key context.
520
+ * @throws If the chord has no intervals.
521
+ */
522
+ invert(n: number): Chord;
523
+ /**
524
+ * The named scales that fit over this chord, best fit first, rooted on the
525
+ * chord root.
526
+ *
527
+ * @returns The matching scales.
528
+ */
529
+ scales(): ChordScaleMatch[];
530
+ /**
531
+ * The available tensions (usable non-chord, non-avoid scale tones) of a
532
+ * scale over this chord.
533
+ *
534
+ * @param scaleName A named scale, rooted on the chord root.
535
+ * @returns Tension pitch classes, ascending in [0, 11].
536
+ */
537
+ tensions(scaleName: string): number[];
538
+ /**
539
+ * The avoid notes (scale tones a semitone above a chord tone) of a scale
540
+ * over this chord.
541
+ *
542
+ * @param scaleName A named scale, rooted on the chord root.
543
+ * @returns Avoid-note pitch classes, ascending in [0, 11].
544
+ */
545
+ avoidNotes(scaleName: string): number[];
546
+ /**
547
+ * Spell the chord tones with letter names, root first, in the key's spelling.
548
+ *
549
+ * @param key Key providing the spelled tonic; falls back to the carried
550
+ * context.
551
+ * @returns Spelled octave-less notes in the chord's own (tertian) order.
552
+ * @throws If no key is given and none is carried.
553
+ */
554
+ spell(key?: Key): Note[];
555
+ /**
556
+ * Start a progression with this chord followed by others, carrying this
557
+ * chord's key context (if any).
558
+ *
559
+ * @param others The chords following this one.
560
+ * @returns The progression.
561
+ */
562
+ progressionTo(...others: Chord[]): Progression;
563
+ /**
564
+ * Whether another chord has the same root, quality, intervals, and bass.
565
+ * Key context is not compared.
566
+ *
567
+ * @param other The chord to compare.
568
+ * @returns True if the chord data is identical.
569
+ */
570
+ equals(other: Chord): boolean;
571
+ /**
572
+ * The plain chord data, for JSON serialization.
573
+ *
574
+ * @returns A copy of the underlying plain chord object.
575
+ */
576
+ toJSON(): Chord$1;
577
+ }
578
+
579
+ /**
580
+ * An immutable spelled interval value: a diatonic number, a quality label, and
581
+ * a signed semitone span. A thin convenience wrapper over the pitch module's
582
+ * plain interval result.
583
+ *
584
+ * @category Class API
585
+ * @example
586
+ * ```ts
587
+ * import { Interval, Note } from '@libraz/libcantus';
588
+ * Interval.between(Note.of('C4'), Note.of('G4')).name; // 'P5'
589
+ * ```
590
+ */
591
+ declare class Interval {
592
+ #private;
593
+ private constructor();
594
+ /**
595
+ * The spelled interval between two notes.
596
+ *
597
+ * @param a The first note.
598
+ * @param b The second note.
599
+ * @returns The interval from `a` to `b`.
600
+ */
601
+ static between(a: Note, b: Note): Interval;
602
+ /**
603
+ * Build an interval from explicit components.
604
+ *
605
+ * @param numberValue Diatonic size: 1 = unison, 2 = second, ... 8 = octave.
606
+ * @param quality Quality label: `'P'`, `'M'`, `'m'`, or repeated `'A'`/`'d'`.
607
+ * @param semitones Signed semitone span.
608
+ * @returns The interval.
609
+ */
610
+ static of(numberValue: number, quality: string, semitones: number): Interval;
611
+ /** Diatonic size: 1 = unison, 2 = second, ... 8 = octave, and beyond. */
612
+ get number(): number;
613
+ /** Quality label: `'P'`, `'M'`, `'m'`, or repeated `'A'`/`'d'`. */
614
+ get quality(): string;
615
+ /** Signed semitone span. */
616
+ get semitones(): number;
617
+ /** A readable label composed of quality and number, e.g. `'P5'` or `'M3'`. */
618
+ get name(): string;
619
+ /**
620
+ * The plain interval data, for JSON serialization.
621
+ *
622
+ * Private class fields do not serialize, so an explicit `toJSON` keeps
623
+ * `JSON.stringify(interval)` from collapsing to `{}`.
624
+ *
625
+ * @returns The diatonic number, quality, and semitone span.
626
+ */
627
+ toJSON(): SpelledInterval;
628
+ }
629
+
630
+ export { Chord, Interval, Key, Note, Progression };