@libraz/libcantus 1.0.1 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -65
- package/README_ja.md +28 -66
- package/dist/analyze/index.cjs +11 -7
- package/dist/analyze/index.cjs.map +1 -1
- package/dist/analyze/index.d.cts +79 -144
- package/dist/analyze/index.d.ts +79 -144
- package/dist/analyze/index.js +20 -16
- package/dist/chunk-35NBV2FT.cjs +145 -0
- package/dist/chunk-35NBV2FT.cjs.map +1 -0
- package/dist/{chunk-UADYAYAT.cjs → chunk-3R3QVKY5.cjs} +1353 -580
- package/dist/chunk-3R3QVKY5.cjs.map +1 -0
- package/dist/{chunk-WWURE4XT.cjs → chunk-76ZBTRG2.cjs} +624 -729
- package/dist/chunk-76ZBTRG2.cjs.map +1 -0
- package/dist/{chunk-FVSI36UV.js → chunk-7KG3RTYS.js} +197 -110
- package/dist/chunk-7KG3RTYS.js.map +1 -0
- package/dist/{chunk-VTI6FOLB.js → chunk-AGOVW7U6.js} +709 -133
- package/dist/chunk-AGOVW7U6.js.map +1 -0
- package/dist/{chunk-E3F4AHAH.cjs → chunk-CGBADIO5.cjs} +221 -134
- package/dist/chunk-CGBADIO5.cjs.map +1 -0
- package/dist/{chunk-6XH6QZYQ.cjs → chunk-DSMJRXCZ.cjs} +1455 -849
- package/dist/chunk-DSMJRXCZ.cjs.map +1 -0
- package/dist/{chunk-PKFNUHDY.js → chunk-FBH75DAY.js} +1218 -612
- package/dist/chunk-FBH75DAY.js.map +1 -0
- package/dist/chunk-H2KJHBW4.js +3329 -0
- package/dist/chunk-H2KJHBW4.js.map +1 -0
- package/dist/chunk-HPVSH7SF.cjs +2294 -0
- package/dist/chunk-HPVSH7SF.cjs.map +1 -0
- package/dist/{chunk-MXO72PLY.cjs → chunk-HWHGOVO6.cjs} +21 -19
- package/dist/chunk-HWHGOVO6.cjs.map +1 -0
- package/dist/chunk-HYJJ2V2I.js +2294 -0
- package/dist/chunk-HYJJ2V2I.js.map +1 -0
- package/dist/{chunk-AFM2ULJH.cjs → chunk-J7FHVZII.cjs} +1567 -1067
- package/dist/chunk-J7FHVZII.cjs.map +1 -0
- package/dist/chunk-K6OZXIR6.js +1 -0
- package/dist/{chunk-H3VORETI.js → chunk-M5RYMAFI.js} +487 -592
- package/dist/chunk-M5RYMAFI.js.map +1 -0
- package/dist/chunk-NB25P3EH.js +363 -0
- package/dist/chunk-NB25P3EH.js.map +1 -0
- package/dist/{chunk-TTCLJX6D.js → chunk-NFJ4P6ZZ.js} +10 -8
- package/dist/chunk-NFJ4P6ZZ.js.map +1 -0
- package/dist/chunk-NM7UAMC3.cjs +457 -0
- package/dist/chunk-NM7UAMC3.cjs.map +1 -0
- package/dist/chunk-PM4XJE2Y.cjs +363 -0
- package/dist/chunk-PM4XJE2Y.cjs.map +1 -0
- package/dist/chunk-PUKJP2Z5.js +145 -0
- package/dist/chunk-PUKJP2Z5.js.map +1 -0
- package/dist/{chunk-VOHZB45S.js → chunk-Q6LFSAKV.js} +1321 -821
- package/dist/chunk-Q6LFSAKV.js.map +1 -0
- package/dist/{chunk-INHVXP6Z.js → chunk-RFIBF2RR.js} +1203 -430
- package/dist/chunk-RFIBF2RR.js.map +1 -0
- package/dist/{chunk-Q2WGKJNN.cjs → chunk-S5BKZZGM.cjs} +699 -123
- package/dist/chunk-S5BKZZGM.cjs.map +1 -0
- package/dist/chunk-SGLEQVJH.cjs +3329 -0
- package/dist/chunk-SGLEQVJH.cjs.map +1 -0
- package/dist/chunk-UGLFDG7L.cjs +1 -0
- package/dist/chunk-UGLFDG7L.cjs.map +1 -0
- package/dist/{chunk-YH3BIKHH.js → chunk-UMWZ4ZET.js} +146 -49
- package/dist/chunk-UMWZ4ZET.js.map +1 -0
- package/dist/{index-szBv3496.d.ts → coerce-DP0vYu-x.d.ts} +286 -199
- package/dist/{index-C_8o--VE.d.cts → coerce-DRERzdve.d.cts} +286 -199
- package/dist/core/index.cjs +9 -5
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +122 -108
- package/dist/core/index.d.ts +122 -108
- package/dist/core/index.js +32 -28
- package/dist/generate/index.cjs +8 -8
- package/dist/generate/index.d.cts +168 -84
- package/dist/generate/index.d.ts +168 -84
- package/dist/generate/index.js +7 -7
- package/dist/{index-CGpRv5sl.d.cts → index-9eoQs2C1.d.ts} +34 -19
- package/dist/{index-CCNJRG-P.d.cts → index-B9QLziDe.d.cts} +293 -56
- package/dist/{index-Dzr13q3d.d.cts → index-BBWNZS0f.d.cts} +135 -58
- package/dist/{index-9wcMhG73.d.ts → index-BHIUyjhZ.d.ts} +293 -56
- package/dist/{index-BGFW-8P2.d.cts → index-BJgP97N1.d.ts} +196 -114
- package/dist/{index-CunYKLiu.d.ts → index-BL5N2Oyz.d.cts} +1 -1
- package/dist/{index-Cj49F892.d.ts → index-BMweUlm5.d.cts} +63 -23
- package/dist/{index-CgHqxdps.d.ts → index-BNSM-DSk.d.cts} +196 -114
- package/dist/{index-D57QRbVn.d.ts → index-BRMbPkHE.d.ts} +480 -254
- package/dist/{index-Chbst3Jx.d.ts → index-CJBBiAmU.d.ts} +135 -58
- package/dist/{index-BkGmlyI3.d.cts → index-CL4b4gUQ.d.ts} +63 -23
- package/dist/{index-B9MNZboQ.d.ts → index-Cy15oTvh.d.cts} +52 -22
- package/dist/{index-B9MNZboQ.d.cts → index-Cy15oTvh.d.ts} +52 -22
- package/dist/{index-BO6xE9YU.d.cts → index-DGCNKAUr.d.cts} +480 -254
- package/dist/{index-B4o55NDr.d.cts → index-Dw2DP7vm.d.ts} +1 -1
- package/dist/{index-G1uwGGWQ.d.ts → index-cHvbYgJI.d.cts} +34 -19
- package/dist/index.cjs +42 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -14
- package/dist/index.d.ts +14 -14
- package/dist/index.js +82 -54
- package/dist/{masks-DYbE485J.d.cts → masks-Cc7-MzzY.d.ts} +49 -2
- package/dist/{masks-DYbE485J.d.ts → masks-pADfTOiD.d.cts} +49 -2
- package/dist/model/index.cjs +19 -12
- package/dist/model/index.cjs.map +1 -1
- package/dist/model/index.d.cts +504 -182
- package/dist/model/index.d.ts +504 -182
- package/dist/model/index.js +18 -11
- package/dist/{positional-Cptlj-xs.d.ts → positional-DJgs6ltD.d.ts} +85 -8
- package/dist/{positional-DvH_sd8u.d.cts → positional-DMZer-FM.d.cts} +85 -8
- package/dist/theory/index.cjs +35 -6
- package/dist/theory/index.cjs.map +1 -1
- package/dist/theory/index.d.cts +257 -62
- package/dist/theory/index.d.ts +257 -62
- package/dist/theory/index.js +41 -12
- package/package.json +7 -5
- package/dist/chunk-2LCPM3EG.js +0 -3224
- package/dist/chunk-2LCPM3EG.js.map +0 -1
- package/dist/chunk-6XH6QZYQ.cjs.map +0 -1
- package/dist/chunk-6XPTBE7Y.cjs +0 -49
- package/dist/chunk-6XPTBE7Y.cjs.map +0 -1
- package/dist/chunk-AFM2ULJH.cjs.map +0 -1
- package/dist/chunk-B6XNKWZV.cjs +0 -3224
- package/dist/chunk-B6XNKWZV.cjs.map +0 -1
- package/dist/chunk-E3F4AHAH.cjs.map +0 -1
- package/dist/chunk-ELCTZUJJ.js +0 -379
- package/dist/chunk-ELCTZUJJ.js.map +0 -1
- package/dist/chunk-FVSI36UV.js.map +0 -1
- package/dist/chunk-H3VORETI.js.map +0 -1
- package/dist/chunk-H42UHPYW.js +0 -1577
- package/dist/chunk-H42UHPYW.js.map +0 -1
- package/dist/chunk-HFPS7JFD.js +0 -1
- package/dist/chunk-INHVXP6Z.js.map +0 -1
- package/dist/chunk-K4ZJUGF4.cjs +0 -379
- package/dist/chunk-K4ZJUGF4.cjs.map +0 -1
- package/dist/chunk-KNJEKLKV.js +0 -49
- package/dist/chunk-KNJEKLKV.js.map +0 -1
- package/dist/chunk-MXO72PLY.cjs.map +0 -1
- package/dist/chunk-NLEU4QSE.cjs +0 -360
- package/dist/chunk-NLEU4QSE.cjs.map +0 -1
- package/dist/chunk-OE6WK2Y2.cjs +0 -1577
- package/dist/chunk-OE6WK2Y2.cjs.map +0 -1
- package/dist/chunk-PKFNUHDY.js.map +0 -1
- package/dist/chunk-Q2WGKJNN.cjs.map +0 -1
- package/dist/chunk-RHIJ3S4I.cjs +0 -1
- package/dist/chunk-RHIJ3S4I.cjs.map +0 -1
- package/dist/chunk-TTCLJX6D.js.map +0 -1
- package/dist/chunk-UADYAYAT.cjs.map +0 -1
- package/dist/chunk-VOHZB45S.js.map +0 -1
- package/dist/chunk-VTI6FOLB.js.map +0 -1
- package/dist/chunk-WWURE4XT.cjs.map +0 -1
- package/dist/chunk-YH3BIKHH.js.map +0 -1
- /package/dist/{chunk-HFPS7JFD.js.map → chunk-K6OZXIR6.js.map} +0 -0
package/dist/model/index.d.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { R as ReduceProgressionOptions, v as ReducedChord, D as DetectChordOptions, C as ChordMatch,
|
|
2
|
-
export { b as ArrangementSession,
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
5
|
-
import {
|
|
6
|
-
export {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
import { c as
|
|
17
|
-
export {
|
|
18
|
-
import { a2 as SubstitutionType, a0 as SubstituteOptions, a1 as Substitution, g as BorrowedChord, z as HumanizeOptions, L as OrnamentOptions, w as GrooveTemplate, d as BassLineOptions, C as Complexity,
|
|
19
|
-
export { f as BassStyle, l as DrumRole, E as EuclideanKick, r as Genre, s as GridEvent, t as GrooveFeel, u as GrooveSlot, v as GrooveStyle, x as HarmonizePlacement, M as MelodyNote, N as OrnamentStyle, Q as ProgFunction, R as ProgStyle, S as ProgressionDegree, U as ProgressionPreset, V as Provenance, W as ProvenanceBasis, $ as Section } from '../index-
|
|
20
|
-
import '../index-
|
|
1
|
+
import { R as ReduceProgressionOptions, v as ReducedChord, D as DetectChordOptions, C as ChordMatch, h as DetectKeyOptions, K as KeyMatch, d as AugmentedSixthKind, t as PhraseOptions, P as Phrase, S as StructuralCadence, i as FormSectionOptions, F as FormSection, j as HypermeterOptions, H as Hypermeter, E as ExtractMotifsOptions, p as MotifData, k as MelodicContour, c as ArrangementTrack, a as ArrangementOptions, A as ArrangementAnalysis, e as Conflict, z as TrackEdit, T as TensionPoint, r as MotifRelation } from '../index-BRMbPkHE.js';
|
|
2
|
+
export { b as ArrangementSession, f as ConflictPartner, g as ContourDirection, l as MelodicContourShape, o as ModalScaleName, q as MotifOccurrence, s as MotifRelationKind, u as PhraseSignal, w as ReductionBasis, x as ReductionLevel, y as TrackAnalysis, B as TrackRole } from '../index-BRMbPkHE.js';
|
|
3
|
+
import { k as KeyRegion, f as ChordTimelineOptions, C as CadenceHit, l as KeyTimelineOptions, h as ChordToRomanOptions, e as ChordTimeline, H as HarmonicFunction, A as AnalyzeChordOptions, D as DetectCadenceOptions, c as ChordAnalysis, b as CadenceResult, E as ExplainRomanOptions, m as RomanExplanation, B as BorrowedSource, a as AnalyzedNote, I as IdentifiedVoiceNote } from '../index-CJBBiAmU.js';
|
|
4
|
+
export { d as ChordSegmentation, g as ChordTimelineResult, K as KeyContext, i as KeyProfileName, j as KeyProfilePair, P as PivotChord, R as RejectedCandidate, S as SuspensionFigure, T as TheoryLabel, V as VoiceNote } from '../index-CJBBiAmU.js';
|
|
5
|
+
import { c as IntervalQualityLabel, I as IntervalData, P as ParseResult, S as SpelledInterval, g as Note$1, j as NoteNameOptions, b as IntervalLike, h as NoteEvent, i as NoteLike, e as KeyScale, a as Articulation } from '../index-Cy15oTvh.js';
|
|
6
|
+
export { B as BudgetExceededError, d as InvalidInputError, L as LibcantusError, N as NoSolutionError, k as NoteNameSystem } from '../index-Cy15oTvh.js';
|
|
7
|
+
import { K as KeyLike, e as ChordSegment, g as ChordSpan, b as Chord$1, d as ChordQuality, h as ChordSpec, i as ChordToneRole, n as ResolvedKey, k as KeyVariant, j as KeyRelation, c as ChordLike, r as SpelledKeyLike, p as SafetyQuery, E as EvaluateSafetyOptions, q as SafetyResult } from '../coerce-DP0vYu-x.js';
|
|
8
|
+
export { A as Alteration, a as AlteredDegree, C as ChordBase, f as ChordSeventh, N as NoteSafety, l as PitchSpelling, m as ProfileWeights, S as SafetyPartner, o as SafetyProfile, s as SpelledKeyScale, V as VoiceSnapshot } from '../coerce-DP0vYu-x.js';
|
|
9
|
+
import { j as TuningTable, i as TempoMap, g as PlayabilityReport, b as NoteEventIndexOptions, a as NoteEventIndex, d as NoteValue, k as Tuplet, D as DurationData, S as SpelledDuration } from '../index-9eoQs2C1.js';
|
|
10
|
+
export { I as IndexedNoteEvent, c as NotePlacement, O as OnsetTieBreak, P as PlayabilityIssue, e as PlayabilityIssueType, f as PlayabilityLayer, h as TempoEvent } from '../index-9eoQs2C1.js';
|
|
11
|
+
import { b as InstrumentProfileLike, d as PositionalRng, I as InstrumentProfile, e as StringFingering } from '../positional-DJgs6ltD.js';
|
|
12
|
+
export { a as InstrumentProfileCommon, c as Limb, P as PercussionProfile, S as SeedPath, f as StringedProfile, V as ValidatedPercussionProfile, g as ValidatedProfile, h as ValidatedStringedProfile } from '../positional-DJgs6ltD.js';
|
|
13
|
+
import { c as MeterMap, b as MeterLike, B as BarPosition, T as TimeSignature } from '../index-CL4b4gUQ.js';
|
|
14
|
+
export { M as MeterChange } from '../index-CL4b4gUQ.js';
|
|
15
|
+
import { s as ScaleNameInput, r as ScaleName } from '../masks-Cc7-MzzY.js';
|
|
16
|
+
import { n as TransposingInstrument, r as VoicingOptions, h as ScaleChoice, d as ChordSymbolOptions, m as StyledVoicingOptions, C as ChordScaleMatch, c as ChordScaleReportEntry, A as AvailableTensionsOptions, b as AvoidNotesOptions, K as KeyMode, i as ScaleSystem, q as VoiceRange, P as PartWritingOptions, e as PartWritingViolation, j as Species, k as SpeciesOptions, V as VoiceIndependenceOptions, p as VoiceIndependenceReport } from '../index-BHIUyjhZ.js';
|
|
17
|
+
export { a as AvoidNoteUse, f as PartWritingViolationKind, o as TransposingInstrumentName, s as VoicingStyle } from '../index-BHIUyjhZ.js';
|
|
18
|
+
import { a2 as SubstitutionType, a0 as SubstituteOptions, a1 as Substitution, g as BorrowedChord, z as HumanizeOptions, L as OrnamentOptions, w as GrooveTemplate, d as BassLineOptions, C as Complexity, a4 as Vocabulary, T as ProgressionOptions, o as DrumsOptions, e as BassSegment, h as CounterMelodyOptions, H as HarmonizeOptions, p as GenerationContext, A as MotifCell, F as MotifContour, q as GenerationContextInput, I as MotifNote, K as MotifTransform, Y as RhythmEvent, Z as RhythmOptions } from '../index-BJgP97N1.js';
|
|
19
|
+
export { f as BassStyle, l as DrumRole, E as EuclideanKick, r as Genre, s as GridEvent, t as GrooveFeel, u as GrooveSlot, v as GrooveStyle, x as HarmonizePlacement, M as MelodyNote, N as OrnamentStyle, Q as ProgFunction, R as ProgStyle, S as ProgressionDegree, U as ProgressionPreset, V as Provenance, W as ProvenanceBasis, $ as Section } from '../index-BJgP97N1.js';
|
|
20
|
+
import '../index-Dw2DP7vm.js';
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* An immutable spelled interval value: a diatonic number, a quality label, and
|
|
@@ -66,7 +66,7 @@ declare class Interval {
|
|
|
66
66
|
* @returns The wrapped interval.
|
|
67
67
|
* @throws If the number, quality, and span do not describe the same interval.
|
|
68
68
|
*/
|
|
69
|
-
static fromData(data:
|
|
69
|
+
static fromData(data: IntervalData): Interval;
|
|
70
70
|
/**
|
|
71
71
|
* Rebuild an interval from its {@link Interval.toJSON} output.
|
|
72
72
|
*
|
|
@@ -74,7 +74,7 @@ declare class Interval {
|
|
|
74
74
|
* @returns The wrapped interval.
|
|
75
75
|
* @throws If the number, quality, and span do not describe the same interval.
|
|
76
76
|
*/
|
|
77
|
-
static fromJSON(data:
|
|
77
|
+
static fromJSON(data: IntervalData): Interval;
|
|
78
78
|
/**
|
|
79
79
|
* Parse an interval name such as `'P5'`, `'m3'`, `'AA4'`, or `'-m3'`.
|
|
80
80
|
*
|
|
@@ -114,7 +114,14 @@ declare class Interval {
|
|
|
114
114
|
* semitones, so this flag is the only record of its direction.
|
|
115
115
|
*/
|
|
116
116
|
get isDescending(): boolean;
|
|
117
|
-
/**
|
|
117
|
+
/**
|
|
118
|
+
* A readable label composed of quality and number, e.g. `'P5'` or `'M3'`,
|
|
119
|
+
* prefixed with `'-'` when the interval descends.
|
|
120
|
+
*
|
|
121
|
+
* The name is written in the grammar {@link Interval.parse} reads, so an
|
|
122
|
+
* interval that has been logged, written to a column, or interpolated into a
|
|
123
|
+
* template comes back as the same interval — direction included.
|
|
124
|
+
*/
|
|
118
125
|
get name(): string;
|
|
119
126
|
/** A copy of the underlying plain interval data. */
|
|
120
127
|
get data(): SpelledInterval;
|
|
@@ -146,7 +153,7 @@ declare class Interval {
|
|
|
146
153
|
* @example
|
|
147
154
|
* ```ts
|
|
148
155
|
* import { Interval } from '@libraz/libcantus';
|
|
149
|
-
* Interval.parse('M3').negate().toString(); // 'M3'
|
|
156
|
+
* Interval.parse('M3').negate().toString(); // '-M3'
|
|
150
157
|
* ```
|
|
151
158
|
*/
|
|
152
159
|
negate(): Interval;
|
|
@@ -173,19 +180,20 @@ declare class Interval {
|
|
|
173
180
|
*
|
|
174
181
|
* Private class fields do not serialize, so an explicit `toJSON` keeps
|
|
175
182
|
* `JSON.stringify(interval)` from collapsing to `{}`. The result is the
|
|
176
|
-
* canonical shape the pitch module produces: `descending`
|
|
177
|
-
*
|
|
178
|
-
*
|
|
183
|
+
* canonical shape the pitch module produces: `descending` is always there, so
|
|
184
|
+
* a measured interval, a parsed name, and this method all serialize to the
|
|
185
|
+
* same object and none of them leaves the direction to be guessed.
|
|
179
186
|
*
|
|
180
|
-
* @returns The diatonic number, quality, and semitone span, with
|
|
181
|
-
*
|
|
187
|
+
* @returns The diatonic number, quality, and semitone span, with `descending`
|
|
188
|
+
* telling which way the interval goes.
|
|
182
189
|
*/
|
|
183
190
|
toJSON(): SpelledInterval;
|
|
184
191
|
/**
|
|
185
192
|
* The interval's name, so a template literal or a log line reads as the
|
|
186
193
|
* interval.
|
|
187
194
|
*
|
|
188
|
-
* @returns The name, e.g. `'M3'
|
|
195
|
+
* @returns The name, e.g. `'M3'` or `'-M3'` for the same third taken
|
|
196
|
+
* downward.
|
|
189
197
|
*/
|
|
190
198
|
toString(): string;
|
|
191
199
|
}
|
|
@@ -628,8 +636,10 @@ declare class Timeline {
|
|
|
628
636
|
* Place a progression's chords on a regular grid.
|
|
629
637
|
*
|
|
630
638
|
* The chords cross over as harmony alone: a spelling one of them carried is
|
|
631
|
-
* dropped,
|
|
632
|
-
*
|
|
639
|
+
* dropped, since a chord placed on the grid is a `ChordSpan` and a span
|
|
640
|
+
* carries none. A carried key becomes the one key region under the span,
|
|
641
|
+
* spelled tonic and scale form included — an Ab minor comes back Ab minor,
|
|
642
|
+
* which is what the numerals over the region are read from.
|
|
633
643
|
*
|
|
634
644
|
* @param progression The chords, in order.
|
|
635
645
|
* @param beatsEach How long each chord sounds.
|
|
@@ -660,7 +670,16 @@ declare class Timeline {
|
|
|
660
670
|
get totalBeats(): number;
|
|
661
671
|
/** The key held longest across the span, when the analysis found one. */
|
|
662
672
|
get key(): Key | undefined;
|
|
663
|
-
/**
|
|
673
|
+
/**
|
|
674
|
+
* Every key region under the span, in time order.
|
|
675
|
+
*
|
|
676
|
+
* These are the regions the timeline was built with: the ones
|
|
677
|
+
* {@link Timeline.fromNotes} read off the notes, or the single region a key
|
|
678
|
+
* given to {@link Timeline.fromChords} describes. A timeline holding chords
|
|
679
|
+
* alone carries none until it is asked to read them —
|
|
680
|
+
* {@link Timeline.modulations} is where the chords are searched for the keys
|
|
681
|
+
* they imply.
|
|
682
|
+
*/
|
|
664
683
|
get keys(): readonly KeyRegion[];
|
|
665
684
|
/**
|
|
666
685
|
* How sure the analysis is of each segment's chord, in [0, 1] and in segment
|
|
@@ -719,6 +738,33 @@ declare class Timeline {
|
|
|
719
738
|
* @throws If the timeline carries no key region to read the chords against.
|
|
720
739
|
*/
|
|
721
740
|
cadences(): CadenceHit[];
|
|
741
|
+
/**
|
|
742
|
+
* The keys the chords themselves imply, in time order.
|
|
743
|
+
*
|
|
744
|
+
* The chord route to key regions, for a timeline that holds harmony without
|
|
745
|
+
* the notes it was played from — a lead sheet, or a progression laid out in
|
|
746
|
+
* time. A chord argues for a key far more strongly than its three or four
|
|
747
|
+
* pitch classes do, so a modulation is read off the chords rather than off a
|
|
748
|
+
* pitch-class profile, and the chord that reads in both keys is reported as
|
|
749
|
+
* the pivot the modulation turned on.
|
|
750
|
+
*
|
|
751
|
+
* The regions are searched for here rather than kept on the timeline:
|
|
752
|
+
* {@link Timeline.keys} answers with what the timeline was built with, which
|
|
753
|
+
* for placed chords is the key the caller stated or nothing at all.
|
|
754
|
+
*
|
|
755
|
+
* @param opts Analysis options; see {@link KeyTimelineOptions}.
|
|
756
|
+
* @returns The key regions the chords imply; empty when there are no chords.
|
|
757
|
+
* @example
|
|
758
|
+
* ```ts
|
|
759
|
+
* import { Chord, Key, Progression, Timeline } from '@libraz/libcantus';
|
|
760
|
+
* const progression = new Progression(
|
|
761
|
+
* [Chord.parse('C'), Chord.parse('G7'), Chord.parse('C')],
|
|
762
|
+
* Key.major('C'),
|
|
763
|
+
* );
|
|
764
|
+
* Timeline.fromProgression(progression, 4).modulations().length; // 1
|
|
765
|
+
* ```
|
|
766
|
+
*/
|
|
767
|
+
modulations(opts?: KeyTimelineOptions): KeyRegion[];
|
|
722
768
|
/**
|
|
723
769
|
* The chords as roman numerals in a key.
|
|
724
770
|
*
|
|
@@ -818,9 +864,10 @@ declare class Progression {
|
|
|
818
864
|
* Wrap a chord sequence.
|
|
819
865
|
*
|
|
820
866
|
* @param chords The chords in order; the array is copied.
|
|
821
|
-
* @param key Optional key context for analysis methods
|
|
867
|
+
* @param key Optional key context for analysis methods, in whatever form the
|
|
868
|
+
* caller holds it: a key name, a plain key/scale, or a {@link Key}.
|
|
822
869
|
*/
|
|
823
|
-
constructor(chords: readonly Chord[], key?:
|
|
870
|
+
constructor(chords: readonly Chord[], key?: KeyLike);
|
|
824
871
|
/**
|
|
825
872
|
* Start from a chord sequence, matching the `of` factory on the other
|
|
826
873
|
* classes.
|
|
@@ -838,7 +885,7 @@ declare class Progression {
|
|
|
838
885
|
* // ['I', 'V7']
|
|
839
886
|
* ```
|
|
840
887
|
*/
|
|
841
|
-
static of(chords: readonly Chord[], key?:
|
|
888
|
+
static of(chords: readonly Chord[], key?: KeyLike): Progression;
|
|
842
889
|
/**
|
|
843
890
|
* Build a progression from the {@link ChordSpan} records the generators
|
|
844
891
|
* return, keeping their order.
|
|
@@ -854,11 +901,11 @@ declare class Progression {
|
|
|
854
901
|
* ```ts
|
|
855
902
|
* import { generateProgression, Key, Progression } from '@libraz/libcantus';
|
|
856
903
|
* const key = Key.major('C');
|
|
857
|
-
* const spans = generateProgression({ key
|
|
904
|
+
* const spans = generateProgression({ key, style: 'dance', bars: 4 });
|
|
858
905
|
* Progression.fromSpans(spans, key).roman();
|
|
859
906
|
* ```
|
|
860
907
|
*/
|
|
861
|
-
static fromSpans(spans: readonly ChordSpan[], key?:
|
|
908
|
+
static fromSpans(spans: readonly ChordSpan[], key?: KeyLike): Progression;
|
|
862
909
|
/**
|
|
863
910
|
* Rebuild a progression from its {@link Progression.toJSON} output.
|
|
864
911
|
*
|
|
@@ -1019,10 +1066,11 @@ declare class Progression {
|
|
|
1019
1066
|
/**
|
|
1020
1067
|
* A copy of this progression carrying the given key context.
|
|
1021
1068
|
*
|
|
1022
|
-
* @param key The key context to attach
|
|
1069
|
+
* @param key The key context to attach; a key name, a plain key/scale, or a
|
|
1070
|
+
* {@link Key}.
|
|
1023
1071
|
* @returns The new progression.
|
|
1024
1072
|
*/
|
|
1025
|
-
withKey(key:
|
|
1073
|
+
withKey(key: KeyLike): Progression;
|
|
1026
1074
|
/**
|
|
1027
1075
|
* Voice the progression with smooth voice leading.
|
|
1028
1076
|
*
|
|
@@ -1034,20 +1082,22 @@ declare class Progression {
|
|
|
1034
1082
|
/**
|
|
1035
1083
|
* The Roman numeral of each chord in a key.
|
|
1036
1084
|
*
|
|
1037
|
-
* @param key Key to analyze in
|
|
1085
|
+
* @param key Key to analyze in, as a key name, a plain key/scale, or a
|
|
1086
|
+
* {@link Key}; falls back to the carried context.
|
|
1038
1087
|
* @param opts Applied-numeral rendering options.
|
|
1039
1088
|
* @returns One numeral per chord.
|
|
1040
1089
|
* @throws If no key is given and none is carried.
|
|
1041
1090
|
*/
|
|
1042
|
-
roman(key?:
|
|
1091
|
+
roman(key?: KeyLike, opts?: ChordToRomanOptions): string[];
|
|
1043
1092
|
/**
|
|
1044
1093
|
* The harmonic function of each chord in a key.
|
|
1045
1094
|
*
|
|
1046
|
-
* @param key Key to analyze in
|
|
1095
|
+
* @param key Key to analyze in, as a key name, a plain key/scale, or a
|
|
1096
|
+
* {@link Key}; falls back to the carried context.
|
|
1047
1097
|
* @returns One function per chord.
|
|
1048
1098
|
* @throws If no key is given and none is carried.
|
|
1049
1099
|
*/
|
|
1050
|
-
functions(key?:
|
|
1100
|
+
functions(key?: KeyLike): HarmonicFunction[];
|
|
1051
1101
|
/**
|
|
1052
1102
|
* Analyze every chord and classify the closing cadence.
|
|
1053
1103
|
*
|
|
@@ -1055,12 +1105,15 @@ declare class Progression {
|
|
|
1055
1105
|
* progression has fewer than two chords.
|
|
1056
1106
|
*
|
|
1057
1107
|
* The options reach both analyses: `applied` and `alternatives` go to every
|
|
1058
|
-
* chord, and `voicing` — the pitches
|
|
1059
|
-
* {@link Progression.voice} produces them — to the
|
|
1060
|
-
* a perfect authentic cadence from an imperfect
|
|
1061
|
-
* soprano.
|
|
1062
|
-
*
|
|
1063
|
-
*
|
|
1108
|
+
* chord, and `voicing` — the pitches sounding under the progression, one
|
|
1109
|
+
* voicing per chord as {@link Progression.voice} produces them — to the
|
|
1110
|
+
* cadence, which cannot tell a perfect authentic cadence from an imperfect
|
|
1111
|
+
* one without knowing the soprano. It is the same shape
|
|
1112
|
+
* {@link Progression.cadences} takes, and the closing pair is cut from it
|
|
1113
|
+
* here; a two-element array is read as that pair itself.
|
|
1114
|
+
*
|
|
1115
|
+
* @param key Key to analyze in, as a key name, a plain key/scale, or a
|
|
1116
|
+
* {@link Key}; falls back to the carried context.
|
|
1064
1117
|
* @param opts Applied-numeral rendering options, `alternatives` for the
|
|
1065
1118
|
* readings both analyses turned down, and `voicing` for the cadence's
|
|
1066
1119
|
* voice-leading detail; see {@link AnalyzeChordOptions} and
|
|
@@ -1071,12 +1124,13 @@ declare class Progression {
|
|
|
1071
1124
|
* ```ts
|
|
1072
1125
|
* import { Chord, Key, Progression } from '@libraz/libcantus';
|
|
1073
1126
|
* const progression = new Progression([Chord.parse('G7'), Chord.parse('C')], Key.major('C'));
|
|
1074
|
-
*
|
|
1075
|
-
*
|
|
1076
|
-
* ?.strength; // 'perfect'
|
|
1127
|
+
* progression.analyze(undefined, { voicing: progression.voice() }).cadence?.strength;
|
|
1128
|
+
* // 'perfect'
|
|
1077
1129
|
* ```
|
|
1078
1130
|
*/
|
|
1079
|
-
analyze(key?:
|
|
1131
|
+
analyze(key?: KeyLike, opts?: AnalyzeChordOptions & Omit<DetectCadenceOptions, 'voicing'> & {
|
|
1132
|
+
voicing?: number[][];
|
|
1133
|
+
}): {
|
|
1080
1134
|
chords: ChordAnalysis[];
|
|
1081
1135
|
cadence: CadenceResult | null;
|
|
1082
1136
|
};
|
|
@@ -1098,7 +1152,8 @@ declare class Progression {
|
|
|
1098
1152
|
* The chord before each pair is supplied from the progression itself, so a
|
|
1099
1153
|
* cadential six-four is recognized as one wherever it stands.
|
|
1100
1154
|
*
|
|
1101
|
-
* @param key Key to analyze in
|
|
1155
|
+
* @param key Key to analyze in, as a key name, a plain key/scale, or a
|
|
1156
|
+
* {@link Key}; falls back to the carried context.
|
|
1102
1157
|
* @param opts `voicing` is the pitches sounding under the whole progression,
|
|
1103
1158
|
* one voicing per chord as {@link Progression.voice} produces them, from
|
|
1104
1159
|
* which each pair takes its own two — without it no authentic cadence can be
|
|
@@ -1118,11 +1173,9 @@ declare class Progression {
|
|
|
1118
1173
|
* progression.cadences().map((cadence) => cadence.type); // [null, 'half', 'authentic']
|
|
1119
1174
|
* ```
|
|
1120
1175
|
*/
|
|
1121
|
-
cadences(key?:
|
|
1176
|
+
cadences(key?: KeyLike, opts?: {
|
|
1122
1177
|
voicing?: number[][];
|
|
1123
|
-
|
|
1124
|
-
approach?: Chord;
|
|
1125
|
-
}): CadenceResult[];
|
|
1178
|
+
} & Pick<DetectCadenceOptions, 'alternatives' | 'approach'>): CadenceResult[];
|
|
1126
1179
|
/**
|
|
1127
1180
|
* A copy of this progression with one chord replaced by a substitute.
|
|
1128
1181
|
*
|
|
@@ -1209,7 +1262,8 @@ declare class Progression {
|
|
|
1209
1262
|
* a target in another mode — a relative, parallel, or modal key — is the key
|
|
1210
1263
|
* the progression is then analyzed in.
|
|
1211
1264
|
*
|
|
1212
|
-
* @param target The key the transposed progression should be in
|
|
1265
|
+
* @param target The key the transposed progression should be in, as a key
|
|
1266
|
+
* name, a plain key/scale, or a {@link Key}.
|
|
1213
1267
|
* @returns The transposed progression, carrying `target` as its key.
|
|
1214
1268
|
* @throws If the progression carries no key context to measure from.
|
|
1215
1269
|
* @example
|
|
@@ -1219,7 +1273,7 @@ declare class Progression {
|
|
|
1219
1273
|
* progression.transposeTo(Key.major('Eb')).toString(); // 'Eb Bb7'
|
|
1220
1274
|
* ```
|
|
1221
1275
|
*/
|
|
1222
|
-
transposeTo(target:
|
|
1276
|
+
transposeTo(target: KeyLike): Progression;
|
|
1223
1277
|
/**
|
|
1224
1278
|
* The chord symbols separated by spaces, so a template literal or a log line
|
|
1225
1279
|
* reads as the progression.
|
|
@@ -1257,9 +1311,10 @@ declare class Chord {
|
|
|
1257
1311
|
* Wrap a plain chord object.
|
|
1258
1312
|
*
|
|
1259
1313
|
* @param data The chord; it is copied, never retained or mutated.
|
|
1260
|
-
* @param key Optional key context for analysis methods
|
|
1314
|
+
* @param key Optional key context for analysis methods, in whatever form the
|
|
1315
|
+
* caller holds it: a key name, a plain key/scale, or a {@link Key}.
|
|
1261
1316
|
*/
|
|
1262
|
-
constructor(data: Chord$1, key?:
|
|
1317
|
+
constructor(data: Chord$1, key?: KeyLike);
|
|
1263
1318
|
/**
|
|
1264
1319
|
* Build a chord from a root and quality.
|
|
1265
1320
|
*
|
|
@@ -1315,7 +1370,7 @@ declare class Chord {
|
|
|
1315
1370
|
* ```ts
|
|
1316
1371
|
* import { Chord } from '@libraz/libcantus';
|
|
1317
1372
|
* Chord.fromFiguredBass('B', '6', 'C major').symbol(); // 'G/B'
|
|
1318
|
-
* Chord.fromFiguredBass('G', '
|
|
1373
|
+
* Chord.fromFiguredBass('G', 'n', 'C minor').symbol(); // 'G'
|
|
1319
1374
|
* ```
|
|
1320
1375
|
*/
|
|
1321
1376
|
static fromFiguredBass(bass: NoteLike, figures: string, key: KeyLike): Chord;
|
|
@@ -1441,10 +1496,11 @@ declare class Chord {
|
|
|
1441
1496
|
* during a modulation does not keep the old key's letters and the order of
|
|
1442
1497
|
* `withKey` calls does not affect the result.
|
|
1443
1498
|
*
|
|
1444
|
-
* @param key The key context to attach
|
|
1499
|
+
* @param key The key context to attach; a key name, a plain key/scale, or a
|
|
1500
|
+
* {@link Key}.
|
|
1445
1501
|
* @returns The new chord.
|
|
1446
1502
|
*/
|
|
1447
|
-
withKey(key:
|
|
1503
|
+
withKey(key: KeyLike): Chord;
|
|
1448
1504
|
/**
|
|
1449
1505
|
* The chord's sorted, deduplicated pitch classes.
|
|
1450
1506
|
*
|
|
@@ -1503,12 +1559,13 @@ declare class Chord {
|
|
|
1503
1559
|
/**
|
|
1504
1560
|
* The chord's Roman numeral in a key.
|
|
1505
1561
|
*
|
|
1506
|
-
* @param key Key to analyze in
|
|
1562
|
+
* @param key Key to analyze in, as a key name, a plain key/scale, or a
|
|
1563
|
+
* {@link Key}; falls back to the carried context.
|
|
1507
1564
|
* @param opts Applied-numeral rendering options.
|
|
1508
1565
|
* @returns The Roman numeral string.
|
|
1509
1566
|
* @throws If no key is given and none is carried.
|
|
1510
1567
|
*/
|
|
1511
|
-
roman(key?:
|
|
1568
|
+
roman(key?: KeyLike, opts?: ChordToRomanOptions): string;
|
|
1512
1569
|
/**
|
|
1513
1570
|
* The chord's Roman numeral together with the reasoning behind it: the degree
|
|
1514
1571
|
* its root was read as, the quality that set the numeral's case and suffix,
|
|
@@ -1538,16 +1595,18 @@ declare class Chord {
|
|
|
1538
1595
|
/**
|
|
1539
1596
|
* The chord's harmonic function (tonic / subdominant / dominant) in a key.
|
|
1540
1597
|
*
|
|
1541
|
-
* @param key Key to analyze in
|
|
1598
|
+
* @param key Key to analyze in, as a key name, a plain key/scale, or a
|
|
1599
|
+
* {@link Key}; falls back to the carried context.
|
|
1542
1600
|
* @returns The harmonic function.
|
|
1543
1601
|
* @throws If no key is given and none is carried.
|
|
1544
1602
|
*/
|
|
1545
|
-
function(key?:
|
|
1603
|
+
function(key?: KeyLike): HarmonicFunction;
|
|
1546
1604
|
/**
|
|
1547
1605
|
* Full functional analysis: function, borrowing, Roman numeral, and the
|
|
1548
1606
|
* rationale behind them.
|
|
1549
1607
|
*
|
|
1550
|
-
* @param key Key to analyze in
|
|
1608
|
+
* @param key Key to analyze in, as a key name, a plain key/scale, or a
|
|
1609
|
+
* {@link Key}; falls back to the carried context.
|
|
1551
1610
|
* @param opts Applied-numeral rendering options, plus `alternatives` to
|
|
1552
1611
|
* collect the readings this analysis turned down; see
|
|
1553
1612
|
* {@link AnalyzeChordOptions}.
|
|
@@ -1559,23 +1618,25 @@ declare class Chord {
|
|
|
1559
1618
|
* Chord.parse('D7').analyze(Key.major('C'), { alternatives: true }).alternatives.length;
|
|
1560
1619
|
* ```
|
|
1561
1620
|
*/
|
|
1562
|
-
analyze(key?:
|
|
1621
|
+
analyze(key?: KeyLike, opts?: AnalyzeChordOptions): ChordAnalysis;
|
|
1563
1622
|
/**
|
|
1564
1623
|
* Whether the chord is borrowed from the parallel mode (modal interchange).
|
|
1565
1624
|
*
|
|
1566
|
-
* @param key Key to analyze in
|
|
1625
|
+
* @param key Key to analyze in, as a key name, a plain key/scale, or a
|
|
1626
|
+
* {@link Key}; falls back to the carried context.
|
|
1567
1627
|
* @returns True if the chord is borrowed.
|
|
1568
1628
|
* @throws If no key is given and none is carried.
|
|
1569
1629
|
*/
|
|
1570
|
-
isBorrowed(key?:
|
|
1630
|
+
isBorrowed(key?: KeyLike): boolean;
|
|
1571
1631
|
/**
|
|
1572
1632
|
* The origin of a non-diatonic chord (parallel mode or Neapolitan), or null.
|
|
1573
1633
|
*
|
|
1574
|
-
* @param key Key to analyze in
|
|
1634
|
+
* @param key Key to analyze in, as a key name, a plain key/scale, or a
|
|
1635
|
+
* {@link Key}; falls back to the carried context.
|
|
1575
1636
|
* @returns The borrowing source, or null.
|
|
1576
1637
|
* @throws If no key is given and none is carried.
|
|
1577
1638
|
*/
|
|
1578
|
-
borrowedSource(key?:
|
|
1639
|
+
borrowedSource(key?: KeyLike): BorrowedSource;
|
|
1579
1640
|
/**
|
|
1580
1641
|
* The chord written as the figures a bass would carry under it: `6`, `64`,
|
|
1581
1642
|
* `7`, `65`, `43`, `42`, or nothing at all for a root-position triad, with an
|
|
@@ -1683,12 +1744,12 @@ declare class Chord {
|
|
|
1683
1744
|
* The negative-harmony mirror of the chord about the key's tonic–dominant
|
|
1684
1745
|
* axis (major becomes minor and vice versa).
|
|
1685
1746
|
*
|
|
1686
|
-
* @param key Key providing the reflection axis
|
|
1687
|
-
* context.
|
|
1747
|
+
* @param key Key providing the reflection axis, as a key name, a plain
|
|
1748
|
+
* key/scale, or a {@link Key}; falls back to the carried context.
|
|
1688
1749
|
* @returns The mirrored chord, keeping any key context.
|
|
1689
1750
|
* @throws If no key is given and none is carried.
|
|
1690
1751
|
*/
|
|
1691
|
-
negativeHarmony(key?:
|
|
1752
|
+
negativeHarmony(key?: KeyLike): Chord;
|
|
1692
1753
|
/**
|
|
1693
1754
|
* The V7 that tonicizes this chord: a dominant seventh a perfect fifth above
|
|
1694
1755
|
* this chord's root.
|
|
@@ -1759,6 +1820,10 @@ declare class Chord {
|
|
|
1759
1820
|
* The named scales that fit over this chord, best fit first, rooted on the
|
|
1760
1821
|
* chord root.
|
|
1761
1822
|
*
|
|
1823
|
+
* Only the scales of {@link NAMED_SCALES} are ranked: chord-scale theory is a
|
|
1824
|
+
* Western practice, so the scales of {@link WORLD_SCALES} are left out rather
|
|
1825
|
+
* than offered as answers over a chord.
|
|
1826
|
+
*
|
|
1762
1827
|
* @returns The matching scales.
|
|
1763
1828
|
*/
|
|
1764
1829
|
scales(): ChordScaleMatch[];
|
|
@@ -1786,12 +1851,16 @@ declare class Chord {
|
|
|
1786
1851
|
* The available tensions (usable non-chord, non-avoid scale tones) of a
|
|
1787
1852
|
* scale over this chord.
|
|
1788
1853
|
*
|
|
1789
|
-
* @param scaleName A
|
|
1854
|
+
* @param scaleName A scale of {@link NAMED_SCALES}, or one of its aliases,
|
|
1855
|
+
* rooted on the chord root. The scales of {@link WORLD_SCALES} are refused
|
|
1856
|
+
* here as they are by {@link Chord.scales}: chord-scale theory is a Western
|
|
1857
|
+
* practice, and a scale from another tradition offered over a chord would
|
|
1858
|
+
* read as an answer while being a category error.
|
|
1790
1859
|
* @param opts Set `resolvesTo` to the plain chord this one resolves to, so a
|
|
1791
1860
|
* dominant resolving down a fifth onto a minor tonic takes the tensions
|
|
1792
1861
|
* that resolution makes available; see {@link AvailableTensionsOptions}.
|
|
1793
1862
|
* @returns Tension pitch classes, ascending in [0, 11].
|
|
1794
|
-
* @throws If `scaleName` is not
|
|
1863
|
+
* @throws If `scaleName` is not one of the named scales or their aliases.
|
|
1795
1864
|
* @example
|
|
1796
1865
|
* ```ts
|
|
1797
1866
|
* import { Chord } from '@libraz/libcantus';
|
|
@@ -1805,12 +1874,16 @@ declare class Chord {
|
|
|
1805
1874
|
* The avoid notes (scale tones a semitone above a chord tone) of a scale
|
|
1806
1875
|
* over this chord.
|
|
1807
1876
|
*
|
|
1808
|
-
* @param scaleName A
|
|
1877
|
+
* @param scaleName A scale of {@link NAMED_SCALES}, or one of its aliases,
|
|
1878
|
+
* rooted on the chord root. The scales of {@link WORLD_SCALES} are refused
|
|
1879
|
+
* here as they are by {@link Chord.scales}: chord-scale theory is a Western
|
|
1880
|
+
* practice, and a scale from another tradition offered over a chord would
|
|
1881
|
+
* read as an answer while being a category error.
|
|
1809
1882
|
* @param opts Set `use: 'melodic'` to judge a line rather than a voicing, so
|
|
1810
1883
|
* a tone a line may pass through is not counted; see
|
|
1811
1884
|
* {@link AvoidNotesOptions}.
|
|
1812
1885
|
* @returns Avoid-note pitch classes, ascending in [0, 11].
|
|
1813
|
-
* @throws If `scaleName` is not
|
|
1886
|
+
* @throws If `scaleName` is not one of the named scales or their aliases.
|
|
1814
1887
|
* @example
|
|
1815
1888
|
* ```ts
|
|
1816
1889
|
* import { Chord } from '@libraz/libcantus';
|
|
@@ -1831,14 +1904,16 @@ declare class Chord {
|
|
|
1831
1904
|
* are the notes the chord sounds — the same set {@link Chord.pitchClasses}
|
|
1832
1905
|
* reports.
|
|
1833
1906
|
*
|
|
1834
|
-
* @param key Key providing the spelled tonic
|
|
1835
|
-
*
|
|
1907
|
+
* @param key Key providing the spelled tonic, as a key name, a plain
|
|
1908
|
+
* key/scale, or a {@link Key} — the tonic its letters are spelled from is
|
|
1909
|
+
* derived from the key rather than asked of the caller. Falls back to the
|
|
1910
|
+
* carried context, then to the chord's own root spelling.
|
|
1836
1911
|
* @returns Spelled octave-less notes in the chord's own (tertian) order,
|
|
1837
1912
|
* with any foreign slash bass last.
|
|
1838
1913
|
* @throws If no key is given, none is carried, and the chord has no root
|
|
1839
1914
|
* spelling of its own.
|
|
1840
1915
|
*/
|
|
1841
|
-
spell(key?:
|
|
1916
|
+
spell(key?: KeyLike): Note[];
|
|
1842
1917
|
/**
|
|
1843
1918
|
* Start a progression with this chord followed by others, carrying this
|
|
1844
1919
|
* chord's key context (if any).
|
|
@@ -1894,17 +1969,13 @@ type DetectedKeyMatch = Omit<KeyMatch, 'key'> & {
|
|
|
1894
1969
|
};
|
|
1895
1970
|
/**
|
|
1896
1971
|
* The plain form of a {@link Key}: the key/scale, the spelled tonic that
|
|
1897
|
-
* anchors its letter names, and the
|
|
1972
|
+
* anchors its letter names, and the scale form it stands in.
|
|
1898
1973
|
*
|
|
1899
|
-
* The
|
|
1900
|
-
*
|
|
1901
|
-
*
|
|
1974
|
+
* The same shape the theory layer resolves a key to, so a key crossing between
|
|
1975
|
+
* the two carries the same three facts under the same names, and a project file
|
|
1976
|
+
* holds what every layer reads.
|
|
1902
1977
|
*/
|
|
1903
|
-
type KeyData =
|
|
1904
|
-
scale: KeyScale;
|
|
1905
|
-
tonic: Note$1;
|
|
1906
|
-
variant?: KeyVariant;
|
|
1907
|
-
};
|
|
1978
|
+
type KeyData = ResolvedKey;
|
|
1908
1979
|
/**
|
|
1909
1980
|
* An immutable key/scale: a `KeyScale` (root pitch class plus mode mask) paired
|
|
1910
1981
|
* with a spelled tonic that anchors letter-name spelling. Acts as the factory
|
|
@@ -1924,7 +1995,9 @@ declare class Key {
|
|
|
1924
1995
|
*
|
|
1925
1996
|
* @param scale The key/scale; its root is normalized to a pitch class.
|
|
1926
1997
|
* @param tonic The spelled tonic anchoring letter-name spelling.
|
|
1927
|
-
* @param variant
|
|
1998
|
+
* @param variant The scale form. Read from the mask when none is named: a
|
|
1999
|
+
* major mask is a major key whoever built it, and a key with no form at all
|
|
2000
|
+
* is a state a reader would have to guess about.
|
|
1928
2001
|
*/
|
|
1929
2002
|
constructor(scale: KeyScale, tonic: Note, variant?: KeyVariant);
|
|
1930
2003
|
/**
|
|
@@ -1966,8 +2039,12 @@ declare class Key {
|
|
|
1966
2039
|
* is G sharp major and `'gis'` G sharp minor; see {@link parseKeyName} for
|
|
1967
2040
|
* how a name whose case and mode word disagree is read.
|
|
1968
2041
|
*
|
|
1969
|
-
*
|
|
1970
|
-
*
|
|
2042
|
+
* An English name may also name a built-in scale instead of a mode —
|
|
2043
|
+
* `'D harmonic minor'`, `'D dorian'`, `'C major pentatonic'` — which is what
|
|
2044
|
+
* {@link Key.toString} writes for a key that is neither a plain major nor a
|
|
2045
|
+
* plain minor, so a key survives being written down and read back. Only the
|
|
2046
|
+
* tonic's spelling survives from the name, so `'ges dur'` is G flat major,
|
|
2047
|
+
* not F sharp major.
|
|
1971
2048
|
*
|
|
1972
2049
|
* @param text The key name.
|
|
1973
2050
|
* @param opts `system` reads the name in that notation system instead of
|
|
@@ -2009,7 +2086,7 @@ declare class Key {
|
|
|
2009
2086
|
*
|
|
2010
2087
|
* A signature names two keys — three sharps is both A major and F# minor — so
|
|
2011
2088
|
* the mode decides which one is built. The tonic is spelled the way that key
|
|
2012
|
-
* is written, including the theoretical keys past ±7 (nine sharps is
|
|
2089
|
+
* is written, including the theoretical keys past ±7 (nine sharps is D#
|
|
2013
2090
|
* major).
|
|
2014
2091
|
*
|
|
2015
2092
|
* @param fifths The signed number of sharps (positive) or flats (negative).
|
|
@@ -2034,12 +2111,18 @@ declare class Key {
|
|
|
2034
2111
|
* This is what keeps `Key.of(detectKey(...).scale)` from handing every
|
|
2035
2112
|
* downstream chord a double-sharp spelling.
|
|
2036
2113
|
*
|
|
2037
|
-
*
|
|
2038
|
-
*
|
|
2114
|
+
* A value that already carries a spelling keeps it — a key region's key, the
|
|
2115
|
+
* data a key serializes to — so wrapping one is not where an Ab minor becomes
|
|
2116
|
+
* a G# minor. Only a bare key/scale has a tonic chosen for it, because only a
|
|
2117
|
+
* bare key/scale is missing one.
|
|
2118
|
+
*
|
|
2119
|
+
* @param key The key to wrap, in any form a key is held in.
|
|
2120
|
+
* @param tonic Optional spelled tonic, overriding any the value carries; must
|
|
2121
|
+
* spell the scale's root pitch class.
|
|
2039
2122
|
* @returns The key.
|
|
2040
2123
|
* @throws If the given tonic is not the scale's root pitch class.
|
|
2041
2124
|
*/
|
|
2042
|
-
static of(
|
|
2125
|
+
static of(key: KeyLike, tonic?: Note): Key;
|
|
2043
2126
|
/**
|
|
2044
2127
|
* Rebuild a key from its {@link Key.toJSON} output.
|
|
2045
2128
|
*
|
|
@@ -2143,7 +2226,7 @@ declare class Key {
|
|
|
2143
2226
|
/** A copy of the underlying plain key data. */
|
|
2144
2227
|
get data(): KeyData;
|
|
2145
2228
|
/** The detected scale form, when this key came from key detection. */
|
|
2146
|
-
get variant(): KeyVariant
|
|
2229
|
+
get variant(): KeyVariant;
|
|
2147
2230
|
/**
|
|
2148
2231
|
* The scale's pitch classes.
|
|
2149
2232
|
*
|
|
@@ -2209,12 +2292,18 @@ declare class Key {
|
|
|
2209
2292
|
*/
|
|
2210
2293
|
supportsFunctionalHarmony(): boolean;
|
|
2211
2294
|
/**
|
|
2212
|
-
* The relative key:
|
|
2295
|
+
* The relative key: for a plain major or minor key, the same key signature
|
|
2296
|
+
* read in the other mode.
|
|
2213
2297
|
*
|
|
2214
2298
|
* Because the new tonic is read off the circle of fifths rather than
|
|
2215
2299
|
* transposed by semitones, the relative of Db major is Bb minor and not its
|
|
2216
2300
|
* enharmonic A# minor.
|
|
2217
2301
|
*
|
|
2302
|
+
* A key that is not a plain major or minor is read through the mode its third
|
|
2303
|
+
* names and stepped from where its tonic stands on the circle: the relative of
|
|
2304
|
+
* D dorian is F major. The shared signature does not carry over to those —
|
|
2305
|
+
* D dorian is written with no accidentals and F major with one.
|
|
2306
|
+
*
|
|
2218
2307
|
* @returns The relative key, always a plain major or minor key.
|
|
2219
2308
|
* @throws If this key's signature falls outside [-12, 12] fifths.
|
|
2220
2309
|
* @example
|
|
@@ -2286,10 +2375,16 @@ declare class Key {
|
|
|
2286
2375
|
*
|
|
2287
2376
|
* These are the keys the German and Japanese teaching tradition counts as a
|
|
2288
2377
|
* key's near relations: the relative and parallel keys, the dominant and the
|
|
2289
|
-
* subdominant, and the relatives of those two.
|
|
2290
|
-
* within one accidental of this key's signature — the
|
|
2291
|
-
* exactly and the other four stand one away; the parallel
|
|
2292
|
-
* away and belongs to the set for the tonic it shares
|
|
2378
|
+
* subdominant, and the relatives of those two. For a plain major or minor key
|
|
2379
|
+
* five of them are written within one accidental of this key's signature — the
|
|
2380
|
+
* relative shares it exactly and the other four stand one away; the parallel
|
|
2381
|
+
* key stands three away and belongs to the set for the tonic it shares
|
|
2382
|
+
* instead.
|
|
2383
|
+
*
|
|
2384
|
+
* A key that is not a plain major or minor is read through the mode its third
|
|
2385
|
+
* names, so its relations are walked from where its tonic stands on the circle
|
|
2386
|
+
* rather than from its own signature, and those accidental counts do not
|
|
2387
|
+
* describe them.
|
|
2293
2388
|
*
|
|
2294
2389
|
* @returns The related keys in relation order.
|
|
2295
2390
|
* @throws If a neighbouring signature falls outside [-12, 12] fifths.
|
|
@@ -2328,6 +2423,34 @@ declare class Key {
|
|
|
2328
2423
|
* ```
|
|
2329
2424
|
*/
|
|
2330
2425
|
relationTo(other: Key): KeyRelation | null;
|
|
2426
|
+
/**
|
|
2427
|
+
* The chords a modulation from this key into another can pivot on.
|
|
2428
|
+
*
|
|
2429
|
+
* A pivot belongs to both keys at once, so it is heard as a degree of this
|
|
2430
|
+
* key and reinterpreted as a degree of the key being entered. The candidates
|
|
2431
|
+
* are this key's diatonic triads, kept when every one of their pitch classes
|
|
2432
|
+
* is also a scale tone of `other`; each is reported with its numeral in both
|
|
2433
|
+
* keys. A key that stacks no diatonic triads offers nothing to pivot on and
|
|
2434
|
+
* yields an empty list rather than an error.
|
|
2435
|
+
*
|
|
2436
|
+
* @param other The key being entered, as a key name, a plain key/scale, or a
|
|
2437
|
+
* {@link Key}.
|
|
2438
|
+
* @returns The shared triads, ascending by their degree in this key, each
|
|
2439
|
+
* chord carrying this key as its context.
|
|
2440
|
+
* @example
|
|
2441
|
+
* ```ts
|
|
2442
|
+
* import { Key } from '@libraz/libcantus';
|
|
2443
|
+
* Key.major('C')
|
|
2444
|
+
* .pivotsTo('G major')
|
|
2445
|
+
* .map((pivot) => `${pivot.romanFrom}=${pivot.romanTo}`);
|
|
2446
|
+
* // ['I=IV', 'iii=vi', 'V=I', 'vi=ii']
|
|
2447
|
+
* ```
|
|
2448
|
+
*/
|
|
2449
|
+
pivotsTo(other: KeyLike): {
|
|
2450
|
+
chord: Chord;
|
|
2451
|
+
romanFrom: string;
|
|
2452
|
+
romanTo: string;
|
|
2453
|
+
}[];
|
|
2331
2454
|
/**
|
|
2332
2455
|
* A scale degree, counted from 1 the way musicians name degrees: `degree(1)`
|
|
2333
2456
|
* is the tonic and `degree(5)` the dominant.
|
|
@@ -2352,6 +2475,11 @@ declare class Key {
|
|
|
2352
2475
|
* of C major gives F major. A scale with no diatonic triads — anything that
|
|
2353
2476
|
* is not heptatonic — falls back to this key's own mode.
|
|
2354
2477
|
*
|
|
2478
|
+
* The tonic is derived rather than given, so the result is respelled to its
|
|
2479
|
+
* enharmonic key whenever the letter arithmetic lands past the signatures keys
|
|
2480
|
+
* are written with: the fourth degree of a C blues scale reads as F# minor,
|
|
2481
|
+
* not as the Gb minor and its nine flats.
|
|
2482
|
+
*
|
|
2355
2483
|
* @param n The 1-based scale degree, as {@link Key.degree} counts them.
|
|
2356
2484
|
* @param mode The mode of the resulting key; inferred when omitted.
|
|
2357
2485
|
* @returns The key on that degree.
|
|
@@ -2454,7 +2582,11 @@ declare class Key {
|
|
|
2454
2582
|
* lower than it reads — has its part written a major second higher, and a
|
|
2455
2583
|
* concert C major becomes D major. The tonic is spelled by the interval, so
|
|
2456
2584
|
* a concert E flat major reads as F major on that instrument rather than as
|
|
2457
|
-
* E sharp major, and the mode mask is untouched.
|
|
2585
|
+
* E sharp major, and the mode mask is untouched. What the interval spells is
|
|
2586
|
+
* then respelled to its enharmonic key whenever it would not be written that
|
|
2587
|
+
* way, since a part is what a player is actually handed: a concert F# major
|
|
2588
|
+
* on a B flat clarinet reads as A flat major rather than as a G# major with an
|
|
2589
|
+
* F double sharp in its signature.
|
|
2458
2590
|
*
|
|
2459
2591
|
* The opposite reading, a written key back to the key it sounds in, is
|
|
2460
2592
|
* {@link Key.transposeBy} applied to {@link instrumentTransposition} — the
|
|
@@ -2469,6 +2601,7 @@ declare class Key {
|
|
|
2469
2601
|
* import { Key, instrumentTransposition } from '@libraz/libcantus';
|
|
2470
2602
|
* Key.major('C').forInstrument('clarinetBb').toString(); // 'D major'
|
|
2471
2603
|
* Key.major('C').forInstrument('hornF').toString(); // 'G major'
|
|
2604
|
+
* Key.major('F#').forInstrument('clarinetBb').toString(); // 'Ab major'
|
|
2472
2605
|
* // And back: what a part written in C major on a clarinet in A sounds as.
|
|
2473
2606
|
* Key.major('C').transposeBy(instrumentTransposition('clarinetA')).toString(); // 'A major'
|
|
2474
2607
|
* ```
|
|
@@ -2574,6 +2707,25 @@ declare class Key {
|
|
|
2574
2707
|
* @throws If the numeral is not valid.
|
|
2575
2708
|
*/
|
|
2576
2709
|
roman(text: string): Chord;
|
|
2710
|
+
/**
|
|
2711
|
+
* The augmented sixth chord of a kind, built in this key.
|
|
2712
|
+
*
|
|
2713
|
+
* The three kinds share the augmented sixth between the lowered sixth degree
|
|
2714
|
+
* and the raised fourth and differ in what fills it: the Italian doubles the
|
|
2715
|
+
* tonic, the French adds the second degree, and the German the third. The
|
|
2716
|
+
* chord is spelled as the interval demands rather than as its enharmonic
|
|
2717
|
+
* dominant seventh, which is what keeps its outward resolution readable.
|
|
2718
|
+
*
|
|
2719
|
+
* @param kind Which augmented sixth to build.
|
|
2720
|
+
* @returns The chord, with this key attached.
|
|
2721
|
+
* @throws If the kind names none of the three.
|
|
2722
|
+
* @example
|
|
2723
|
+
* ```ts
|
|
2724
|
+
* import { Key } from '@libraz/libcantus';
|
|
2725
|
+
* Key.major('C').augmentedSixth('german').rootPc; // 8 (the lowered sixth degree)
|
|
2726
|
+
* ```
|
|
2727
|
+
*/
|
|
2728
|
+
augmentedSixth(kind: AugmentedSixthKind): Chord;
|
|
2577
2729
|
/**
|
|
2578
2730
|
* Build a progression from Roman numerals in this key.
|
|
2579
2731
|
*
|
|
@@ -2647,13 +2799,20 @@ declare class Key {
|
|
|
2647
2799
|
*/
|
|
2648
2800
|
toJSON(): KeyData;
|
|
2649
2801
|
/**
|
|
2650
|
-
* The key's tonic and
|
|
2651
|
-
*
|
|
2802
|
+
* The key's tonic and the scale it is read in, so a template literal or a log
|
|
2803
|
+
* line reads as the key.
|
|
2804
|
+
*
|
|
2805
|
+
* The scale word is a function of the scale alone — its root pitch class and
|
|
2806
|
+
* mode mask — rather than of how the key was built, so two keys holding the
|
|
2807
|
+
* same scale print the same name: a harmonic minor names itself one whether
|
|
2808
|
+
* it was detected or asked for by name, and a mode names its mode instead of
|
|
2809
|
+
* the major or minor key its third would make it. What is printed is what
|
|
2810
|
+
* {@link Key.parse} reads back.
|
|
2652
2811
|
*
|
|
2653
2812
|
* A `system` names the key the way that notation system writes it, including
|
|
2654
|
-
* German's case convention. The scale
|
|
2655
|
-
* the other systems have no word for it — so a
|
|
2656
|
-
*
|
|
2813
|
+
* German's case convention. The scale word is an English-only qualifier —
|
|
2814
|
+
* the other systems have no word for it — so a harmonic minor names its
|
|
2815
|
+
* parallel plain minor there.
|
|
2657
2816
|
*
|
|
2658
2817
|
* @param opts `system` writes the name in that notation system instead of
|
|
2659
2818
|
* English.
|
|
@@ -2662,8 +2821,8 @@ declare class Key {
|
|
|
2662
2821
|
* ```ts
|
|
2663
2822
|
* import { Key } from '@libraz/libcantus';
|
|
2664
2823
|
* Key.minor('G#').toString(); // 'G# minor'
|
|
2824
|
+
* Key.named('dorian', 'D').toString(); // 'D dorian'
|
|
2665
2825
|
* Key.minor('G#').toString({ system: 'german' }); // 'gis moll'
|
|
2666
|
-
* Key.minor('G#').toString({ system: 'japanese' }); // '嬰ト短調'
|
|
2667
2826
|
* ```
|
|
2668
2827
|
*/
|
|
2669
2828
|
toString(opts?: NoteNameOptions): string;
|
|
@@ -2822,6 +2981,11 @@ declare class Score {
|
|
|
2822
2981
|
/**
|
|
2823
2982
|
* The score moved by a number of semitones.
|
|
2824
2983
|
*
|
|
2984
|
+
* A carried key moves with the notes, so the score that comes back is read in
|
|
2985
|
+
* the key it now sounds in and every analysis taken from it — its timeline,
|
|
2986
|
+
* its numerals, its phrases — is taken against that key rather than against
|
|
2987
|
+
* the one it was written in.
|
|
2988
|
+
*
|
|
2825
2989
|
* @param semitones The signed semitone offset.
|
|
2826
2990
|
* @returns The transposed score.
|
|
2827
2991
|
* @throws If a note would leave the MIDI range.
|
|
@@ -2832,7 +2996,9 @@ declare class Score {
|
|
|
2832
2996
|
*
|
|
2833
2997
|
* Note events carry a MIDI pitch and no spelling of their own, so the
|
|
2834
2998
|
* interval contributes its size and its direction; a carried key is what
|
|
2835
|
-
* keeps the spelling, and it moves with the notes
|
|
2999
|
+
* keeps the spelling, and it moves with the notes — by the interval itself,
|
|
3000
|
+
* so an augmented fourth and a diminished fifth land on differently spelled
|
|
3001
|
+
* keys.
|
|
2836
3002
|
*
|
|
2837
3003
|
* @param interval An interval name (e.g. `'A4'`, `'-m3'`), plain interval
|
|
2838
3004
|
* data, or an {@link Interval}; a descending interval moves down.
|
|
@@ -2946,6 +3112,13 @@ declare class Score {
|
|
|
2946
3112
|
/**
|
|
2947
3113
|
* Every key region the score passes through, in time order.
|
|
2948
3114
|
*
|
|
3115
|
+
* A score that was told its key answers with that key across the whole of it,
|
|
3116
|
+
* as {@link Score.key} and {@link Score.timeline} do: the caller has already
|
|
3117
|
+
* answered the question, and searching for a modulation away from a stated
|
|
3118
|
+
* key would make the option read as a hint where it was given as an
|
|
3119
|
+
* instruction. Only `totalBeats` is read from the options there, since the
|
|
3120
|
+
* rest tune a search that is not run.
|
|
3121
|
+
*
|
|
2949
3122
|
* @param opts Analysis options; see {@link KeyTimelineOptions}.
|
|
2950
3123
|
* @returns The regions; empty when nothing sounds.
|
|
2951
3124
|
*/
|
|
@@ -2973,7 +3146,7 @@ declare class Score {
|
|
|
2973
3146
|
* score.detectKeys()[0]?.key.rootPc; // 0
|
|
2974
3147
|
* ```
|
|
2975
3148
|
*/
|
|
2976
|
-
detectKeys(opts?: Omit<DetectKeyOptions, 'weights'>):
|
|
3149
|
+
detectKeys(opts?: Omit<DetectKeyOptions, 'weights'>): DetectedKeyMatch[];
|
|
2977
3150
|
/**
|
|
2978
3151
|
* The phrases the notes fall into.
|
|
2979
3152
|
*
|
|
@@ -3008,6 +3181,10 @@ declare class Score {
|
|
|
3008
3181
|
/**
|
|
3009
3182
|
* The bar-level pulse above the meter.
|
|
3010
3183
|
*
|
|
3184
|
+
* The cadences come from the score's own harmony unless the caller passes
|
|
3185
|
+
* their own, so this reads the same grouping {@link Score.phrases} builds its
|
|
3186
|
+
* phrases on rather than a second one that ignores where the music closes.
|
|
3187
|
+
*
|
|
3011
3188
|
* @param opts Analysis options; see {@link HypermeterOptions}.
|
|
3012
3189
|
* @returns The grouping, its downbeats, a confidence, and a rationale.
|
|
3013
3190
|
*/
|
|
@@ -3023,6 +3200,12 @@ declare class Score {
|
|
|
3023
3200
|
* A record is a cell, so `Motif.fromData(found)` reaches the
|
|
3024
3201
|
* transformations without anything being rebuilt by hand.
|
|
3025
3202
|
*
|
|
3203
|
+
* A melody is one line, so a score holding several is read as its top voice:
|
|
3204
|
+
* notes struck together are one event and the highest of them stands for it.
|
|
3205
|
+
* A piano part read whole therefore answers for the voice a listener follows
|
|
3206
|
+
* rather than for a line assembled from the insides of its chords. Split the
|
|
3207
|
+
* score into lines first to have each of them answered for.
|
|
3208
|
+
*
|
|
3026
3209
|
* @param opts Cell-length bounds and the recurrence threshold; see
|
|
3027
3210
|
* {@link ExtractMotifsOptions}.
|
|
3028
3211
|
* @returns The motifs found, longest first.
|
|
@@ -3043,7 +3226,15 @@ declare class Score {
|
|
|
3043
3226
|
* ```
|
|
3044
3227
|
*/
|
|
3045
3228
|
motifs(opts?: ExtractMotifsOptions): MotifData[];
|
|
3046
|
-
/**
|
|
3229
|
+
/**
|
|
3230
|
+
* The shape the melody traces.
|
|
3231
|
+
*
|
|
3232
|
+
* A contour is the shape of one line, so a score holding several is read as
|
|
3233
|
+
* its top voice: notes struck together are one event and the highest of them
|
|
3234
|
+
* stands for it, which keeps a chord from being measured as a climb through
|
|
3235
|
+
* its own notes. Split the score into lines first to have each of them
|
|
3236
|
+
* answered for; {@link Score.voices} is what reads the polyphony as polyphony.
|
|
3237
|
+
*/
|
|
3047
3238
|
contour(): MelodicContour;
|
|
3048
3239
|
/**
|
|
3049
3240
|
* Each note's role in the harmony sounding under it.
|
|
@@ -3055,7 +3246,14 @@ declare class Score {
|
|
|
3055
3246
|
* chord — reads every note against C major and no chord at all, which labels
|
|
3056
3247
|
* the notes as the non-chord tones they are rather than failing.
|
|
3057
3248
|
*
|
|
3058
|
-
*
|
|
3249
|
+
* A score holds a whole piece rather than a single line, so the notes are read
|
|
3250
|
+
* as the polyphony they are: each note is classified in its own voice, against
|
|
3251
|
+
* everything else sounding under it. That is what a suspension needs — a
|
|
3252
|
+
* dissonance is dissonant against something — and it is what keeps a note of
|
|
3253
|
+
* one voice from being heard as the passing tone of another.
|
|
3254
|
+
*
|
|
3255
|
+
* @param key The key to read the notes in, as a key name, a plain key/scale,
|
|
3256
|
+
* or a {@link Key}; defaults to the score's own.
|
|
3059
3257
|
* @returns One annotation per note, in the score's own time order.
|
|
3060
3258
|
*/
|
|
3061
3259
|
voices(key?: KeyLike): AnalyzedNote[];
|
|
@@ -3074,7 +3272,11 @@ declare class Score {
|
|
|
3074
3272
|
/**
|
|
3075
3273
|
* Whether an instrument can play the score, and what makes it hard.
|
|
3076
3274
|
*
|
|
3077
|
-
* The
|
|
3275
|
+
* The third layer asks how much time separates two notes, and the score
|
|
3276
|
+
* answers it from its whole tempo map: a passage under an accelerando is
|
|
3277
|
+
* judged at the tempo actually in force across it, the same integral
|
|
3278
|
+
* {@link Score.secondsAt} reports. The beats the issues name are the score's
|
|
3279
|
+
* own.
|
|
3078
3280
|
*
|
|
3079
3281
|
* @param instrument The instrument to play it on: a plain
|
|
3080
3282
|
* {@link InstrumentProfile} or an {@link Instrument}.
|
|
@@ -3338,6 +3540,10 @@ declare class Arrangement {
|
|
|
3338
3540
|
* annotations describe the same chords rather than two readings of the same
|
|
3339
3541
|
* notes.
|
|
3340
3542
|
*
|
|
3543
|
+
* Naming a key, its regions, or the tracks the harmony is read from asks for
|
|
3544
|
+
* a harmony this arrangement did not find, so the curve is read under the one
|
|
3545
|
+
* named rather than over the one it holds.
|
|
3546
|
+
*
|
|
3341
3547
|
* @param opts The sampling step, and any setting to lay over the
|
|
3342
3548
|
* arrangement's own; a meter named here replaces the arrangement's, since
|
|
3343
3549
|
* `ts` and `meters` name the same thing.
|
|
@@ -3410,6 +3616,24 @@ type ComposerOptions = {
|
|
|
3410
3616
|
instruments?: Record<string, InstrumentProfileLike>;
|
|
3411
3617
|
/** Extra material the generators may draw from. */
|
|
3412
3618
|
vocabulary?: readonly Vocabulary<unknown>[];
|
|
3619
|
+
/**
|
|
3620
|
+
* The algorithm version the parts are generated under; defaults to the
|
|
3621
|
+
* version this build produces. Naming it is what closes a reproduction
|
|
3622
|
+
* recipe: a seed alone reproduces a piece only for as long as the algorithms
|
|
3623
|
+
* behind it stay where they were, and a project that recorded the version it
|
|
3624
|
+
* was written under can ask for that version back.
|
|
3625
|
+
*/
|
|
3626
|
+
algorithmVersion?: number;
|
|
3627
|
+
/**
|
|
3628
|
+
* Draw from this source instead of one derived from `seed`. Each part still
|
|
3629
|
+
* addresses its own namespace, so parts do not collide.
|
|
3630
|
+
*
|
|
3631
|
+
* A live handle rather than settings, so it is held by reference and left out
|
|
3632
|
+
* of the plain data {@link Composer.data} hands back: a source cannot be
|
|
3633
|
+
* written to a project file, and copying one would hand back a second stream
|
|
3634
|
+
* rather than the same one.
|
|
3635
|
+
*/
|
|
3636
|
+
rng?: PositionalRng;
|
|
3413
3637
|
};
|
|
3414
3638
|
/**
|
|
3415
3639
|
* How a bass line is written: what {@link BassLineOptions} asks for minus the
|
|
@@ -3469,6 +3693,14 @@ type HarmonizedMelody = {
|
|
|
3469
3693
|
* tempo, and the pitched ones in its key, so the scores it hands back line up
|
|
3470
3694
|
* with each other without being re-contextualized one at a time.
|
|
3471
3695
|
*
|
|
3696
|
+
* A composer that names no key writes no pitched part: {@link Composer.bass},
|
|
3697
|
+
* {@link Composer.progression} and {@link Composer.counterMelody} refuse rather
|
|
3698
|
+
* than fall back on a key of the library's choosing, which would be a piece in
|
|
3699
|
+
* a key nobody asked for with nothing to say so. {@link Composer.drums} carries
|
|
3700
|
+
* no key and is written either way, and {@link Composer.harmonize} reads a key
|
|
3701
|
+
* off the melody it is given; `with({ key })` carries that key over to the
|
|
3702
|
+
* parts written after it.
|
|
3703
|
+
*
|
|
3472
3704
|
* Immutable like every other class here: `withSeed` and friends return a new
|
|
3473
3705
|
* composer rather than reconfiguring this one, so a variation can be written
|
|
3474
3706
|
* beside the original instead of replacing it.
|
|
@@ -3516,15 +3748,23 @@ declare class Composer {
|
|
|
3516
3748
|
/**
|
|
3517
3749
|
* A chord progression, in time.
|
|
3518
3750
|
*
|
|
3519
|
-
* The chords are laid out one per
|
|
3520
|
-
*
|
|
3521
|
-
*
|
|
3751
|
+
* The chords are laid out one per bar of the composer's own meter, so a chord
|
|
3752
|
+
* change falls on a bar line of the piece and the timeline spans `bars` of it:
|
|
3753
|
+
* four beats each in 4/4, three in 3/4, and three in 6/8. Every other part is
|
|
3754
|
+
* written against that grid, and harmony that is not on it drifts further from
|
|
3755
|
+
* the bar line with every repeat.
|
|
3522
3756
|
*
|
|
3523
|
-
* @param opts Everything the progression generator takes but the key
|
|
3524
|
-
* context, which are the composer's.
|
|
3757
|
+
* @param opts Everything the progression generator takes but the key, the
|
|
3758
|
+
* meter and the context, which are the composer's.
|
|
3525
3759
|
* @returns The chords over the beats they sound for.
|
|
3760
|
+
* @throws If the composer names no key: the chords are degrees of one, and
|
|
3761
|
+
* there is no melody here to read a key from the way
|
|
3762
|
+
* {@link Composer.harmonize} does.
|
|
3763
|
+
* @throws If the composer's meter changes: one chord per bar has no single bar
|
|
3764
|
+
* length to be laid out on, and the chords would leave the bar lines at the
|
|
3765
|
+
* first change rather than follow them.
|
|
3526
3766
|
*/
|
|
3527
|
-
progression(opts: Omit<ProgressionOptions, 'key' | 'ctx'>): Timeline;
|
|
3767
|
+
progression(opts: Omit<ProgressionOptions, 'key' | 'ctx' | 'ts'>): Timeline;
|
|
3528
3768
|
/**
|
|
3529
3769
|
* A drum part.
|
|
3530
3770
|
*
|
|
@@ -3536,8 +3776,10 @@ declare class Composer {
|
|
|
3536
3776
|
* @param opts Everything the drum generator takes but the meter and the
|
|
3537
3777
|
* context, which are the composer's.
|
|
3538
3778
|
* @returns The hits, as a score.
|
|
3539
|
-
* @throws If the composer's meter is not 4/4, which is the only
|
|
3540
|
-
* drum patterns are written against
|
|
3779
|
+
* @throws If the composer's meter is not 4/4 throughout, which is the only
|
|
3780
|
+
* meter the drum patterns are written against: a piece that opens in 4/4
|
|
3781
|
+
* and changes later has bars the patterns cannot be laid out on, so the
|
|
3782
|
+
* request is refused rather than answered with 4/4 bars over the change.
|
|
3541
3783
|
*/
|
|
3542
3784
|
drums(opts: Omit<DrumsOptions, 'ts' | 'ctx'>): Score;
|
|
3543
3785
|
/**
|
|
@@ -3548,6 +3790,8 @@ declare class Composer {
|
|
|
3548
3790
|
* @param opts Everything the bass generator takes but the segments, the key,
|
|
3549
3791
|
* the meter and the context; see {@link BassLineSettings}.
|
|
3550
3792
|
* @returns The line, as a score in the composer's key.
|
|
3793
|
+
* @throws If the composer names no key: the line is written in one, and a
|
|
3794
|
+
* default key would put the part in a key the caller never asked for.
|
|
3551
3795
|
* @throws If the instrument names a kit, which has no strings for a bass line
|
|
3552
3796
|
* to be placed on.
|
|
3553
3797
|
* @example
|
|
@@ -3574,6 +3818,9 @@ declare class Composer {
|
|
|
3574
3818
|
* @param opts Everything the counter-melody generator takes but the melody,
|
|
3575
3819
|
* the key, the meter and the context; see {@link CounterMelodySettings}.
|
|
3576
3820
|
* @returns The counter line, as a score in the composer's key.
|
|
3821
|
+
* @throws If the composer names no key: the line is written in one, and the
|
|
3822
|
+
* melody it answers is not read for a key here — {@link Composer.harmonize}
|
|
3823
|
+
* is the member that does that.
|
|
3577
3824
|
*/
|
|
3578
3825
|
counterMelody(melody: Score, opts?: CounterMelodySettings): Score;
|
|
3579
3826
|
/**
|
|
@@ -3590,8 +3837,7 @@ declare class Composer {
|
|
|
3590
3837
|
* that melody and the one handed in.
|
|
3591
3838
|
* @example
|
|
3592
3839
|
* ```ts
|
|
3593
|
-
* import { Composer } from '@libraz/libcantus';
|
|
3594
|
-
* import { Score } from '../../src/model/score.js';
|
|
3840
|
+
* import { Composer, Score } from '@libraz/libcantus';
|
|
3595
3841
|
* const composer = Composer.of({ key: 'C major' });
|
|
3596
3842
|
* const melody = Score.of([{ pitch: 60, startBeat: 0, durationBeat: 4 }]);
|
|
3597
3843
|
* composer.harmonize(melody).transposeSemitones; // 0
|
|
@@ -3602,7 +3848,14 @@ declare class Composer {
|
|
|
3602
3848
|
* Whether another composer holds the same settings.
|
|
3603
3849
|
*
|
|
3604
3850
|
* The comparison is made through the other composer's public data, so two
|
|
3605
|
-
* composers built by different copies of the module still compare.
|
|
3851
|
+
* composers built by different copies of the module still compare. Both sides
|
|
3852
|
+
* are projected the same way: comparing the settings held here against the
|
|
3853
|
+
* data the other hands out answered "different" for a composer holding a
|
|
3854
|
+
* source and "same" for two that draw from different ones.
|
|
3855
|
+
*
|
|
3856
|
+
* A source is compared by identity, being a handle on a stream rather than a
|
|
3857
|
+
* setting: two composers drawing from different sources write different
|
|
3858
|
+
* parts, and the numbers a source will hand out cannot be read from it.
|
|
3606
3859
|
*
|
|
3607
3860
|
* @param other The composer to compare.
|
|
3608
3861
|
* @returns True when both would generate the same parts.
|
|
@@ -3610,7 +3863,15 @@ declare class Composer {
|
|
|
3610
3863
|
equals(other: Composer): boolean;
|
|
3611
3864
|
/** The resolved context, for handing back to the function API. */
|
|
3612
3865
|
get context(): GenerationContext;
|
|
3613
|
-
/**
|
|
3866
|
+
/**
|
|
3867
|
+
* A copy of the settings this composer holds: the seed, the resolved
|
|
3868
|
+
* algorithm version and the rest of the recipe, so a piece can be written
|
|
3869
|
+
* again from what a project file stored.
|
|
3870
|
+
*
|
|
3871
|
+
* The source a composer was handed is left out, being a live handle rather
|
|
3872
|
+
* than plain data; a composer built with one keeps it across
|
|
3873
|
+
* {@link Composer.with} and its siblings.
|
|
3874
|
+
*/
|
|
3614
3875
|
get data(): ComposerOptions;
|
|
3615
3876
|
/** The plain form of the settings, for `JSON.stringify`. */
|
|
3616
3877
|
toJSON(): ComposerOptions;
|
|
@@ -3800,7 +4061,7 @@ declare class Instrument {
|
|
|
3800
4061
|
* tuning, stretch or voice count that is not finite.
|
|
3801
4062
|
* @example
|
|
3802
4063
|
* ```ts
|
|
3803
|
-
* import { GUITAR_DROP_D } from '
|
|
4064
|
+
* import { GUITAR_DROP_D } from '@libraz/libcantus/core';
|
|
3804
4065
|
* import { Instrument } from '@libraz/libcantus';
|
|
3805
4066
|
* Instrument.of(GUITAR_DROP_D).range().low; // 38
|
|
3806
4067
|
* ```
|
|
@@ -3902,8 +4163,9 @@ declare class Instrument {
|
|
|
3902
4163
|
* what a player does with a line written below the instrument.
|
|
3903
4164
|
*
|
|
3904
4165
|
* @param pitch MIDI pitch to place.
|
|
3905
|
-
* @returns The nearest octave transposition the instrument sounds,
|
|
3906
|
-
*
|
|
4166
|
+
* @returns The nearest octave transposition the instrument sounds, taking the
|
|
4167
|
+
* upper one when two are equally near; the pitch unchanged when no
|
|
4168
|
+
* transposition is available.
|
|
3907
4169
|
* @example
|
|
3908
4170
|
* ```ts
|
|
3909
4171
|
* import { Instrument } from '@libraz/libcantus';
|
|
@@ -4087,7 +4349,7 @@ declare class Meter {
|
|
|
4087
4349
|
get isCompound(): boolean;
|
|
4088
4350
|
/** Length of a bar in quarter-note beats. */
|
|
4089
4351
|
get beatsPerBar(): number;
|
|
4090
|
-
/** Main pulses (felt beats) in a bar:
|
|
4352
|
+
/** Main pulses (felt beats) in a bar: 2 in 6/8, 4 in 4/4. */
|
|
4091
4353
|
get pulsesPerBar(): number;
|
|
4092
4354
|
/**
|
|
4093
4355
|
* Length of one felt beat in quarter-note beats: a quarter note in simple
|
|
@@ -4099,13 +4361,19 @@ declare class Meter {
|
|
|
4099
4361
|
* additive grouping and one is asked for.
|
|
4100
4362
|
*
|
|
4101
4363
|
* @param opts Set `grouping: true` to render an additive grouping. A
|
|
4102
|
-
* grouping counted in main pulses
|
|
4103
|
-
*
|
|
4364
|
+
* grouping counted in main pulses has no additive spelling: one whose
|
|
4365
|
+
* groups are all the same length states the division the bare signature
|
|
4366
|
+
* already has and falls back to the plain form, and one whose groups differ
|
|
4367
|
+
* is refused rather than printed as a bar that weighs its pulses otherwise.
|
|
4104
4368
|
* @returns The formatted signature.
|
|
4369
|
+
* @throws If `grouping: true` is asked of a grouping that no signature text
|
|
4370
|
+
* can spell: one counted in main pulses, on a compound numerator, whose
|
|
4371
|
+
* groups are not all the same length — 12/8 as `[1, 1, 2]`.
|
|
4105
4372
|
* @example
|
|
4106
4373
|
* ```ts
|
|
4107
4374
|
* import { Meter } from '@libraz/libcantus';
|
|
4108
4375
|
* Meter.of(7, 8, [2, 2, 3]).format({ grouping: true }); // '2+2+3/8'
|
|
4376
|
+
* Meter.of(12, 8, [1, 1, 1, 1]).format({ grouping: true }); // '12/8'
|
|
4109
4377
|
* ```
|
|
4110
4378
|
*/
|
|
4111
4379
|
format(opts?: {
|
|
@@ -4145,13 +4413,18 @@ declare class Meter {
|
|
|
4145
4413
|
*
|
|
4146
4414
|
* @param beatInQuarters Position in quarter-note beats.
|
|
4147
4415
|
* @param decimals Digits of the fractional beat to keep.
|
|
4148
|
-
* @returns The formatted position
|
|
4416
|
+
* @returns The formatted position in one of two forms: `bar.beat` on a felt
|
|
4417
|
+
* beat, e.g. `'3.2'` for bar 3, felt beat 2; and `bar.beat+fraction`
|
|
4418
|
+
* between felt beats, e.g. `'3.2+0.5'` halfway from the second felt beat to
|
|
4419
|
+
* the third. A reader of these strings has to take both, since most onsets
|
|
4420
|
+
* of an ordinary piece fall between pulses.
|
|
4149
4421
|
* @throws If the position is not finite or `decimals` is not an integer in
|
|
4150
4422
|
* 0..100.
|
|
4151
4423
|
* @example
|
|
4152
4424
|
* ```ts
|
|
4153
4425
|
* import { Meter } from '@libraz/libcantus';
|
|
4154
4426
|
* Meter.parse('6/8').formatPosition(7.5); // '3.2'
|
|
4427
|
+
* Meter.parse('6/8').formatPosition(8.25); // '3.2+0.5'
|
|
4155
4428
|
* ```
|
|
4156
4429
|
*/
|
|
4157
4430
|
formatPosition(beatInQuarters: number, decimals?: number): string;
|
|
@@ -4212,11 +4485,12 @@ type MotifGenerateOptions = {
|
|
|
4212
4485
|
/** Length of the motif in bars of `ts`. */
|
|
4213
4486
|
bars: number;
|
|
4214
4487
|
/**
|
|
4215
|
-
* Meter the bars are counted in, which sets the bar length
|
|
4488
|
+
* Meter the bars are counted in, which sets the bar length, in any form
|
|
4489
|
+
* that names one.
|
|
4216
4490
|
*
|
|
4217
4491
|
* @defaultValue 4/4
|
|
4218
4492
|
*/
|
|
4219
|
-
ts?:
|
|
4493
|
+
ts?: MeterLike;
|
|
4220
4494
|
/**
|
|
4221
4495
|
* Melodic contour shape the line follows.
|
|
4222
4496
|
*
|
|
@@ -4314,12 +4588,16 @@ declare class Motif {
|
|
|
4314
4588
|
/**
|
|
4315
4589
|
* The cell put through one of the classical transformations.
|
|
4316
4590
|
*
|
|
4317
|
-
* `invert` reflects the pitches about the
|
|
4318
|
-
* the onsets about the cell's span, both self-inverse; `augment` and
|
|
4591
|
+
* `invert` reflects the pitches about the earliest note and `retrograde`
|
|
4592
|
+
* mirrors the onsets about the cell's span, both self-inverse; `augment` and
|
|
4319
4593
|
* `diminish` scale the note values by `amount` and its reciprocal;
|
|
4320
4594
|
* `transposeChromatic` moves by semitones; `transposeDiatonic` and `sequence`
|
|
4321
4595
|
* move by scale degrees with a key in hand, and by semitones without one.
|
|
4322
4596
|
*
|
|
4597
|
+
* The result's notes run in time order whichever way the source cell was
|
|
4598
|
+
* written, so an inversion of a retrograde reflects about the note that now
|
|
4599
|
+
* sounds first.
|
|
4600
|
+
*
|
|
4323
4601
|
* @param kind The transformation.
|
|
4324
4602
|
* @param amount Semitones, scale degrees, or the time factor, as the
|
|
4325
4603
|
* transformation reads it.
|
|
@@ -4349,21 +4627,26 @@ declare class Motif {
|
|
|
4349
4627
|
* plain chord timeline the analysis layer hands out.
|
|
4350
4628
|
* @param key The key the passing notes are kept in.
|
|
4351
4629
|
* @param bars How many bars to fill.
|
|
4352
|
-
* @param ts Meter the bars are counted in
|
|
4630
|
+
* @param ts Meter the bars are counted in, in any form that names one. A
|
|
4631
|
+
* motif carries no meter of its own — it is a run of notes — so there is
|
|
4632
|
+
* nothing to fall back on, and a development laid on the wrong bar length
|
|
4633
|
+
* drifts off the part it plays under.
|
|
4353
4634
|
* @returns The developed motif.
|
|
4354
4635
|
* @throws If the bar count is not a positive integer.
|
|
4355
4636
|
*/
|
|
4356
|
-
develop(timeline: Timeline | ChordTimeline, key: KeyLike, bars: number, ts
|
|
4637
|
+
develop(timeline: Timeline | ChordTimeline, key: KeyLike, bars: number, ts: MeterLike): Motif;
|
|
4357
4638
|
/**
|
|
4358
4639
|
* How this motif stands to another: the transformation that turns one into
|
|
4359
4640
|
* the other, named.
|
|
4360
4641
|
*
|
|
4361
4642
|
* @param other The statement to name against this one.
|
|
4362
|
-
* @param key Key context for the tonal reading
|
|
4363
|
-
* only
|
|
4643
|
+
* @param key Key context for the tonal reading. Without one an answer holding
|
|
4644
|
+
* only diatonically is left unnamed unless its interval pattern also fits
|
|
4645
|
+
* the retrograde family, in which case it is named there; a motif carries no
|
|
4646
|
+
* key of its own, so this is the only way to have the tonal reading offered.
|
|
4364
4647
|
* @returns The relation, or null when the two stand in none.
|
|
4365
4648
|
*/
|
|
4366
|
-
relateTo(other: Motif, key?:
|
|
4649
|
+
relateTo(other: Motif, key?: SpelledKeyLike): MotifRelation | null;
|
|
4367
4650
|
/**
|
|
4368
4651
|
* How alike two lines are, in [0, 1].
|
|
4369
4652
|
*
|
|
@@ -4458,32 +4741,39 @@ declare class Rhythm {
|
|
|
4458
4741
|
/**
|
|
4459
4742
|
* Generate a pattern over a meter.
|
|
4460
4743
|
*
|
|
4461
|
-
* @param ts The time signature the bars are counted in
|
|
4744
|
+
* @param ts The time signature the bars are counted in, in any form that
|
|
4745
|
+
* names one; a meter map is read as the signature it opens in.
|
|
4462
4746
|
* @param opts Length, grid resolution and the context; see
|
|
4463
4747
|
* {@link RhythmOptions}. The context's `complexity.rhythmic` is the onset
|
|
4464
4748
|
* density, and its `seed` fixes which grid slots are taken.
|
|
4465
4749
|
* @returns The generated pattern.
|
|
4466
4750
|
* @example
|
|
4467
4751
|
* ```ts
|
|
4468
|
-
* import { parseTimeSignature } from '@libraz/libcantus';
|
|
4469
4752
|
* import { Rhythm } from '@libraz/libcantus';
|
|
4470
|
-
* const rhythm = Rhythm.generate(
|
|
4753
|
+
* const rhythm = Rhythm.generate('4/4', {
|
|
4471
4754
|
* bars: 2,
|
|
4472
4755
|
* ctx: { seed: 7, complexity: { rhythmic: 0.6 } },
|
|
4473
4756
|
* });
|
|
4474
4757
|
* rhythm.totalBeats; // 8
|
|
4475
4758
|
* ```
|
|
4476
4759
|
*/
|
|
4477
|
-
static generate(ts:
|
|
4760
|
+
static generate(ts: MeterLike, opts?: RhythmOptions): Rhythm;
|
|
4478
4761
|
/**
|
|
4479
4762
|
* Build a pattern from onsets that already exist.
|
|
4480
4763
|
*
|
|
4764
|
+
* The meter is asked for rather than assumed. A pattern in 6/8 read as 4/4
|
|
4765
|
+
* answers every metric question — which beats are strong, where the bars
|
|
4766
|
+
* fall, how dense it is — on the wrong pulse, and nothing downstream can tell
|
|
4767
|
+
* that reading from a meter the caller meant. Its two siblings,
|
|
4768
|
+
* {@link Rhythm.generate} and `generateRhythm`, ask for it the same way.
|
|
4769
|
+
*
|
|
4481
4770
|
* @param events The onsets, in any order.
|
|
4482
|
-
* @param ts The meter they are counted in
|
|
4483
|
-
* meter-aware function in the library assumes.
|
|
4771
|
+
* @param ts The meter they are counted in, in any form that names one.
|
|
4484
4772
|
* @returns The pattern.
|
|
4773
|
+
* @throws If the meter names no signature, or an onset carries a value a
|
|
4774
|
+
* pattern cannot hold.
|
|
4485
4775
|
*/
|
|
4486
|
-
static of(events: readonly RhythmEvent[], ts
|
|
4776
|
+
static of(events: readonly RhythmEvent[], ts: MeterLike): Rhythm;
|
|
4487
4777
|
/** Rebuild a pattern from the plain data {@link Rhythm.data} hands out. */
|
|
4488
4778
|
static fromData(data: RhythmData): Rhythm;
|
|
4489
4779
|
/** Rebuild a pattern from its {@link Rhythm.toJSON} output. */
|
|
@@ -4505,6 +4795,10 @@ declare class Rhythm {
|
|
|
4505
4795
|
/**
|
|
4506
4796
|
* Drop the onsets carrying the least of the metre.
|
|
4507
4797
|
*
|
|
4798
|
+
* The metre is the pattern's own: the ranks are read from {@link Rhythm.ts},
|
|
4799
|
+
* so a pattern in 6/8 keeps its dotted-quarter pulses and one in 3/4 keeps its
|
|
4800
|
+
* three-beat downbeats rather than the beats a four-beat bar would have.
|
|
4801
|
+
*
|
|
4508
4802
|
* @param amount How much to thin, in [0, 1]; at 0 nothing goes, and a full
|
|
4509
4803
|
* turn leaves the downbeats alone.
|
|
4510
4804
|
* @returns The thinned pattern.
|
|
@@ -4514,8 +4808,11 @@ declare class Rhythm {
|
|
|
4514
4808
|
/**
|
|
4515
4809
|
* Anticipate beats, one sixteenth early.
|
|
4516
4810
|
*
|
|
4517
|
-
* The
|
|
4518
|
-
*
|
|
4811
|
+
* The beats anticipated are the ones {@link Rhythm.ts} counts as main pulses
|
|
4812
|
+
* or stronger, so a pattern is not syncopated against accents its own meter
|
|
4813
|
+
* does not have. The anticipations are added rather than displaced, so raising
|
|
4814
|
+
* the amount only ever adds onsets and the ones already sounding stay where
|
|
4815
|
+
* they are.
|
|
4519
4816
|
*
|
|
4520
4817
|
* @param amount How much syncopation, in [0, 1].
|
|
4521
4818
|
* @param ctx The context, or the seed alone; it fixes which beats are
|
|
@@ -4593,7 +4890,9 @@ declare class Rhythm {
|
|
|
4593
4890
|
* @param pitch The MIDI pitch to give every onset.
|
|
4594
4891
|
* @param velocity Velocity for every onset; a mezzo-forte 96 by default.
|
|
4595
4892
|
* @returns The score holding the pattern.
|
|
4596
|
-
* @throws If the pitch is not
|
|
4893
|
+
* @throws If the pitch or the velocity is not a whole MIDI value in [0, 127];
|
|
4894
|
+
* both are the numbers a note event carries, and a fractional one is not a
|
|
4895
|
+
* note anything downstream can sound.
|
|
4597
4896
|
* @example
|
|
4598
4897
|
* ```ts
|
|
4599
4898
|
* import { parseTimeSignature } from '@libraz/libcantus';
|
|
@@ -4774,18 +5073,20 @@ declare class Tuning {
|
|
|
4774
5073
|
/**
|
|
4775
5074
|
* Wrap a plain tuning table.
|
|
4776
5075
|
*
|
|
4777
|
-
*
|
|
4778
|
-
*
|
|
4779
|
-
*
|
|
5076
|
+
* Every field is read off the table, so a deserialized or hand-written one
|
|
5077
|
+
* cannot enter carrying a division count or a reference frequency no
|
|
5078
|
+
* frequency follows from. None of the three has a default here, unlike
|
|
5079
|
+
* {@link Tuning.edo}: a table that lost its reference frequency on the way
|
|
5080
|
+
* through storage is refused rather than quietly retuned to A=440.
|
|
4780
5081
|
*
|
|
4781
5082
|
* @param table The plain tuning table.
|
|
4782
5083
|
* @returns The wrapped tuning.
|
|
4783
|
-
* @throws If the divisions are not a positive integer,
|
|
4784
|
-
*
|
|
5084
|
+
* @throws If a field is missing, the divisions are not a positive integer,
|
|
5085
|
+
* the reference frequency is not a finite positive number, or the reference
|
|
5086
|
+
* step is not finite.
|
|
4785
5087
|
* @example
|
|
4786
5088
|
* ```ts
|
|
4787
|
-
* import { TWELVE_TET } from '
|
|
4788
|
-
* import { Tuning } from '@libraz/libcantus';
|
|
5089
|
+
* import { TWELVE_TET, Tuning } from '@libraz/libcantus';
|
|
4789
5090
|
* Tuning.of(TWELVE_TET).divisions; // 12
|
|
4790
5091
|
* ```
|
|
4791
5092
|
*/
|
|
@@ -4798,8 +5099,10 @@ declare class Tuning {
|
|
|
4798
5099
|
* @param refStep Step index of the reference; 69 by default, the MIDI number
|
|
4799
5100
|
* of A4.
|
|
4800
5101
|
* @returns The tuning.
|
|
4801
|
-
* @throws If the divisions are not a positive integer,
|
|
4802
|
-
*
|
|
5102
|
+
* @throws If the divisions are not a positive integer, the reference
|
|
5103
|
+
* frequency is not a finite positive number, or the reference step is not
|
|
5104
|
+
* finite. A negative or fractional reference step is accepted: it is what a
|
|
5105
|
+
* tuner reading or a pitch-bend calibration lands on.
|
|
4803
5106
|
* @example
|
|
4804
5107
|
* ```ts
|
|
4805
5108
|
* import { Tuning } from '@libraz/libcantus';
|
|
@@ -4858,7 +5161,8 @@ declare class Tuning {
|
|
|
4858
5161
|
*
|
|
4859
5162
|
* @param cents The interval in cents.
|
|
4860
5163
|
* @returns The frequency ratio.
|
|
4861
|
-
* @throws If `cents` is not finite
|
|
5164
|
+
* @throws If `cents` is not finite, or the ratio it spans falls outside the
|
|
5165
|
+
* range a number holds.
|
|
4862
5166
|
* @example
|
|
4863
5167
|
* ```ts
|
|
4864
5168
|
* import { Tuning } from '@libraz/libcantus';
|
|
@@ -5057,7 +5361,13 @@ declare class Tuning {
|
|
|
5057
5361
|
}
|
|
5058
5362
|
|
|
5059
5363
|
/**
|
|
5060
|
-
* The plain form of a {@link Voicing}: the sounding MIDI pitches
|
|
5364
|
+
* The plain form of a {@link Voicing}: the sounding MIDI pitches in voice
|
|
5365
|
+
* order, lowest voice first.
|
|
5366
|
+
*
|
|
5367
|
+
* Voice order, not sorted order. A voicing is normally ascending, and one that
|
|
5368
|
+
* is not is exactly what a voice crossing is — the class keeps the order it was
|
|
5369
|
+
* built with so the crossing survives to be reported, so a caller reading the
|
|
5370
|
+
* lowest sounding pitch takes the minimum rather than the first entry.
|
|
5061
5371
|
*
|
|
5062
5372
|
* The voicing functions all speak this array, so the class hands out exactly
|
|
5063
5373
|
* what they take rather than a wrapper of its own.
|
|
@@ -5171,6 +5481,10 @@ declare class Voicing {
|
|
|
5171
5481
|
* The bass takes the chord's slash bass when it has one, otherwise the root;
|
|
5172
5482
|
* the result is compact, centred in its ranges, and free of voice crossing.
|
|
5173
5483
|
*
|
|
5484
|
+
* A chord that carries a key passes it to the voicer, so the leading tone is
|
|
5485
|
+
* not doubled; an explicit `opts.key` overrides it. That is the order
|
|
5486
|
+
* {@link Chord.voice} resolves them in, and the two answer alike.
|
|
5487
|
+
*
|
|
5174
5488
|
* @param chord A chord symbol, plain chord data, or a {@link Chord}.
|
|
5175
5489
|
* @param opts Voicing options; defaults to four voices in {@link SATB_RANGES}.
|
|
5176
5490
|
* @returns The voicing, ascending.
|
|
@@ -5228,7 +5542,7 @@ declare class Voicing {
|
|
|
5228
5542
|
* @param key A key name, a plain key/scale, or a {@link Key}.
|
|
5229
5543
|
* @param chord The chord sounding, supplying the enharmonic evidence; without
|
|
5230
5544
|
* it the key alone decides.
|
|
5231
|
-
* @returns One spelled note per pitch,
|
|
5545
|
+
* @returns One spelled note per pitch, in voice order.
|
|
5232
5546
|
* @throws If the value names no key or no chord.
|
|
5233
5547
|
* @example
|
|
5234
5548
|
* ```ts
|
|
@@ -5245,7 +5559,13 @@ declare class Voicing {
|
|
|
5245
5559
|
* `voices` nor `ranges` is given — within a one-octave window around each of
|
|
5246
5560
|
* these pitches, so the answer keeps this voicing's voice count. Each is
|
|
5247
5561
|
* scored by structural quality, motion from here, and a large penalty per
|
|
5248
|
-
* counterpoint violation.
|
|
5562
|
+
* counterpoint violation. A chord that carries a key passes it to the voicer
|
|
5563
|
+
* unless `opts.key` names another one.
|
|
5564
|
+
*
|
|
5565
|
+
* The rules read from the chord being left — a chordal seventh's resolution,
|
|
5566
|
+
* a leading tone's resolution, and the cross relation between the two chords
|
|
5567
|
+
* — are scored only when `opts.previousChord` names that chord: a voicing
|
|
5568
|
+
* does not say what it was written on.
|
|
5249
5569
|
*
|
|
5250
5570
|
* @param chord A chord symbol, plain chord data, or a {@link Chord}.
|
|
5251
5571
|
* @param opts Voicing options; when omitted, the ranges follow this voicing.
|
|
@@ -5262,8 +5582,8 @@ declare class Voicing {
|
|
|
5262
5582
|
next(chord: ChordLike, opts?: VoicingOptions): Voicing;
|
|
5263
5583
|
/**
|
|
5264
5584
|
* The voice-leading cost from this voicing to another: the summed absolute
|
|
5265
|
-
* semitone motion across voices,
|
|
5266
|
-
*
|
|
5585
|
+
* semitone motion across voices, and nothing besides. What the motion breaks
|
|
5586
|
+
* is {@link Voicing.checkTo}'s question.
|
|
5267
5587
|
*
|
|
5268
5588
|
* @param other The voicing moved to.
|
|
5269
5589
|
* @returns The cost, or `Infinity` when the two hold a different number of
|
|
@@ -5352,7 +5672,8 @@ declare class Voicing {
|
|
|
5352
5672
|
* @param pitch The candidate MIDI pitch.
|
|
5353
5673
|
* @param query The candidate's harmonic and voice-leading context.
|
|
5354
5674
|
* @param opts Set `suggestions: false` to skip the search for safe
|
|
5355
|
-
* replacements when the verdict is not safe
|
|
5675
|
+
* replacements when the verdict is not safe, and `partners: true` to learn
|
|
5676
|
+
* which voice of this voicing, by index, raised each pairwise flag.
|
|
5356
5677
|
* @returns The verdict, reason bitmask, and optional resolution guidance.
|
|
5357
5678
|
* @throws If the profile is unknown, a value names no chord or key, or a
|
|
5358
5679
|
* pitch is not a MIDI pitch in 0..127.
|
|
@@ -5384,13 +5705,14 @@ declare class Voicing {
|
|
|
5384
5705
|
* times over.
|
|
5385
5706
|
*
|
|
5386
5707
|
* A negative `n` takes the highest voice down an octave as many times, and
|
|
5387
|
-
* `invert(0)` is the voicing itself
|
|
5388
|
-
* rotates a chord's interval template, this moves
|
|
5389
|
-
* four-voice texture four times leaves the same chord
|
|
5390
|
-
*
|
|
5708
|
+
* `invert(0)` is the voicing itself, voice order and all. Unlike
|
|
5709
|
+
* {@link Chord.invert}, which rotates a chord's interval template, this moves
|
|
5710
|
+
* real voices: inverting a four-voice texture four times leaves the same chord
|
|
5711
|
+
* an octave higher. A voicing that actually inverts comes back ascending,
|
|
5712
|
+
* since the voice that moved is no longer where it was.
|
|
5391
5713
|
*
|
|
5392
5714
|
* @param n How many voices to move, upward when positive.
|
|
5393
|
-
* @returns The inverted voicing, ascending.
|
|
5715
|
+
* @returns The inverted voicing, ascending; this voicing itself when `n` is 0.
|
|
5394
5716
|
* @throws If `n` is not an integer in [-128, 128], or a voice would leave
|
|
5395
5717
|
* MIDI 0..127.
|
|
5396
5718
|
* @example
|
|
@@ -5416,16 +5738,16 @@ declare class Voicing {
|
|
|
5416
5738
|
* Private class fields do not serialize, so an explicit `toJSON` keeps
|
|
5417
5739
|
* `JSON.stringify(voicing)` from collapsing to `{}`.
|
|
5418
5740
|
*
|
|
5419
|
-
* @returns A copy of the sounding MIDI pitches,
|
|
5741
|
+
* @returns A copy of the sounding MIDI pitches, in voice order.
|
|
5420
5742
|
*/
|
|
5421
5743
|
toJSON(): VoicingData;
|
|
5422
5744
|
/**
|
|
5423
5745
|
* The pitches separated by spaces, so a template literal or a log line reads
|
|
5424
5746
|
* as the voicing.
|
|
5425
5747
|
*
|
|
5426
|
-
* @returns The pitches
|
|
5748
|
+
* @returns The pitches in voice order, e.g. `'60 64 67'`.
|
|
5427
5749
|
*/
|
|
5428
5750
|
toString(): string;
|
|
5429
5751
|
}
|
|
5430
5752
|
|
|
5431
|
-
export { AnalyzeChordOptions, AnalyzedNote, Arrangement, ArrangementAnalysis, type ArrangementData, ArrangementOptions, type ArrangementSettings, type ArrangementSetup, type ArrangementTensionOptions, ArrangementTrack, Articulation, AvailableTensionsOptions, AvoidNotesOptions, BarPosition, BassLineOptions, type BassLineSettings, BassSegment, BorrowedChord, BorrowedSource, CadenceHit, CadenceResult, Chord, ChordAnalysis, Chord$1 as ChordData, ChordLike, ChordMatch, ChordQuality, ChordScaleMatch, ChordScaleReportEntry, ChordSegment, ChordSpan, ChordSpec, ChordSymbolOptions, ChordTimeline, ChordTimelineOptions, ChordToRomanOptions, ChordToneRole, Complexity, Composer, type ComposerOptions, Conflict, CounterMelodyOptions, type CounterMelodySettings, DetectCadenceOptions, DetectChordOptions, DetectKeyOptions, type DetectedKeyMatch, DrumsOptions, Duration, DurationData, EvaluateSafetyOptions, ExplainRomanOptions, ExtractMotifsOptions, FormSection, FormSectionOptions, GenerationContext, GenerationContextInput, GrooveTemplate, HarmonicFunction, HarmonizeOptions, type HarmonizedMelody, HumanizeOptions, Hypermeter, HypermeterOptions, IdentifiedVoiceNote, Instrument, InstrumentProfile, InstrumentProfileLike, Interval, IntervalLike, IntervalQualityLabel, Key, type KeyData, KeyLike, KeyMatch, KeyMode, KeyRegion, KeyRelation, KeyScale, KeyTimelineOptions, KeyVariant, MelodicContour, Meter, MeterLike, MeterMap, Motif, MotifCell, MotifContour, MotifData, type MotifGenerateOptions, MotifNote, MotifRelation, MotifTransform, Note, Note$1 as NoteData, NoteEvent, NoteEventIndex, NoteEventIndexOptions, NoteLike, NoteNameOptions, NoteValue, OrnamentOptions, ParseResult, PartWritingOptions, PartWritingViolation, Phrase, PhraseOptions, PlayabilityReport, Progression, type ProgressionData, ProgressionOptions, ReduceProgressionOptions, ReducedChord, Rhythm, type RhythmData, type RhythmDeformOptions, RhythmEvent, RhythmOptions, RomanExplanation, SafetyQuery, SafetyResult, ScaleChoice, ScaleName, ScaleNameInput, ScaleSystem, Score, type ScoreData, type ScoreOptions, Species, SpeciesOptions, SpelledDuration, SpelledInterval, StringFingering, StructuralCadence, StyledVoicingOptions, SubstituteOptions, Substitution, SubstitutionType, Tempo, type TempoData, TempoMap, TensionPoint, TimeSignature, Timeline, type TimelineData, type TimelineRoman, TrackEdit, TransposingInstrument, Tuning, TuningTable, Tuplet, Vocabulary, VoiceIndependenceOptions, VoiceIndependenceReport, VoiceRange, Voicing, type VoicingData, type VoicingIndependenceOptions, VoicingOptions, type VoicingSafetyQuery };
|
|
5753
|
+
export { AnalyzeChordOptions, AnalyzedNote, Arrangement, ArrangementAnalysis, type ArrangementData, ArrangementOptions, type ArrangementSettings, type ArrangementSetup, type ArrangementTensionOptions, ArrangementTrack, Articulation, AugmentedSixthKind, AvailableTensionsOptions, AvoidNotesOptions, BarPosition, BassLineOptions, type BassLineSettings, BassSegment, BorrowedChord, BorrowedSource, CadenceHit, CadenceResult, Chord, ChordAnalysis, Chord$1 as ChordData, ChordLike, ChordMatch, ChordQuality, ChordScaleMatch, ChordScaleReportEntry, ChordSegment, ChordSpan, ChordSpec, ChordSymbolOptions, ChordTimeline, ChordTimelineOptions, ChordToRomanOptions, ChordToneRole, Complexity, Composer, type ComposerOptions, Conflict, CounterMelodyOptions, type CounterMelodySettings, DetectCadenceOptions, DetectChordOptions, DetectKeyOptions, type DetectedKeyMatch, DrumsOptions, Duration, DurationData, EvaluateSafetyOptions, ExplainRomanOptions, ExtractMotifsOptions, FormSection, FormSectionOptions, GenerationContext, GenerationContextInput, GrooveTemplate, HarmonicFunction, HarmonizeOptions, type HarmonizedMelody, HumanizeOptions, Hypermeter, HypermeterOptions, IdentifiedVoiceNote, Instrument, InstrumentProfile, InstrumentProfileLike, Interval, IntervalData, IntervalLike, IntervalQualityLabel, Key, type KeyData, KeyLike, KeyMatch, KeyMode, KeyRegion, KeyRelation, KeyScale, KeyTimelineOptions, KeyVariant, MelodicContour, Meter, MeterLike, MeterMap, Motif, MotifCell, MotifContour, MotifData, type MotifGenerateOptions, MotifNote, MotifRelation, MotifTransform, Note, Note$1 as NoteData, NoteEvent, NoteEventIndex, NoteEventIndexOptions, NoteLike, NoteNameOptions, NoteValue, OrnamentOptions, ParseResult, PartWritingOptions, PartWritingViolation, Phrase, PhraseOptions, PlayabilityReport, PositionalRng, Progression, type ProgressionData, ProgressionOptions, ReduceProgressionOptions, ReducedChord, ResolvedKey, Rhythm, type RhythmData, type RhythmDeformOptions, RhythmEvent, RhythmOptions, RomanExplanation, SafetyQuery, SafetyResult, ScaleChoice, ScaleName, ScaleNameInput, ScaleSystem, Score, type ScoreData, type ScoreOptions, Species, SpeciesOptions, SpelledDuration, SpelledInterval, SpelledKeyLike, StringFingering, StructuralCadence, StyledVoicingOptions, SubstituteOptions, Substitution, SubstitutionType, Tempo, type TempoData, TempoMap, TensionPoint, TimeSignature, Timeline, type TimelineData, type TimelineRoman, TrackEdit, TransposingInstrument, Tuning, TuningTable, Tuplet, Vocabulary, VoiceIndependenceOptions, VoiceIndependenceReport, VoiceRange, Voicing, type VoicingData, type VoicingIndependenceOptions, VoicingOptions, type VoicingSafetyQuery };
|