@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.
- package/README.md +29 -20
- package/README_ja.md +268 -0
- package/dist/analyze/index.cjs +39 -1947
- package/dist/analyze/index.cjs.map +1 -1
- package/dist/analyze/index.d.cts +161 -91
- package/dist/analyze/index.d.ts +161 -91
- package/dist/analyze/index.js +19 -8
- package/dist/chunk-2A2QMA74.cjs +261 -0
- package/dist/chunk-2A2QMA74.cjs.map +1 -0
- package/dist/chunk-2PTFGVD7.js +261 -0
- package/dist/chunk-2PTFGVD7.js.map +1 -0
- package/dist/chunk-357ZDPVU.cjs +162 -0
- package/dist/chunk-357ZDPVU.cjs.map +1 -0
- package/dist/chunk-3KX76RLG.js +1548 -0
- package/dist/chunk-3KX76RLG.js.map +1 -0
- package/dist/chunk-4VZ5MZAM.cjs +889 -0
- package/dist/chunk-4VZ5MZAM.cjs.map +1 -0
- package/dist/{chunk-C5XYKUVG.js → chunk-7EONYVI5.js} +471 -171
- package/dist/chunk-7EONYVI5.js.map +1 -0
- package/dist/{chunk-IT2O4XFE.js → chunk-7JEP3MFY.js} +42 -34
- package/dist/chunk-7JEP3MFY.js.map +1 -0
- package/dist/{chunk-4MHA432G.js → chunk-AID75RN3.js} +572 -250
- package/dist/chunk-AID75RN3.js.map +1 -0
- package/dist/chunk-BSLTLGM3.cjs +497 -0
- package/dist/chunk-BSLTLGM3.cjs.map +1 -0
- package/dist/chunk-CU6VG2YM.cjs +109 -0
- package/dist/chunk-CU6VG2YM.cjs.map +1 -0
- package/dist/{chunk-EH6EM37U.js → chunk-DZMHIGI4.js} +81 -59
- package/dist/chunk-DZMHIGI4.js.map +1 -0
- package/dist/{chunk-AKLYPWIN.js → chunk-EDOTEABK.js} +45 -19
- package/dist/chunk-EDOTEABK.js.map +1 -0
- package/dist/{chunk-2ZWMSJH6.js → chunk-HN2OEUN2.js} +7 -4
- package/dist/chunk-HN2OEUN2.js.map +1 -0
- package/dist/{chunk-MIWO425M.js → chunk-KBTTEX7Q.js} +128 -43
- package/dist/chunk-KBTTEX7Q.js.map +1 -0
- package/dist/chunk-KQN2ZYND.cjs +724 -0
- package/dist/chunk-KQN2ZYND.cjs.map +1 -0
- package/dist/chunk-MPTVJIVG.cjs +3176 -0
- package/dist/chunk-MPTVJIVG.cjs.map +1 -0
- package/dist/chunk-MTMZTMWM.cjs +53 -0
- package/dist/chunk-MTMZTMWM.cjs.map +1 -0
- package/dist/{chunk-CHMXELDS.js → chunk-NNB67XA2.js} +372 -197
- package/dist/chunk-NNB67XA2.js.map +1 -0
- package/dist/chunk-OL3IHHSJ.cjs +1204 -0
- package/dist/chunk-OL3IHHSJ.cjs.map +1 -0
- package/dist/chunk-PI3UXRWK.cjs +528 -0
- package/dist/chunk-PI3UXRWK.cjs.map +1 -0
- package/dist/chunk-R2VVFAIN.js +528 -0
- package/dist/chunk-R2VVFAIN.js.map +1 -0
- package/dist/chunk-T64C7ZD7.cjs +1 -0
- package/dist/chunk-T64C7ZD7.cjs.map +1 -0
- package/dist/chunk-WFDXOLUB.cjs +337 -0
- package/dist/chunk-WFDXOLUB.cjs.map +1 -0
- package/dist/chunk-WTAN4ACG.cjs +1548 -0
- package/dist/chunk-WTAN4ACG.cjs.map +1 -0
- package/dist/chunk-YFJXS3AU.cjs +33 -0
- package/dist/chunk-YFJXS3AU.cjs.map +1 -0
- package/dist/{chunk-GOAW4VYL.js → chunk-YUE6TJ4M.js} +315 -145
- package/dist/chunk-YUE6TJ4M.js.map +1 -0
- package/dist/{chunk-62QZKCJQ.js → chunk-ZGLJM4A4.js} +10 -6
- package/dist/chunk-ZGLJM4A4.js.map +1 -0
- package/dist/core/index.cjs +140 -647
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +313 -41
- package/dist/core/index.d.ts +313 -41
- package/dist/core/index.js +64 -16
- package/dist/{function-DVH4Eusr.d.ts → function-CxixTB02.d.cts} +122 -10
- package/dist/{function-DYt4iKsn.d.cts → function-DTCt675z.d.ts} +122 -10
- package/dist/generate/index.cjs +28 -4085
- package/dist/generate/index.cjs.map +1 -1
- package/dist/generate/index.d.cts +374 -66
- package/dist/generate/index.d.ts +374 -66
- package/dist/generate/index.js +23 -9
- package/dist/{index-Jc0Ryi79.d.ts → index-B2Ulxxpo.d.cts} +21 -5
- package/dist/{index-CpOsP1y9.d.cts → index-BkYJ0xMq.d.cts} +18 -17
- package/dist/{index-CxqBQtH1.d.cts → index-BuaB-ypt.d.ts} +21 -5
- package/dist/index-CAN7v-kw.d.ts +199 -0
- package/dist/{index-Bt4tOUD9.d.ts → index-COw1Ky9g.d.ts} +93 -8
- package/dist/{index-Dikst44v.d.cts → index-Cfx8xgH0.d.ts} +14 -11
- package/dist/{index-DxvARIP2.d.ts → index-DRtIhlJj.d.ts} +18 -17
- package/dist/{index-Cl7mhOFM.d.cts → index-DXd9JikN.d.cts} +92 -10
- package/dist/{index-Cl7mhOFM.d.ts → index-DXd9JikN.d.ts} +92 -10
- package/dist/index-alrRninU.d.cts +199 -0
- package/dist/{index-BNlGP86A.d.cts → index-oTQbYYIs.d.cts} +93 -8
- package/dist/index-tR9jTn26.d.cts +275 -0
- package/dist/index-tR9jTn26.d.ts +275 -0
- package/dist/{index-Bg5dYMmZ.d.ts → index-x2vcsduE.d.cts} +14 -11
- package/dist/index.cjs +429 -7383
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -15
- package/dist/index.d.ts +15 -15
- package/dist/index.js +121 -27
- package/dist/model/index.cjs +8 -2562
- package/dist/model/index.cjs.map +1 -1
- package/dist/model/index.d.cts +471 -81
- package/dist/model/index.d.ts +471 -81
- package/dist/model/index.js +6 -7
- package/dist/styled-Bl0ZK28h.d.ts +543 -0
- package/dist/styled-Crv6SA4S.d.cts +543 -0
- package/dist/theory/index.cjs +172 -1822
- package/dist/theory/index.cjs.map +1 -1
- package/dist/theory/index.d.cts +151 -233
- package/dist/theory/index.d.ts +151 -233
- package/dist/theory/index.js +30 -7
- package/dist/{types-MGP29r3t.d.cts → types-BN6_Q9Kl.d.cts} +11 -2
- package/dist/{types-MGP29r3t.d.ts → types-BN6_Q9Kl.d.ts} +11 -2
- package/package.json +34 -13
- package/dist/chunk-2ZWMSJH6.js.map +0 -1
- package/dist/chunk-4MHA432G.js.map +0 -1
- package/dist/chunk-62QZKCJQ.js.map +0 -1
- package/dist/chunk-AKLYPWIN.js.map +0 -1
- package/dist/chunk-C5XYKUVG.js.map +0 -1
- package/dist/chunk-CHMXELDS.js.map +0 -1
- package/dist/chunk-DYWFNC4A.js +0 -152
- package/dist/chunk-DYWFNC4A.js.map +0 -1
- package/dist/chunk-EH6EM37U.js.map +0 -1
- package/dist/chunk-FBQK3ZQN.js +0 -131
- package/dist/chunk-FBQK3ZQN.js.map +0 -1
- package/dist/chunk-GOAW4VYL.js.map +0 -1
- package/dist/chunk-I5R7ZBJS.js +0 -202
- package/dist/chunk-I5R7ZBJS.js.map +0 -1
- package/dist/chunk-IT2O4XFE.js.map +0 -1
- package/dist/chunk-MIWO425M.js.map +0 -1
- package/dist/chunk-SGU7SPLK.js +0 -924
- package/dist/chunk-SGU7SPLK.js.map +0 -1
- package/dist/index-CGMZNCx6.d.cts +0 -140
- package/dist/index-CGMZNCx6.d.ts +0 -140
- package/dist/index-CnZCo29u.d.cts +0 -108
- package/dist/index-JnF4v9bx.d.ts +0 -108
- package/dist/styled-DZ7GjShb.d.ts +0 -282
- package/dist/styled-ZTbdaVFM.d.cts +0 -282
- package/src/analyze/arrange/index.ts +0 -21
- package/src/analyze/arrange/internal.ts +0 -127
- package/src/analyze/arrange/tension.ts +0 -199
- package/src/analyze/arrange/tracks.ts +0 -312
- package/src/analyze/detect/index.ts +0 -272
- package/src/analyze/functional/borrowed.ts +0 -84
- package/src/analyze/functional/cadence.ts +0 -66
- package/src/analyze/functional/function.ts +0 -184
- package/src/analyze/functional/index.ts +0 -23
- package/src/analyze/functional/internal.ts +0 -29
- package/src/analyze/functional/roman.ts +0 -402
- package/src/analyze/index.ts +0 -49
- package/src/analyze/timeline/index.ts +0 -451
- package/src/analyze/voice/index.ts +0 -339
- package/src/core/event-index/index.ts +0 -104
- package/src/core/index.ts +0 -61
- package/src/core/interval/index.ts +0 -81
- package/src/core/meter/index.ts +0 -302
- package/src/core/pitch/index.ts +0 -311
- package/src/core/random/index.ts +0 -76
- package/src/core/tuning/index.ts +0 -186
- package/src/core/types.ts +0 -29
- package/src/core/validation/index.ts +0 -119
- package/src/generate/bass/index.ts +0 -373
- package/src/generate/countermelody/index.ts +0 -470
- package/src/generate/drums/beat.ts +0 -266
- package/src/generate/drums/euclid.ts +0 -65
- package/src/generate/drums/fills.ts +0 -356
- package/src/generate/drums/ghost.ts +0 -119
- package/src/generate/drums/hihat.ts +0 -285
- package/src/generate/drums/hit.ts +0 -31
- package/src/generate/drums/index.ts +0 -361
- package/src/generate/drums/internal.ts +0 -257
- package/src/generate/drums/kick.ts +0 -160
- package/src/generate/drums/percussion.ts +0 -121
- package/src/generate/drums/rng.ts +0 -7
- package/src/generate/drums/swing.ts +0 -71
- package/src/generate/groove/index.ts +0 -351
- package/src/generate/harmonize/index.ts +0 -451
- package/src/generate/index.ts +0 -58
- package/src/generate/motif/index.ts +0 -422
- package/src/generate/progression/index.ts +0 -362
- package/src/generate/reharmony/index.ts +0 -323
- package/src/generate/rhythm/index.ts +0 -175
- package/src/index.ts +0 -13
- package/src/model/chord.ts +0 -442
- package/src/model/index.ts +0 -15
- package/src/model/interval.ts +0 -82
- package/src/model/key.ts +0 -266
- package/src/model/note.ts +0 -176
- package/src/model/progression.ts +0 -161
- package/src/model/shared.ts +0 -12
- package/src/theory/chord/index.ts +0 -375
- package/src/theory/chordscale/index.ts +0 -374
- package/src/theory/counterpoint/index.ts +0 -230
- package/src/theory/harmony/index.ts +0 -77
- package/src/theory/index.ts +0 -112
- package/src/theory/safety/index.ts +0 -488
- package/src/theory/scale/degrees.ts +0 -123
- package/src/theory/scale/index.ts +0 -28
- package/src/theory/scale/key.ts +0 -56
- package/src/theory/scale/masks.ts +0 -153
- package/src/theory/spelling/index.ts +0 -249
- package/src/theory/symbol/index.ts +0 -268
- package/src/theory/voicing/index.ts +0 -5
- package/src/theory/voicing/internal.ts +0 -168
- package/src/theory/voicing/leading.ts +0 -112
- package/src/theory/voicing/satb.ts +0 -216
- package/src/theory/voicing/styled.ts +0 -199
- package/tsconfig.json +0 -23
|
@@ -1,282 +0,0 @@
|
|
|
1
|
-
import { C as Chord } from './index-Bt4tOUD9.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Test whether every chord pitch class is contained in a scale.
|
|
5
|
-
*
|
|
6
|
-
* @param chordPcs The chord's pitch classes (0..11).
|
|
7
|
-
* @param scaleMask The scale's 12-bit mode mask.
|
|
8
|
-
* @param scaleRootPc The pitch class the mask is rooted on.
|
|
9
|
-
* @returns True if the scale is a superset of the chord.
|
|
10
|
-
*
|
|
11
|
-
* @category Scales
|
|
12
|
-
*/
|
|
13
|
-
declare function scaleMatchesChord(chordPcs: number[], scaleMask: number, scaleRootPc: number): boolean;
|
|
14
|
-
/**
|
|
15
|
-
* A named scale rooted on a pitch class that fits over a chord.
|
|
16
|
-
*
|
|
17
|
-
* @category Scales
|
|
18
|
-
*/
|
|
19
|
-
type ChordScaleMatch = {
|
|
20
|
-
name: string;
|
|
21
|
-
rootPc: number;
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* List the scales that fit over a chord, best fit first.
|
|
25
|
-
*
|
|
26
|
-
* Only the chord root is considered as the scale root, matching the
|
|
27
|
-
* conventional chord-scale relationship. Every entry of {@link NAMED_SCALES}
|
|
28
|
-
* whose pitch-class set is a superset of the chord's is returned once per
|
|
29
|
-
* distinct pitch-class set (aliased masks such as major/ionian report only the
|
|
30
|
-
* modal name), ranked by fewest extra scale tones beyond the chord, then by
|
|
31
|
-
* scale size (heptatonic before larger scales), then by scale name. For bare
|
|
32
|
-
* triads and smaller chords, heptatonic scales rank before pentatonics and
|
|
33
|
-
* other sizes: a pentatonic adds no modal color over a triad, so the seven-note
|
|
34
|
-
* modes are the more useful answer. The chromatic scale is only returned as a
|
|
35
|
-
* fallback when no other scale contains the chord.
|
|
36
|
-
*
|
|
37
|
-
* @param chord The chord to fit scales over.
|
|
38
|
-
* @returns The matching scales rooted on the chord root, best fit first.
|
|
39
|
-
*
|
|
40
|
-
* @example
|
|
41
|
-
* ```ts
|
|
42
|
-
* import { makeChord, chordScales } from '@libraz/libcantus';
|
|
43
|
-
* const scales = chordScales(makeChord(0, 'maj7'));
|
|
44
|
-
* // scales for Cmaj7, best fit first; each is { name, rootPc: 0 }
|
|
45
|
-
* ```
|
|
46
|
-
*
|
|
47
|
-
* @category Scales
|
|
48
|
-
*/
|
|
49
|
-
declare function chordScales(chord: Chord): ChordScaleMatch[];
|
|
50
|
-
/**
|
|
51
|
-
* List a scale's avoid notes over a chord.
|
|
52
|
-
*
|
|
53
|
-
* An avoid note is a non-chord scale tone that lies a semitone directly above a
|
|
54
|
-
* chord tone; sounding it against the chord clashes. The scale is rooted on the
|
|
55
|
-
* chord root. If the scale does not contain the chord, no avoid notes exist.
|
|
56
|
-
*
|
|
57
|
-
* @param chord The chord providing the chord tones.
|
|
58
|
-
* @param scaleName A key of {@link NAMED_SCALES}.
|
|
59
|
-
* @returns The avoid-note pitch classes, sorted ascending in [0, 11].
|
|
60
|
-
*
|
|
61
|
-
* @category Scales
|
|
62
|
-
*/
|
|
63
|
-
declare function avoidNotes(chord: Chord, scaleName: string): number[];
|
|
64
|
-
/**
|
|
65
|
-
* List a scale's available tensions over a chord.
|
|
66
|
-
*
|
|
67
|
-
* Available tensions are scale tones that are neither chord tones nor avoid
|
|
68
|
-
* notes, i.e. the usable color tones (typically the 9/11/13 region). The scale
|
|
69
|
-
* is rooted on the chord root. If the scale does not contain the chord, there
|
|
70
|
-
* are no available tensions.
|
|
71
|
-
*
|
|
72
|
-
* @param chord The chord providing the chord tones.
|
|
73
|
-
* @param scaleName A key of {@link NAMED_SCALES}.
|
|
74
|
-
* @returns The available-tension pitch classes, sorted ascending in [0, 11].
|
|
75
|
-
*
|
|
76
|
-
* @example
|
|
77
|
-
* ```ts
|
|
78
|
-
* import { makeChord, availableTensions } from '@libraz/libcantus';
|
|
79
|
-
* availableTensions(makeChord(0, 'maj7'), 'ionian'); // [2, 9] — color tones over Cmaj7
|
|
80
|
-
* ```
|
|
81
|
-
*
|
|
82
|
-
* @category Scales
|
|
83
|
-
*/
|
|
84
|
-
declare function availableTensions(chord: Chord, scaleName: string): number[];
|
|
85
|
-
/**
|
|
86
|
-
* A scale fit over a chord together with its avoid notes and tensions.
|
|
87
|
-
*
|
|
88
|
-
* @category Scales
|
|
89
|
-
*/
|
|
90
|
-
type ChordScaleReportEntry = {
|
|
91
|
-
name: string;
|
|
92
|
-
rootPc: number;
|
|
93
|
-
avoid: number[];
|
|
94
|
-
tensions: number[];
|
|
95
|
-
};
|
|
96
|
-
/**
|
|
97
|
-
* Report the best-fitting scales for a chord with their avoid notes and tensions.
|
|
98
|
-
*
|
|
99
|
-
* Combines {@link chordScales}, {@link avoidNotes}, and {@link availableTensions}
|
|
100
|
-
* into a single ergonomic result, ordered best fit first.
|
|
101
|
-
*
|
|
102
|
-
* @param chord The chord to analyze.
|
|
103
|
-
* @param limit Optional maximum number of scales to report; all by default.
|
|
104
|
-
* @returns One entry per reported scale, best fit first.
|
|
105
|
-
*
|
|
106
|
-
* @category Scales
|
|
107
|
-
*/
|
|
108
|
-
declare function chordScaleReport(chord: Chord, limit?: number): ChordScaleReportEntry[];
|
|
109
|
-
/**
|
|
110
|
-
* A chord paired with the scale chosen for it by {@link scalesForChanges}.
|
|
111
|
-
*
|
|
112
|
-
* @category Scales
|
|
113
|
-
*/
|
|
114
|
-
type ScaleChoice = {
|
|
115
|
-
chord: Chord;
|
|
116
|
-
scale: ChordScaleMatch;
|
|
117
|
-
};
|
|
118
|
-
/**
|
|
119
|
-
* Choose one scale per chord across a progression, favoring continuity.
|
|
120
|
-
*
|
|
121
|
-
* Each chord's {@link chordScales} candidates form a stage in a Viterbi-style
|
|
122
|
-
* dynamic program. The transition cost between adjacent choices is the number
|
|
123
|
-
* of pitch classes that differ between their pitch-class sets (the symmetric
|
|
124
|
-
* difference), plus a small penalty for straying from a chord's best-fit scale
|
|
125
|
-
* so that ties break toward the tighter fit. The minimum-total-cost path is
|
|
126
|
-
* returned, one {@link ScaleChoice} per input chord in the original order.
|
|
127
|
-
*
|
|
128
|
-
* @param chords The chord sequence to choose scales for.
|
|
129
|
-
* @returns One scale choice per chord, in input order.
|
|
130
|
-
*
|
|
131
|
-
* @category Scales
|
|
132
|
-
*/
|
|
133
|
-
declare function scalesForChanges(chords: Chord[]): ScaleChoice[];
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* An inclusive MIDI pitch range for a single voice.
|
|
137
|
-
*
|
|
138
|
-
* @category Voicing & Counterpoint
|
|
139
|
-
*/
|
|
140
|
-
type VoiceRange = {
|
|
141
|
-
min: number;
|
|
142
|
-
max: number;
|
|
143
|
-
};
|
|
144
|
-
/**
|
|
145
|
-
* Default four-voice SATB ranges, ascending (index 0 = lowest):
|
|
146
|
-
* bass E2–C4 (40–60), tenor C3–G4 (48–67), alto G3–D5 (55–74),
|
|
147
|
-
* soprano C4–G5 (60–79).
|
|
148
|
-
*
|
|
149
|
-
* @category Voicing & Counterpoint
|
|
150
|
-
*/
|
|
151
|
-
declare const SATB_RANGES: readonly VoiceRange[];
|
|
152
|
-
/**
|
|
153
|
-
* Options controlling {@link voiceChord} and {@link voiceProgression}.
|
|
154
|
-
*
|
|
155
|
-
* @category Voicing & Counterpoint
|
|
156
|
-
*/
|
|
157
|
-
type VoicingOptions = {
|
|
158
|
-
/**
|
|
159
|
-
* Number of voices to realize. Ignored when `ranges` is given.
|
|
160
|
-
*
|
|
161
|
-
* @defaultValue 4
|
|
162
|
-
*/
|
|
163
|
-
voices?: number;
|
|
164
|
-
/** Explicit per-voice ranges, ascending (index 0 = lowest). Takes precedence over `voices`. */
|
|
165
|
-
ranges?: VoiceRange[];
|
|
166
|
-
/**
|
|
167
|
-
* Maximum spacing in semitones between adjacent upper voices.
|
|
168
|
-
*
|
|
169
|
-
* @defaultValue 12
|
|
170
|
-
*/
|
|
171
|
-
maxSpacing?: number;
|
|
172
|
-
};
|
|
173
|
-
/**
|
|
174
|
-
* Realize a single chord as one MIDI pitch per voice, ascending (index 0 =
|
|
175
|
-
* lowest). The bass voice takes the chord's `bassPc` when set, otherwise the
|
|
176
|
-
* root; upper voices take chord pitch classes, doubling the root or fifth as
|
|
177
|
-
* needed to fill all voices. The result stays inside each voice's range, keeps
|
|
178
|
-
* adjacent upper voices within `maxSpacing`, avoids voice crossing, and is
|
|
179
|
-
* deterministic: a compact close-position voicing centered in the ranges.
|
|
180
|
-
*
|
|
181
|
-
* @param chord The chord to voice.
|
|
182
|
-
* @param opts Voicing options; defaults to four voices in {@link SATB_RANGES}.
|
|
183
|
-
* @returns MIDI pitches, ascending, one per voice.
|
|
184
|
-
* @throws If no voicing fits the given ranges.
|
|
185
|
-
* @example
|
|
186
|
-
* ```ts
|
|
187
|
-
* import { parseChordSymbol, voiceChord } from '@libraz/libcantus';
|
|
188
|
-
* const chord = parseChordSymbol('Cmaj7');
|
|
189
|
-
* voiceChord(chord); // four ascending MIDI pitches within the SATB ranges
|
|
190
|
-
* ```
|
|
191
|
-
* @category Voicing & Counterpoint
|
|
192
|
-
*/
|
|
193
|
-
declare function voiceChord(chord: Chord, opts?: VoicingOptions): number[];
|
|
194
|
-
/**
|
|
195
|
-
* Voice a chord progression with smooth voice leading. The first chord is
|
|
196
|
-
* voiced with {@link voiceChord}; each subsequent chord picks, from a bounded
|
|
197
|
-
* deterministic candidate set, the voicing minimizing the voice-leading cost
|
|
198
|
-
* from the previous voicing plus a large penalty per counterpoint violation
|
|
199
|
-
* (parallel perfects/octaves, voice crossing, voice overlap, and over-wide
|
|
200
|
-
* upper-voice spacing).
|
|
201
|
-
*
|
|
202
|
-
* @param chords The chords to voice in order.
|
|
203
|
-
* @param opts Voicing options; defaults to four voices in {@link SATB_RANGES}.
|
|
204
|
-
* @returns One voicing per chord, each ascending with one MIDI pitch per voice.
|
|
205
|
-
* @throws If any chord admits no voicing within the given ranges.
|
|
206
|
-
* @example
|
|
207
|
-
* ```ts
|
|
208
|
-
* import { parseChordSymbol, voiceProgression } from '@libraz/libcantus';
|
|
209
|
-
* const chords = ['C', 'Am', 'F', 'G'].map((s) => parseChordSymbol(s));
|
|
210
|
-
* voiceProgression(chords); // one four-voice voicing per chord, smoothly led
|
|
211
|
-
* ```
|
|
212
|
-
* @category Voicing & Counterpoint
|
|
213
|
-
*/
|
|
214
|
-
declare function voiceProgression(chords: Chord[], opts?: VoicingOptions): number[][];
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* A tertian voicing style for {@link voiceChordStyled}.
|
|
218
|
-
*
|
|
219
|
-
* - `close`: the plain close-position tertian stack.
|
|
220
|
-
* - `drop2`: the second voice from the top dropped an octave (drop-2 voicing).
|
|
221
|
-
* - `drop3`: the third voice from the top dropped an octave (drop-3 voicing).
|
|
222
|
-
* - `shell`: root plus guide tones (third and seventh) for seventh chords, or
|
|
223
|
-
* root/third/fifth for triads; the fifth and tensions are omitted.
|
|
224
|
-
* - `rootless`: the root omitted, keeping third/fifth/seventh and tensions
|
|
225
|
-
* (a typical left-hand jazz voicing).
|
|
226
|
-
*
|
|
227
|
-
* @category Voicing & Counterpoint
|
|
228
|
-
*/
|
|
229
|
-
type VoicingStyle = 'close' | 'drop2' | 'drop3' | 'shell' | 'rootless';
|
|
230
|
-
/**
|
|
231
|
-
* Options controlling {@link voiceChordStyled}.
|
|
232
|
-
*
|
|
233
|
-
* @category Voicing & Counterpoint
|
|
234
|
-
*/
|
|
235
|
-
type StyledVoicingOptions = {
|
|
236
|
-
/**
|
|
237
|
-
* Voicing style to build.
|
|
238
|
-
*
|
|
239
|
-
* @defaultValue 'close'
|
|
240
|
-
*/
|
|
241
|
-
style?: VoicingStyle;
|
|
242
|
-
/** Constrain the highest voice to this pitch class (0..11) when given. */
|
|
243
|
-
topNote?: number;
|
|
244
|
-
/**
|
|
245
|
-
* Base octave for the close stack; the stack begins near `12 * octave`.
|
|
246
|
-
*
|
|
247
|
-
* @defaultValue 4
|
|
248
|
-
*/
|
|
249
|
-
octave?: number;
|
|
250
|
-
/**
|
|
251
|
-
* Omit the root regardless of style (relevant for jazz voicings).
|
|
252
|
-
*
|
|
253
|
-
* @defaultValue false
|
|
254
|
-
*/
|
|
255
|
-
rootless?: boolean;
|
|
256
|
-
};
|
|
257
|
-
/**
|
|
258
|
-
* Realize a single chord as an explicit tertian voicing in a chosen style,
|
|
259
|
-
* independent of the SATB range search used by {@link voiceChord}.
|
|
260
|
-
*
|
|
261
|
-
* The chord tones are stacked in close position from the bass (`bassPc`, else
|
|
262
|
-
* `rootPc`) in the given scientific-pitch `octave` upward (octave 4 starts the
|
|
263
|
-
* bass near C4 = MIDI 60, matching {@link midiToNote} and the bass module).
|
|
264
|
-
* When `topNote` is given the stack is rotated so the highest voice's pitch
|
|
265
|
-
* class equals that note (or the nearest chord tone). The chosen
|
|
266
|
-
* {@link VoicingStyle} then transforms the stack, and the result is returned as
|
|
267
|
-
* ascending MIDI pitches (index 0 = lowest).
|
|
268
|
-
*
|
|
269
|
-
* @param chord The chord to voice.
|
|
270
|
-
* @param opts Styled voicing options; defaults to a close voicing at octave 4.
|
|
271
|
-
* @returns MIDI pitches, ascending, one per retained voice.
|
|
272
|
-
* @example
|
|
273
|
-
* ```ts
|
|
274
|
-
* import { parseChordSymbol, voiceChordStyled } from '@libraz/libcantus';
|
|
275
|
-
* const chord = parseChordSymbol('Dm7');
|
|
276
|
-
* voiceChordStyled(chord, { style: 'drop2' }); // ascending MIDI pitches, drop-2 voicing
|
|
277
|
-
* ```
|
|
278
|
-
* @category Voicing & Counterpoint
|
|
279
|
-
*/
|
|
280
|
-
declare function voiceChordStyled(chord: Chord, opts?: StyledVoicingOptions): number[];
|
|
281
|
-
|
|
282
|
-
export { type ChordScaleMatch as C, SATB_RANGES as S, type VoiceRange as V, type ChordScaleReportEntry as a, type ScaleChoice as b, type StyledVoicingOptions as c, type VoicingOptions as d, type VoicingStyle as e, availableTensions as f, avoidNotes as g, chordScaleReport as h, chordScales as i, scalesForChanges as j, voiceChordStyled as k, voiceProgression as l, scaleMatchesChord as s, voiceChord as v };
|
|
@@ -1,282 +0,0 @@
|
|
|
1
|
-
import { C as Chord } from './index-BNlGP86A.cjs';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Test whether every chord pitch class is contained in a scale.
|
|
5
|
-
*
|
|
6
|
-
* @param chordPcs The chord's pitch classes (0..11).
|
|
7
|
-
* @param scaleMask The scale's 12-bit mode mask.
|
|
8
|
-
* @param scaleRootPc The pitch class the mask is rooted on.
|
|
9
|
-
* @returns True if the scale is a superset of the chord.
|
|
10
|
-
*
|
|
11
|
-
* @category Scales
|
|
12
|
-
*/
|
|
13
|
-
declare function scaleMatchesChord(chordPcs: number[], scaleMask: number, scaleRootPc: number): boolean;
|
|
14
|
-
/**
|
|
15
|
-
* A named scale rooted on a pitch class that fits over a chord.
|
|
16
|
-
*
|
|
17
|
-
* @category Scales
|
|
18
|
-
*/
|
|
19
|
-
type ChordScaleMatch = {
|
|
20
|
-
name: string;
|
|
21
|
-
rootPc: number;
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* List the scales that fit over a chord, best fit first.
|
|
25
|
-
*
|
|
26
|
-
* Only the chord root is considered as the scale root, matching the
|
|
27
|
-
* conventional chord-scale relationship. Every entry of {@link NAMED_SCALES}
|
|
28
|
-
* whose pitch-class set is a superset of the chord's is returned once per
|
|
29
|
-
* distinct pitch-class set (aliased masks such as major/ionian report only the
|
|
30
|
-
* modal name), ranked by fewest extra scale tones beyond the chord, then by
|
|
31
|
-
* scale size (heptatonic before larger scales), then by scale name. For bare
|
|
32
|
-
* triads and smaller chords, heptatonic scales rank before pentatonics and
|
|
33
|
-
* other sizes: a pentatonic adds no modal color over a triad, so the seven-note
|
|
34
|
-
* modes are the more useful answer. The chromatic scale is only returned as a
|
|
35
|
-
* fallback when no other scale contains the chord.
|
|
36
|
-
*
|
|
37
|
-
* @param chord The chord to fit scales over.
|
|
38
|
-
* @returns The matching scales rooted on the chord root, best fit first.
|
|
39
|
-
*
|
|
40
|
-
* @example
|
|
41
|
-
* ```ts
|
|
42
|
-
* import { makeChord, chordScales } from '@libraz/libcantus';
|
|
43
|
-
* const scales = chordScales(makeChord(0, 'maj7'));
|
|
44
|
-
* // scales for Cmaj7, best fit first; each is { name, rootPc: 0 }
|
|
45
|
-
* ```
|
|
46
|
-
*
|
|
47
|
-
* @category Scales
|
|
48
|
-
*/
|
|
49
|
-
declare function chordScales(chord: Chord): ChordScaleMatch[];
|
|
50
|
-
/**
|
|
51
|
-
* List a scale's avoid notes over a chord.
|
|
52
|
-
*
|
|
53
|
-
* An avoid note is a non-chord scale tone that lies a semitone directly above a
|
|
54
|
-
* chord tone; sounding it against the chord clashes. The scale is rooted on the
|
|
55
|
-
* chord root. If the scale does not contain the chord, no avoid notes exist.
|
|
56
|
-
*
|
|
57
|
-
* @param chord The chord providing the chord tones.
|
|
58
|
-
* @param scaleName A key of {@link NAMED_SCALES}.
|
|
59
|
-
* @returns The avoid-note pitch classes, sorted ascending in [0, 11].
|
|
60
|
-
*
|
|
61
|
-
* @category Scales
|
|
62
|
-
*/
|
|
63
|
-
declare function avoidNotes(chord: Chord, scaleName: string): number[];
|
|
64
|
-
/**
|
|
65
|
-
* List a scale's available tensions over a chord.
|
|
66
|
-
*
|
|
67
|
-
* Available tensions are scale tones that are neither chord tones nor avoid
|
|
68
|
-
* notes, i.e. the usable color tones (typically the 9/11/13 region). The scale
|
|
69
|
-
* is rooted on the chord root. If the scale does not contain the chord, there
|
|
70
|
-
* are no available tensions.
|
|
71
|
-
*
|
|
72
|
-
* @param chord The chord providing the chord tones.
|
|
73
|
-
* @param scaleName A key of {@link NAMED_SCALES}.
|
|
74
|
-
* @returns The available-tension pitch classes, sorted ascending in [0, 11].
|
|
75
|
-
*
|
|
76
|
-
* @example
|
|
77
|
-
* ```ts
|
|
78
|
-
* import { makeChord, availableTensions } from '@libraz/libcantus';
|
|
79
|
-
* availableTensions(makeChord(0, 'maj7'), 'ionian'); // [2, 9] — color tones over Cmaj7
|
|
80
|
-
* ```
|
|
81
|
-
*
|
|
82
|
-
* @category Scales
|
|
83
|
-
*/
|
|
84
|
-
declare function availableTensions(chord: Chord, scaleName: string): number[];
|
|
85
|
-
/**
|
|
86
|
-
* A scale fit over a chord together with its avoid notes and tensions.
|
|
87
|
-
*
|
|
88
|
-
* @category Scales
|
|
89
|
-
*/
|
|
90
|
-
type ChordScaleReportEntry = {
|
|
91
|
-
name: string;
|
|
92
|
-
rootPc: number;
|
|
93
|
-
avoid: number[];
|
|
94
|
-
tensions: number[];
|
|
95
|
-
};
|
|
96
|
-
/**
|
|
97
|
-
* Report the best-fitting scales for a chord with their avoid notes and tensions.
|
|
98
|
-
*
|
|
99
|
-
* Combines {@link chordScales}, {@link avoidNotes}, and {@link availableTensions}
|
|
100
|
-
* into a single ergonomic result, ordered best fit first.
|
|
101
|
-
*
|
|
102
|
-
* @param chord The chord to analyze.
|
|
103
|
-
* @param limit Optional maximum number of scales to report; all by default.
|
|
104
|
-
* @returns One entry per reported scale, best fit first.
|
|
105
|
-
*
|
|
106
|
-
* @category Scales
|
|
107
|
-
*/
|
|
108
|
-
declare function chordScaleReport(chord: Chord, limit?: number): ChordScaleReportEntry[];
|
|
109
|
-
/**
|
|
110
|
-
* A chord paired with the scale chosen for it by {@link scalesForChanges}.
|
|
111
|
-
*
|
|
112
|
-
* @category Scales
|
|
113
|
-
*/
|
|
114
|
-
type ScaleChoice = {
|
|
115
|
-
chord: Chord;
|
|
116
|
-
scale: ChordScaleMatch;
|
|
117
|
-
};
|
|
118
|
-
/**
|
|
119
|
-
* Choose one scale per chord across a progression, favoring continuity.
|
|
120
|
-
*
|
|
121
|
-
* Each chord's {@link chordScales} candidates form a stage in a Viterbi-style
|
|
122
|
-
* dynamic program. The transition cost between adjacent choices is the number
|
|
123
|
-
* of pitch classes that differ between their pitch-class sets (the symmetric
|
|
124
|
-
* difference), plus a small penalty for straying from a chord's best-fit scale
|
|
125
|
-
* so that ties break toward the tighter fit. The minimum-total-cost path is
|
|
126
|
-
* returned, one {@link ScaleChoice} per input chord in the original order.
|
|
127
|
-
*
|
|
128
|
-
* @param chords The chord sequence to choose scales for.
|
|
129
|
-
* @returns One scale choice per chord, in input order.
|
|
130
|
-
*
|
|
131
|
-
* @category Scales
|
|
132
|
-
*/
|
|
133
|
-
declare function scalesForChanges(chords: Chord[]): ScaleChoice[];
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* An inclusive MIDI pitch range for a single voice.
|
|
137
|
-
*
|
|
138
|
-
* @category Voicing & Counterpoint
|
|
139
|
-
*/
|
|
140
|
-
type VoiceRange = {
|
|
141
|
-
min: number;
|
|
142
|
-
max: number;
|
|
143
|
-
};
|
|
144
|
-
/**
|
|
145
|
-
* Default four-voice SATB ranges, ascending (index 0 = lowest):
|
|
146
|
-
* bass E2–C4 (40–60), tenor C3–G4 (48–67), alto G3–D5 (55–74),
|
|
147
|
-
* soprano C4–G5 (60–79).
|
|
148
|
-
*
|
|
149
|
-
* @category Voicing & Counterpoint
|
|
150
|
-
*/
|
|
151
|
-
declare const SATB_RANGES: readonly VoiceRange[];
|
|
152
|
-
/**
|
|
153
|
-
* Options controlling {@link voiceChord} and {@link voiceProgression}.
|
|
154
|
-
*
|
|
155
|
-
* @category Voicing & Counterpoint
|
|
156
|
-
*/
|
|
157
|
-
type VoicingOptions = {
|
|
158
|
-
/**
|
|
159
|
-
* Number of voices to realize. Ignored when `ranges` is given.
|
|
160
|
-
*
|
|
161
|
-
* @defaultValue 4
|
|
162
|
-
*/
|
|
163
|
-
voices?: number;
|
|
164
|
-
/** Explicit per-voice ranges, ascending (index 0 = lowest). Takes precedence over `voices`. */
|
|
165
|
-
ranges?: VoiceRange[];
|
|
166
|
-
/**
|
|
167
|
-
* Maximum spacing in semitones between adjacent upper voices.
|
|
168
|
-
*
|
|
169
|
-
* @defaultValue 12
|
|
170
|
-
*/
|
|
171
|
-
maxSpacing?: number;
|
|
172
|
-
};
|
|
173
|
-
/**
|
|
174
|
-
* Realize a single chord as one MIDI pitch per voice, ascending (index 0 =
|
|
175
|
-
* lowest). The bass voice takes the chord's `bassPc` when set, otherwise the
|
|
176
|
-
* root; upper voices take chord pitch classes, doubling the root or fifth as
|
|
177
|
-
* needed to fill all voices. The result stays inside each voice's range, keeps
|
|
178
|
-
* adjacent upper voices within `maxSpacing`, avoids voice crossing, and is
|
|
179
|
-
* deterministic: a compact close-position voicing centered in the ranges.
|
|
180
|
-
*
|
|
181
|
-
* @param chord The chord to voice.
|
|
182
|
-
* @param opts Voicing options; defaults to four voices in {@link SATB_RANGES}.
|
|
183
|
-
* @returns MIDI pitches, ascending, one per voice.
|
|
184
|
-
* @throws If no voicing fits the given ranges.
|
|
185
|
-
* @example
|
|
186
|
-
* ```ts
|
|
187
|
-
* import { parseChordSymbol, voiceChord } from '@libraz/libcantus';
|
|
188
|
-
* const chord = parseChordSymbol('Cmaj7');
|
|
189
|
-
* voiceChord(chord); // four ascending MIDI pitches within the SATB ranges
|
|
190
|
-
* ```
|
|
191
|
-
* @category Voicing & Counterpoint
|
|
192
|
-
*/
|
|
193
|
-
declare function voiceChord(chord: Chord, opts?: VoicingOptions): number[];
|
|
194
|
-
/**
|
|
195
|
-
* Voice a chord progression with smooth voice leading. The first chord is
|
|
196
|
-
* voiced with {@link voiceChord}; each subsequent chord picks, from a bounded
|
|
197
|
-
* deterministic candidate set, the voicing minimizing the voice-leading cost
|
|
198
|
-
* from the previous voicing plus a large penalty per counterpoint violation
|
|
199
|
-
* (parallel perfects/octaves, voice crossing, voice overlap, and over-wide
|
|
200
|
-
* upper-voice spacing).
|
|
201
|
-
*
|
|
202
|
-
* @param chords The chords to voice in order.
|
|
203
|
-
* @param opts Voicing options; defaults to four voices in {@link SATB_RANGES}.
|
|
204
|
-
* @returns One voicing per chord, each ascending with one MIDI pitch per voice.
|
|
205
|
-
* @throws If any chord admits no voicing within the given ranges.
|
|
206
|
-
* @example
|
|
207
|
-
* ```ts
|
|
208
|
-
* import { parseChordSymbol, voiceProgression } from '@libraz/libcantus';
|
|
209
|
-
* const chords = ['C', 'Am', 'F', 'G'].map((s) => parseChordSymbol(s));
|
|
210
|
-
* voiceProgression(chords); // one four-voice voicing per chord, smoothly led
|
|
211
|
-
* ```
|
|
212
|
-
* @category Voicing & Counterpoint
|
|
213
|
-
*/
|
|
214
|
-
declare function voiceProgression(chords: Chord[], opts?: VoicingOptions): number[][];
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* A tertian voicing style for {@link voiceChordStyled}.
|
|
218
|
-
*
|
|
219
|
-
* - `close`: the plain close-position tertian stack.
|
|
220
|
-
* - `drop2`: the second voice from the top dropped an octave (drop-2 voicing).
|
|
221
|
-
* - `drop3`: the third voice from the top dropped an octave (drop-3 voicing).
|
|
222
|
-
* - `shell`: root plus guide tones (third and seventh) for seventh chords, or
|
|
223
|
-
* root/third/fifth for triads; the fifth and tensions are omitted.
|
|
224
|
-
* - `rootless`: the root omitted, keeping third/fifth/seventh and tensions
|
|
225
|
-
* (a typical left-hand jazz voicing).
|
|
226
|
-
*
|
|
227
|
-
* @category Voicing & Counterpoint
|
|
228
|
-
*/
|
|
229
|
-
type VoicingStyle = 'close' | 'drop2' | 'drop3' | 'shell' | 'rootless';
|
|
230
|
-
/**
|
|
231
|
-
* Options controlling {@link voiceChordStyled}.
|
|
232
|
-
*
|
|
233
|
-
* @category Voicing & Counterpoint
|
|
234
|
-
*/
|
|
235
|
-
type StyledVoicingOptions = {
|
|
236
|
-
/**
|
|
237
|
-
* Voicing style to build.
|
|
238
|
-
*
|
|
239
|
-
* @defaultValue 'close'
|
|
240
|
-
*/
|
|
241
|
-
style?: VoicingStyle;
|
|
242
|
-
/** Constrain the highest voice to this pitch class (0..11) when given. */
|
|
243
|
-
topNote?: number;
|
|
244
|
-
/**
|
|
245
|
-
* Base octave for the close stack; the stack begins near `12 * octave`.
|
|
246
|
-
*
|
|
247
|
-
* @defaultValue 4
|
|
248
|
-
*/
|
|
249
|
-
octave?: number;
|
|
250
|
-
/**
|
|
251
|
-
* Omit the root regardless of style (relevant for jazz voicings).
|
|
252
|
-
*
|
|
253
|
-
* @defaultValue false
|
|
254
|
-
*/
|
|
255
|
-
rootless?: boolean;
|
|
256
|
-
};
|
|
257
|
-
/**
|
|
258
|
-
* Realize a single chord as an explicit tertian voicing in a chosen style,
|
|
259
|
-
* independent of the SATB range search used by {@link voiceChord}.
|
|
260
|
-
*
|
|
261
|
-
* The chord tones are stacked in close position from the bass (`bassPc`, else
|
|
262
|
-
* `rootPc`) in the given scientific-pitch `octave` upward (octave 4 starts the
|
|
263
|
-
* bass near C4 = MIDI 60, matching {@link midiToNote} and the bass module).
|
|
264
|
-
* When `topNote` is given the stack is rotated so the highest voice's pitch
|
|
265
|
-
* class equals that note (or the nearest chord tone). The chosen
|
|
266
|
-
* {@link VoicingStyle} then transforms the stack, and the result is returned as
|
|
267
|
-
* ascending MIDI pitches (index 0 = lowest).
|
|
268
|
-
*
|
|
269
|
-
* @param chord The chord to voice.
|
|
270
|
-
* @param opts Styled voicing options; defaults to a close voicing at octave 4.
|
|
271
|
-
* @returns MIDI pitches, ascending, one per retained voice.
|
|
272
|
-
* @example
|
|
273
|
-
* ```ts
|
|
274
|
-
* import { parseChordSymbol, voiceChordStyled } from '@libraz/libcantus';
|
|
275
|
-
* const chord = parseChordSymbol('Dm7');
|
|
276
|
-
* voiceChordStyled(chord, { style: 'drop2' }); // ascending MIDI pitches, drop-2 voicing
|
|
277
|
-
* ```
|
|
278
|
-
* @category Voicing & Counterpoint
|
|
279
|
-
*/
|
|
280
|
-
declare function voiceChordStyled(chord: Chord, opts?: StyledVoicingOptions): number[];
|
|
281
|
-
|
|
282
|
-
export { type ChordScaleMatch as C, SATB_RANGES as S, type VoiceRange as V, type ChordScaleReportEntry as a, type ScaleChoice as b, type StyledVoicingOptions as c, type VoicingOptions as d, type VoicingStyle as e, availableTensions as f, avoidNotes as g, chordScaleReport as h, chordScales as i, scalesForChanges as j, voiceChordStyled as k, voiceProgression as l, scaleMatchesChord as s, voiceChord as v };
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Arrangement analysis: the capstone that ties the timeline, per-voice analysis,
|
|
3
|
-
* functional harmony, and safety modules together for a whole multi-track piece.
|
|
4
|
-
*
|
|
5
|
-
* A chord timeline and key are inferred once from every track's notes pooled
|
|
6
|
-
* together; each track is then analysed against that shared harmony, notes that
|
|
7
|
-
* clash with the sounding chord are collected as conflicts, and a coarse tension
|
|
8
|
-
* curve is sampled across the piece.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
export type { TensionPoint } from './tension.js';
|
|
12
|
-
export { tensionCurve } from './tension.js';
|
|
13
|
-
export type {
|
|
14
|
-
ArrangementAnalysis,
|
|
15
|
-
ArrangementOptions,
|
|
16
|
-
ArrangementTrack,
|
|
17
|
-
Conflict,
|
|
18
|
-
TrackAnalysis,
|
|
19
|
-
TrackRole,
|
|
20
|
-
} from './tracks.js';
|
|
21
|
-
export { analyzeArrangement } from './tracks.js';
|