@libraz/libcantus 0.9.3 → 0.9.5

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 (201) hide show
  1. package/README.md +29 -20
  2. package/README_ja.md +268 -0
  3. package/dist/analyze/index.cjs +39 -1947
  4. package/dist/analyze/index.cjs.map +1 -1
  5. package/dist/analyze/index.d.cts +161 -91
  6. package/dist/analyze/index.d.ts +161 -91
  7. package/dist/analyze/index.js +19 -8
  8. package/dist/chunk-2A2QMA74.cjs +261 -0
  9. package/dist/chunk-2A2QMA74.cjs.map +1 -0
  10. package/dist/chunk-2PTFGVD7.js +261 -0
  11. package/dist/chunk-2PTFGVD7.js.map +1 -0
  12. package/dist/chunk-357ZDPVU.cjs +162 -0
  13. package/dist/chunk-357ZDPVU.cjs.map +1 -0
  14. package/dist/chunk-3KX76RLG.js +1548 -0
  15. package/dist/chunk-3KX76RLG.js.map +1 -0
  16. package/dist/chunk-4VZ5MZAM.cjs +889 -0
  17. package/dist/chunk-4VZ5MZAM.cjs.map +1 -0
  18. package/dist/{chunk-C5XYKUVG.js → chunk-7EONYVI5.js} +471 -171
  19. package/dist/chunk-7EONYVI5.js.map +1 -0
  20. package/dist/{chunk-IT2O4XFE.js → chunk-7JEP3MFY.js} +42 -34
  21. package/dist/chunk-7JEP3MFY.js.map +1 -0
  22. package/dist/{chunk-4MHA432G.js → chunk-AID75RN3.js} +572 -250
  23. package/dist/chunk-AID75RN3.js.map +1 -0
  24. package/dist/chunk-BSLTLGM3.cjs +497 -0
  25. package/dist/chunk-BSLTLGM3.cjs.map +1 -0
  26. package/dist/chunk-CU6VG2YM.cjs +109 -0
  27. package/dist/chunk-CU6VG2YM.cjs.map +1 -0
  28. package/dist/{chunk-EH6EM37U.js → chunk-DZMHIGI4.js} +81 -59
  29. package/dist/chunk-DZMHIGI4.js.map +1 -0
  30. package/dist/{chunk-AKLYPWIN.js → chunk-EDOTEABK.js} +45 -19
  31. package/dist/chunk-EDOTEABK.js.map +1 -0
  32. package/dist/{chunk-2ZWMSJH6.js → chunk-HN2OEUN2.js} +7 -4
  33. package/dist/chunk-HN2OEUN2.js.map +1 -0
  34. package/dist/{chunk-MIWO425M.js → chunk-KBTTEX7Q.js} +128 -43
  35. package/dist/chunk-KBTTEX7Q.js.map +1 -0
  36. package/dist/chunk-KQN2ZYND.cjs +724 -0
  37. package/dist/chunk-KQN2ZYND.cjs.map +1 -0
  38. package/dist/chunk-MPTVJIVG.cjs +3176 -0
  39. package/dist/chunk-MPTVJIVG.cjs.map +1 -0
  40. package/dist/chunk-MTMZTMWM.cjs +53 -0
  41. package/dist/chunk-MTMZTMWM.cjs.map +1 -0
  42. package/dist/{chunk-CHMXELDS.js → chunk-NNB67XA2.js} +372 -197
  43. package/dist/chunk-NNB67XA2.js.map +1 -0
  44. package/dist/chunk-OL3IHHSJ.cjs +1204 -0
  45. package/dist/chunk-OL3IHHSJ.cjs.map +1 -0
  46. package/dist/chunk-PI3UXRWK.cjs +528 -0
  47. package/dist/chunk-PI3UXRWK.cjs.map +1 -0
  48. package/dist/chunk-R2VVFAIN.js +528 -0
  49. package/dist/chunk-R2VVFAIN.js.map +1 -0
  50. package/dist/chunk-T64C7ZD7.cjs +1 -0
  51. package/dist/chunk-T64C7ZD7.cjs.map +1 -0
  52. package/dist/chunk-WFDXOLUB.cjs +337 -0
  53. package/dist/chunk-WFDXOLUB.cjs.map +1 -0
  54. package/dist/chunk-WTAN4ACG.cjs +1548 -0
  55. package/dist/chunk-WTAN4ACG.cjs.map +1 -0
  56. package/dist/chunk-YFJXS3AU.cjs +33 -0
  57. package/dist/chunk-YFJXS3AU.cjs.map +1 -0
  58. package/dist/{chunk-GOAW4VYL.js → chunk-YUE6TJ4M.js} +315 -145
  59. package/dist/chunk-YUE6TJ4M.js.map +1 -0
  60. package/dist/{chunk-62QZKCJQ.js → chunk-ZGLJM4A4.js} +10 -6
  61. package/dist/chunk-ZGLJM4A4.js.map +1 -0
  62. package/dist/core/index.cjs +140 -647
  63. package/dist/core/index.cjs.map +1 -1
  64. package/dist/core/index.d.cts +313 -41
  65. package/dist/core/index.d.ts +313 -41
  66. package/dist/core/index.js +64 -16
  67. package/dist/{function-DVH4Eusr.d.ts → function-CxixTB02.d.cts} +122 -10
  68. package/dist/{function-DYt4iKsn.d.cts → function-DTCt675z.d.ts} +122 -10
  69. package/dist/generate/index.cjs +28 -4085
  70. package/dist/generate/index.cjs.map +1 -1
  71. package/dist/generate/index.d.cts +374 -66
  72. package/dist/generate/index.d.ts +374 -66
  73. package/dist/generate/index.js +23 -9
  74. package/dist/{index-Jc0Ryi79.d.ts → index-B2Ulxxpo.d.cts} +21 -5
  75. package/dist/{index-CpOsP1y9.d.cts → index-BkYJ0xMq.d.cts} +18 -17
  76. package/dist/{index-CxqBQtH1.d.cts → index-BuaB-ypt.d.ts} +21 -5
  77. package/dist/index-CAN7v-kw.d.ts +199 -0
  78. package/dist/{index-Bt4tOUD9.d.ts → index-COw1Ky9g.d.ts} +93 -8
  79. package/dist/{index-Dikst44v.d.cts → index-Cfx8xgH0.d.ts} +14 -11
  80. package/dist/{index-DxvARIP2.d.ts → index-DRtIhlJj.d.ts} +18 -17
  81. package/dist/{index-Cl7mhOFM.d.cts → index-DXd9JikN.d.cts} +92 -10
  82. package/dist/{index-Cl7mhOFM.d.ts → index-DXd9JikN.d.ts} +92 -10
  83. package/dist/index-alrRninU.d.cts +199 -0
  84. package/dist/{index-BNlGP86A.d.cts → index-oTQbYYIs.d.cts} +93 -8
  85. package/dist/index-tR9jTn26.d.cts +275 -0
  86. package/dist/index-tR9jTn26.d.ts +275 -0
  87. package/dist/{index-Bg5dYMmZ.d.ts → index-x2vcsduE.d.cts} +14 -11
  88. package/dist/index.cjs +429 -7383
  89. package/dist/index.cjs.map +1 -1
  90. package/dist/index.d.cts +15 -15
  91. package/dist/index.d.ts +15 -15
  92. package/dist/index.js +121 -27
  93. package/dist/model/index.cjs +8 -2562
  94. package/dist/model/index.cjs.map +1 -1
  95. package/dist/model/index.d.cts +471 -81
  96. package/dist/model/index.d.ts +471 -81
  97. package/dist/model/index.js +6 -7
  98. package/dist/styled-Bl0ZK28h.d.ts +543 -0
  99. package/dist/styled-Crv6SA4S.d.cts +543 -0
  100. package/dist/theory/index.cjs +172 -1822
  101. package/dist/theory/index.cjs.map +1 -1
  102. package/dist/theory/index.d.cts +151 -233
  103. package/dist/theory/index.d.ts +151 -233
  104. package/dist/theory/index.js +30 -7
  105. package/dist/{types-MGP29r3t.d.cts → types-BN6_Q9Kl.d.cts} +11 -2
  106. package/dist/{types-MGP29r3t.d.ts → types-BN6_Q9Kl.d.ts} +11 -2
  107. package/package.json +34 -13
  108. package/dist/chunk-2ZWMSJH6.js.map +0 -1
  109. package/dist/chunk-4MHA432G.js.map +0 -1
  110. package/dist/chunk-62QZKCJQ.js.map +0 -1
  111. package/dist/chunk-AKLYPWIN.js.map +0 -1
  112. package/dist/chunk-C5XYKUVG.js.map +0 -1
  113. package/dist/chunk-CHMXELDS.js.map +0 -1
  114. package/dist/chunk-DYWFNC4A.js +0 -152
  115. package/dist/chunk-DYWFNC4A.js.map +0 -1
  116. package/dist/chunk-EH6EM37U.js.map +0 -1
  117. package/dist/chunk-FBQK3ZQN.js +0 -131
  118. package/dist/chunk-FBQK3ZQN.js.map +0 -1
  119. package/dist/chunk-GOAW4VYL.js.map +0 -1
  120. package/dist/chunk-I5R7ZBJS.js +0 -202
  121. package/dist/chunk-I5R7ZBJS.js.map +0 -1
  122. package/dist/chunk-IT2O4XFE.js.map +0 -1
  123. package/dist/chunk-MIWO425M.js.map +0 -1
  124. package/dist/chunk-SGU7SPLK.js +0 -924
  125. package/dist/chunk-SGU7SPLK.js.map +0 -1
  126. package/dist/index-CGMZNCx6.d.cts +0 -140
  127. package/dist/index-CGMZNCx6.d.ts +0 -140
  128. package/dist/index-CnZCo29u.d.cts +0 -108
  129. package/dist/index-JnF4v9bx.d.ts +0 -108
  130. package/dist/styled-DZ7GjShb.d.ts +0 -282
  131. package/dist/styled-ZTbdaVFM.d.cts +0 -282
  132. package/src/analyze/arrange/index.ts +0 -21
  133. package/src/analyze/arrange/internal.ts +0 -127
  134. package/src/analyze/arrange/tension.ts +0 -199
  135. package/src/analyze/arrange/tracks.ts +0 -312
  136. package/src/analyze/detect/index.ts +0 -272
  137. package/src/analyze/functional/borrowed.ts +0 -84
  138. package/src/analyze/functional/cadence.ts +0 -66
  139. package/src/analyze/functional/function.ts +0 -184
  140. package/src/analyze/functional/index.ts +0 -23
  141. package/src/analyze/functional/internal.ts +0 -29
  142. package/src/analyze/functional/roman.ts +0 -402
  143. package/src/analyze/index.ts +0 -49
  144. package/src/analyze/timeline/index.ts +0 -451
  145. package/src/analyze/voice/index.ts +0 -339
  146. package/src/core/event-index/index.ts +0 -104
  147. package/src/core/index.ts +0 -61
  148. package/src/core/interval/index.ts +0 -81
  149. package/src/core/meter/index.ts +0 -302
  150. package/src/core/pitch/index.ts +0 -311
  151. package/src/core/random/index.ts +0 -76
  152. package/src/core/tuning/index.ts +0 -186
  153. package/src/core/types.ts +0 -29
  154. package/src/core/validation/index.ts +0 -119
  155. package/src/generate/bass/index.ts +0 -373
  156. package/src/generate/countermelody/index.ts +0 -470
  157. package/src/generate/drums/beat.ts +0 -266
  158. package/src/generate/drums/euclid.ts +0 -65
  159. package/src/generate/drums/fills.ts +0 -356
  160. package/src/generate/drums/ghost.ts +0 -119
  161. package/src/generate/drums/hihat.ts +0 -285
  162. package/src/generate/drums/hit.ts +0 -31
  163. package/src/generate/drums/index.ts +0 -361
  164. package/src/generate/drums/internal.ts +0 -257
  165. package/src/generate/drums/kick.ts +0 -160
  166. package/src/generate/drums/percussion.ts +0 -121
  167. package/src/generate/drums/rng.ts +0 -7
  168. package/src/generate/drums/swing.ts +0 -71
  169. package/src/generate/groove/index.ts +0 -351
  170. package/src/generate/harmonize/index.ts +0 -451
  171. package/src/generate/index.ts +0 -58
  172. package/src/generate/motif/index.ts +0 -422
  173. package/src/generate/progression/index.ts +0 -362
  174. package/src/generate/reharmony/index.ts +0 -323
  175. package/src/generate/rhythm/index.ts +0 -175
  176. package/src/index.ts +0 -13
  177. package/src/model/chord.ts +0 -442
  178. package/src/model/index.ts +0 -15
  179. package/src/model/interval.ts +0 -82
  180. package/src/model/key.ts +0 -266
  181. package/src/model/note.ts +0 -176
  182. package/src/model/progression.ts +0 -161
  183. package/src/model/shared.ts +0 -12
  184. package/src/theory/chord/index.ts +0 -375
  185. package/src/theory/chordscale/index.ts +0 -374
  186. package/src/theory/counterpoint/index.ts +0 -230
  187. package/src/theory/harmony/index.ts +0 -77
  188. package/src/theory/index.ts +0 -112
  189. package/src/theory/safety/index.ts +0 -488
  190. package/src/theory/scale/degrees.ts +0 -123
  191. package/src/theory/scale/index.ts +0 -28
  192. package/src/theory/scale/key.ts +0 -56
  193. package/src/theory/scale/masks.ts +0 -153
  194. package/src/theory/spelling/index.ts +0 -249
  195. package/src/theory/symbol/index.ts +0 -268
  196. package/src/theory/voicing/index.ts +0 -5
  197. package/src/theory/voicing/internal.ts +0 -168
  198. package/src/theory/voicing/leading.ts +0 -112
  199. package/src/theory/voicing/satb.ts +0 -216
  200. package/src/theory/voicing/styled.ts +0 -199
  201. package/tsconfig.json +0 -23
