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