@@ -0,0 +1,275 @@
1
+ /**
2
+ * Pitch spelling: letter-name notes, enharmonic-aware conversion, and spelled
3
+ * intervals.
4
+ *
5
+ * The rest of the library works in pitch classes (0..11), which cannot tell a
6
+ * G# from an Ab or an augmented fourth from a diminished fifth. This module adds
7
+ * an explicit spelling layer — a note is a diatonic letter plus a chromatic
8
+ * alteration — so interval quality (P/M/m/A/d) and enharmonic identity are
9
+ * preserved.
10
+ */
11
+ /**
12
+ * A spelled note: a diatonic letter, a chromatic alteration, and an optional
13
+ * octave.
14
+ *
15
+ * - `letter` is 0..6 for C..B.
16
+ * - `alter` is the number of semitones of alteration: -2 double-flat, -1 flat,
17
+ * 0 natural, +1 sharp, +2 double-sharp.
18
+ * - `octave` follows scientific pitch notation (middle C = C4 = MIDI 60). When
19
+ * absent, the note denotes a bare pitch class.
20
+ *
21
+ * @category Pitch & Intervals
22
+ */
23
+ type Note = {
24
+ letter: number;
25
+ alter: number;
26
+ octave?: number;
27
+ };
28
+ /**
29
+ * The quality label of a spelled interval: perfect, major, minor, or one or
30
+ * more augmentations or diminutions.
31
+ *
32
+ * This names how an interval is *spelled*. It is a different notion from
33
+ * {@link ConsonanceClass}, which classifies how an interval *sounds* against
34
+ * another voice.
35
+ *
36
+ * @see {@link ConsonanceClass}
37
+ * @category Pitch & Intervals
38
+ */
39
+ type IntervalQualityLabel = 'P' | 'M' | 'm' | `A${string}` | `d${string}`;
40
+ /**
41
+ * A spelled interval: a diatonic number, a quality label, and its semitone span.
42
+ *
43
+ * @category Pitch & Intervals
44
+ */
45
+ type SpelledInterval = {
46
+ /** Diatonic size: 1 = unison, 2 = second, ... 8 = octave, and beyond. */
47
+ number: number;
48
+ /** Quality label: 'P', 'M', 'm', or repeated 'A'/'d' for (multiply) aug/dim. */
49
+ quality: IntervalQualityLabel;
50
+ /** Signed semitone distance from the first note to the second. */
51
+ semitones: number;
52
+ /** True when the diatonic letter movement is descending despite a zero span. */
53
+ descending?: boolean;
54
+ };
55
+ /**
56
+ * Reduce a MIDI pitch, a bare pitch class, or any signed offset to a pitch
57
+ * class in [0, 11].
58
+ *
59
+ * This is the library's single definition of pitch-class arithmetic: every
60
+ * layer routes through it so a fractional pitch reduces the same way
61
+ * everywhere. A non-integral input is rounded to the nearest semitone first, so
62
+ * a microtonal 60.6 reads as C# rather than C.
63
+ *
64
+ * @param value A MIDI pitch, pitch class, or signed semitone offset.
65
+ * @returns The pitch class in [0, 11].
66
+ * @example
67
+ * ```ts
68
+ * import { pitchClassOf } from '@libraz/libcantus';
69
+ * pitchClassOf(61); // 1
70
+ * pitchClassOf(-1); // 11
71
+ * pitchClassOf(60.6); // 1
72
+ * ```
73
+ * @category Pitch & Intervals
74
+ */
75
+ declare function pitchClassOf(value: number): number;
76
+ /**
77
+ * Reduce a letter number or letter offset to a diatonic letter in [0, 6]
78
+ * (0 = C .. 6 = B).
79
+ *
80
+ * @param value A letter number or signed letter offset.
81
+ * @returns The diatonic letter in [0, 6].
82
+ * @category Pitch & Intervals
83
+ */
84
+ declare function diatonicLetterOf(value: number): number;
85
+ /**
86
+ * The pitch class of a diatonic letter with no accidental (C = 0, D = 2, ...).
87
+ *
88
+ * @param letter A letter number or signed letter offset; reduced to [0, 6].
89
+ * @returns The natural pitch class of that letter.
90
+ * @category Pitch & Intervals
91
+ */
92
+ declare function naturalPitchClassOf(letter: number): number;
93
+ /**
94
+ * Parse scientific pitch notation into a {@link Note}.
95
+ *
96
+ * Accepts a letter (case-insensitive) followed by any number of same-direction
97
+ * accidentals and an optional octave, e.g. `"C"`, `"C#4"`, `"Bb"`, `"F##3"`,
98
+ * `"Ebb2"`. Both `#` and `x` (double-sharp) are accepted for sharps; `b` for
99
+ * flats. Mixing sharps and flats (e.g. `"C#b"`) is rejected.
100
+ *
101
+ * @param text The note text.
102
+ * @returns The parsed note.
103
+ * @throws If the text is not a valid note.
104
+ * @example
105
+ * ```ts
106
+ * import { parseNote, noteToMidi } from '@libraz/libcantus';
107
+ * const n = parseNote('C#4');
108
+ * noteToMidi(n); // 61
109
+ * ```
110
+ * @category Pitch & Intervals
111
+ */
112
+ declare function parseNote(text: string): Note;
113
+ /**
114
+ * Render a {@link Note} as scientific pitch notation.
115
+ *
116
+ * @param note The note to format.
117
+ * @returns The note text, including the octave when present.
118
+ * @example
119
+ * ```ts
120
+ * import { formatNote, parseNote } from '@libraz/libcantus';
121
+ * formatNote(parseNote('C#4')); // 'C#4'
122
+ * ```
123
+ * @category Pitch & Intervals
124
+ */
125
+ declare function formatNote(note: Note): string;
126
+ /**
127
+ * Pitch class (0..11) of a note, ignoring octave.
128
+ *
129
+ * @param note The note.
130
+ * @returns The pitch class.
131
+ * @example
132
+ * ```ts
133
+ * import { noteToPitchClass, parseNote } from '@libraz/libcantus';
134
+ * noteToPitchClass(parseNote('Db')); // 1
135
+ * ```
136
+ * @category Pitch & Intervals
137
+ */
138
+ declare function noteToPitchClass(note: Note): number;
139
+ /**
140
+ * MIDI number of a note (middle C = C4 = 60).
141
+ *
142
+ * @param note The note; must carry an octave.
143
+ * @returns The MIDI number.
144
+ * @throws If the note has no octave.
145
+ * @example
146
+ * ```ts
147
+ * import { noteToMidi, parseNote } from '@libraz/libcantus';
148
+ * noteToMidi(parseNote('A4')); // 69
149
+ * ```
150
+ * @category Pitch & Intervals
151
+ */
152
+ declare function noteToMidi(note: Note): number;
153
+ /**
154
+ * Name a MIDI number as a {@link Note}, choosing sharp or flat spelling.
155
+ *
156
+ * The input is rounded to the nearest integer but is not clamped to the MIDI
157
+ * range 0..127: out-of-range values extrapolate linearly (e.g. `-1` -> `B-2`,
158
+ * `128` -> `G#9`) and remain an exact inverse of {@link noteToMidi}.
159
+ *
160
+ * @param midi The MIDI number.
161
+ * @param spelling Whether to prefer sharps or flats for black keys.
162
+ * @returns The spelled note, with octave.
163
+ * @example
164
+ * ```ts
165
+ * import { midiToNote, formatNote } from '@libraz/libcantus';
166
+ * formatNote(midiToNote(61)); // 'C#4'
167
+ * formatNote(midiToNote(61, 'flat')); // 'Db4'
168
+ * ```
169
+ * @category Pitch & Intervals
170
+ */
171
+ declare function midiToNote(midi: number, spelling?: 'sharp' | 'flat'): Note;
172
+ /**
173
+ * Transpose a note by a signed number of semitones, keeping its spelling.
174
+ *
175
+ * The letter moves by the diatonic distance of the conventional interval for
176
+ * that many semitones and the accidental is recomputed for the new letter, so
177
+ * enharmonic identity survives: `Ab4` up a major second is `Bb4`, not `A#4`, and
178
+ * the operation is an exact inverse of itself. An octave-less note stays
179
+ * octave-less.
180
+ *
181
+ * A bare semitone count cannot distinguish an augmented fourth from a diminished
182
+ * fifth; pass `spelling` to override the letter distance when the enharmonic
183
+ * choice matters.
184
+ *
185
+ * @param note The note to transpose.
186
+ * @param semitones The signed semitone offset.
187
+ * @param opts `spelling` forces the result onto the sharp or flat side instead
188
+ * of following the source note's letter.
189
+ * @returns The transposed note.
190
+ * @example
191
+ * ```ts
192
+ * import { transposeNote, formatNote, parseNote } from '@libraz/libcantus';
193
+ * formatNote(transposeNote(parseNote('Ab4'), 2)); // 'Bb4'
194
+ * formatNote(transposeNote(parseNote('Ab4'), 2, { spelling: 'sharp' })); // 'A#4'
195
+ * ```
196
+ * @category Pitch & Intervals
197
+ */
198
+ declare function transposeNote(note: Note, semitones: number, opts?: {
199
+ spelling?: 'sharp' | 'flat';
200
+ }): Note;
201
+ /**
202
+ * The semitone span of the interval named by a diatonic number and a quality.
203
+ *
204
+ * The inverse of the quality derivation in {@link spelledInterval}: it turns a
205
+ * name back into a distance, which is what transposing by a named interval or
206
+ * parsing one from text needs.
207
+ *
208
+ * @param numberValue Diatonic size: 1 = unison, 2 = second, ... 8 = octave.
209
+ * @param quality Quality label: `'P'`, `'M'`, `'m'`, or repeated `'A'`/`'d'`.
210
+ * @returns The unsigned semitone span.
211
+ * @throws If the quality cannot apply to the number, such as a major fifth.
212
+ * @example
213
+ * ```ts
214
+ * import { intervalSemitones } from '@libraz/libcantus';
215
+ * intervalSemitones(5, 'P'); // 7
216
+ * ```
217
+ * @category Pitch & Intervals
218
+ */
219
+ declare function intervalSemitones(numberValue: number, quality: IntervalQualityLabel): number;
220
+ /**
221
+ * Parse an interval name such as `'P5'`, `'m3'`, or `'AA4'`.
222
+ *
223
+ * @param name The interval name: a quality label followed by a diatonic number.
224
+ * @returns The spelled interval. Diminished unisons have a descending
225
+ * (negative) semitone span; all other supported names are ascending.
226
+ * @throws If the name is not a quality label followed by a number, or the two
227
+ * cannot describe the same interval.
228
+ * @example
229
+ * ```ts
230
+ * import { parseInterval } from '@libraz/libcantus';
231
+ * parseInterval('m3'); // { number: 3, quality: 'm', semitones: 3 }
232
+ * ```
233
+ * @category Pitch & Intervals
234
+ */
235
+ declare function parseInterval(name: string): SpelledInterval;
236
+ /**
237
+ * Transpose a note by a spelled interval, keeping the spelling the interval
238
+ * names.
239
+ *
240
+ * Unlike {@link transposeNote}, which picks a letter from the semitone count,
241
+ * the diatonic number decides the letter here: transposing C by an augmented
242
+ * second gives D#, not Eb.
243
+ *
244
+ * @param note The note to transpose.
245
+ * @param interval The interval to apply; a negative span transposes downward.
246
+ * @returns The transposed note, octave-less if the source was.
247
+ * @example
248
+ * ```ts
249
+ * import { formatNote, parseInterval, parseNote, transposeByInterval } from '@libraz/libcantus';
250
+ * formatNote(transposeByInterval(parseNote('C4'), parseInterval('A2'))); // 'D#4'
251
+ * ```
252
+ * @category Pitch & Intervals
253
+ */
254
+ declare function transposeByInterval(note: Note, interval: SpelledInterval): Note;
255
+ /**
256
+ * The spelled interval from one note to another.
257
+ *
258
+ * When both notes carry octaves, the interval reflects their full signed
259
+ * distance (so `C4 -> C5` is a perfect octave). When either lacks an octave the
260
+ * interval is measured within a single ascending octave from `a` to `b`.
261
+ *
262
+ * @param a The lower/first note.
263
+ * @param b The upper/second note.
264
+ * @returns The diatonic number, quality, and semitone span.
265
+ * @example
266
+ * ```ts
267
+ * import { spelledInterval, parseNote } from '@libraz/libcantus';
268
+ * spelledInterval(parseNote('C4'), parseNote('G4'));
269
+ * // { number: 5, quality: 'P', semitones: 7 }
270
+ * ```
271
+ * @category Pitch & Intervals
272
+ */
273
+ declare function spelledInterval(a: Note, b: Note): SpelledInterval;
274
+
275
+ export { type IntervalQualityLabel as I, type Note as N, type SpelledInterval as S, noteToMidi as a, noteToPitchClass as b, parseNote as c, diatonicLetterOf as d, pitchClassOf as e, formatNote as f, transposeNote as g, intervalSemitones as i, midiToNote as m, naturalPitchClassOf as n, parseInterval as p, spelledInterval as s, transposeByInterval as t };
@@ -1,11 +1,11 @@
1
- import { C as Chord } from './index-Bt4tOUD9.js';
1
+ import { d as ChordToneRole, C as Chord } from './index-oTQbYYIs.cjs';
2
2
 
3
3
  /**
4
4
  * Harmonic role a pitch plays within a chord.
5
5
  *
6
6
  * @category Functional Harmony
7
7
  */
8
- type HarmonyRole = 'root' | 'third' | 'fifth' | 'sixth' | 'seventh' | 'tension' | 'doubling';
8
+ type HarmonyRole = ChordToneRole | 'tension' | 'doubling';
9
9
  /**
10
10
  * How firmly a pitch is locked to the chord's identity.
11
11
  *
@@ -29,15 +29,18 @@ type VoicedRole = {
29
29
  /**
30
30
  * Classify a pitch's harmonic role and lock level within a chord.
31
31
  *
32
- * The role comes from the pitch's interval class above the chord root: root (0),
33
- * third (3/4), fifth (6/7/8), seventh (10/11), and 9/11/13 tensions (2/5/9, and
34
- * the flat ninth 1). The root locks the chord identity, the third locks its
35
- * quality, and everything else is free voicing. In a suspended chord (a chord
36
- * whose intervals include a 4th (5) or 2nd (2) but no third), the suspended tone
37
- * takes the third's place as the quality-defining tone and is locked to
38
- * `quality`, since moving it changes the chord. Detecting an octave doubling
39
- * requires the surrounding voicing, which this single-pitch query does not carry,
40
- * so `doubling` is part of the type but not returned here.
32
+ * The role comes from the pitch's interval class above the chord root, read
33
+ * against the chord's own template: root (0), third (3/4), fifth (6/7/8),
34
+ * sixth or seventh (9/10/11). Every pitch the template does not claim is
35
+ * `'tension'` — including one that is simply foreign to the chord, which this
36
+ * single-pitch query cannot tell from a colour tone. The root locks the chord
37
+ * identity, the third locks its quality, and everything else is free voicing.
38
+ * In a suspended chord (a chord whose intervals include a 4th (5) or 2nd (2)
39
+ * but no third), the suspended tone takes the third's place as the
40
+ * quality-defining tone and is locked to `quality`, since moving it changes the
41
+ * chord. Detecting an octave doubling requires the surrounding voicing, which
42
+ * this query does not carry, so `'doubling'` is part of the type — the shared
43
+ * vocabulary of harmonic roles — but is never returned here.
41
44
  *
42
45
  * @param pitch MIDI pitch or bare pitch class.
43
46
  * @param chord The chord providing the root reference.