@libraz/libcantus 0.9.2 → 0.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -5
- package/dist/analyze/index.cjs +41 -1676
- package/dist/analyze/index.cjs.map +1 -1
- package/dist/analyze/index.d.cts +194 -122
- package/dist/analyze/index.d.ts +194 -122
- package/dist/analyze/index.js +19 -8
- package/dist/chunk-36N73KZ3.cjs +246 -0
- package/dist/chunk-36N73KZ3.cjs.map +1 -0
- package/dist/chunk-4HLLZPXT.cjs +3077 -0
- package/dist/chunk-4HLLZPXT.cjs.map +1 -0
- package/dist/chunk-7MGZ7D62.cjs +498 -0
- package/dist/chunk-7MGZ7D62.cjs.map +1 -0
- package/dist/{chunk-R3S2LUBH.js → chunk-7NKDPF74.js} +660 -305
- package/dist/chunk-7NKDPF74.js.map +1 -0
- package/dist/chunk-CAN76NCU.cjs +679 -0
- package/dist/chunk-CAN76NCU.cjs.map +1 -0
- package/dist/{chunk-7Y7WF64D.js → chunk-D2FAJBYL.js} +104 -35
- package/dist/chunk-D2FAJBYL.js.map +1 -0
- package/dist/{chunk-COKTX2G5.js → chunk-EHVEBWM5.js} +1052 -510
- package/dist/chunk-EHVEBWM5.js.map +1 -0
- package/dist/chunk-FCANXBAT.cjs +30 -0
- package/dist/chunk-FCANXBAT.cjs.map +1 -0
- package/dist/chunk-FNDWXRRI.cjs +479 -0
- package/dist/chunk-FNDWXRRI.cjs.map +1 -0
- package/dist/{chunk-GQKN5KDT.js → chunk-GQSGS2N4.js} +43 -29
- package/dist/chunk-GQSGS2N4.js.map +1 -0
- package/dist/chunk-HKGYCQ34.js +53 -0
- package/dist/chunk-HKGYCQ34.js.map +1 -0
- package/dist/chunk-I24MV65U.js +106 -0
- package/dist/chunk-I24MV65U.js.map +1 -0
- package/dist/{chunk-LN7ZZMD2.js → chunk-KMHOICIY.js} +322 -173
- package/dist/chunk-KMHOICIY.js.map +1 -0
- package/dist/chunk-LW53AHQU.cjs +1117 -0
- package/dist/chunk-LW53AHQU.cjs.map +1 -0
- package/dist/chunk-N6IHQUOX.js +1 -0
- package/dist/chunk-N6IHQUOX.js.map +1 -0
- package/dist/chunk-NKIBQ6PT.js +30 -0
- package/dist/chunk-NKIBQ6PT.js.map +1 -0
- package/dist/chunk-NP4NA2FB.cjs +106 -0
- package/dist/chunk-NP4NA2FB.cjs.map +1 -0
- package/dist/chunk-NVE34YGZ.cjs +1449 -0
- package/dist/chunk-NVE34YGZ.cjs.map +1 -0
- package/dist/{chunk-A4532ZFR.js → chunk-NYYWMV2C.js} +115 -47
- package/dist/chunk-NYYWMV2C.js.map +1 -0
- package/dist/{chunk-5HTNMQW4.js → chunk-Q2XUP227.js} +310 -118
- package/dist/chunk-Q2XUP227.js.map +1 -0
- package/dist/chunk-Q6OP4U43.cjs +327 -0
- package/dist/chunk-Q6OP4U43.cjs.map +1 -0
- package/dist/chunk-RC6GBMCD.cjs +845 -0
- package/dist/chunk-RC6GBMCD.cjs.map +1 -0
- package/dist/{chunk-XTC3X6MS.js → chunk-RK35RIN7.js} +453 -152
- package/dist/chunk-RK35RIN7.js.map +1 -0
- package/dist/chunk-RUMU3UA6.cjs +53 -0
- package/dist/chunk-RUMU3UA6.cjs.map +1 -0
- package/dist/chunk-T64C7ZD7.cjs +1 -0
- package/dist/chunk-T64C7ZD7.cjs.map +1 -0
- package/dist/chunk-XEBG3G53.js +498 -0
- package/dist/chunk-XEBG3G53.js.map +1 -0
- package/dist/chunk-YLEMGEFH.js +246 -0
- package/dist/chunk-YLEMGEFH.js.map +1 -0
- package/dist/chunk-ZEJR4TKL.cjs +173 -0
- package/dist/chunk-ZEJR4TKL.cjs.map +1 -0
- package/dist/core/index.cjs +130 -431
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +331 -17
- package/dist/core/index.d.ts +331 -17
- package/dist/core/index.js +71 -13
- package/dist/{function-2bJW1Zp_.d.ts → function-BtiZb9i9.d.ts} +28 -7
- package/dist/{function-r2sh-jOO.d.cts → function-DNugAOrt.d.cts} +28 -7
- package/dist/generate/index.cjs +30 -3751
- package/dist/generate/index.cjs.map +1 -1
- package/dist/generate/index.d.cts +373 -59
- package/dist/generate/index.d.ts +373 -59
- package/dist/generate/index.js +23 -9
- package/dist/{index-DZ1M21do.d.cts → index-6VR8-kit.d.ts} +20 -4
- package/dist/index-70p168VM.d.ts +192 -0
- package/dist/{index-D_ZTUNKp.d.cts → index-Be74mcon.d.cts} +18 -17
- package/dist/index-BtXT6UQ0.d.cts +192 -0
- package/dist/{index-BMPxwjwV.d.ts → index-C5UBbQ4G.d.ts} +18 -17
- package/dist/{index-BOBXBNwP.d.cts → index-C83mZI1P.d.ts} +93 -8
- package/dist/{index-BdeQ1r_p.d.cts → index-D6b6na69.d.cts} +14 -11
- package/dist/{index-Cl7mhOFM.d.cts → index-DXd9JikN.d.cts} +92 -10
- package/dist/{index-Cl7mhOFM.d.ts → index-DXd9JikN.d.ts} +92 -10
- package/dist/index-OG65ocOr.d.cts +272 -0
- package/dist/index-OG65ocOr.d.ts +272 -0
- package/dist/{index-BreoJRw0.d.ts → index-tJhkmQgE.d.cts} +20 -4
- package/dist/{index-CP3wAfEH.d.ts → index-tSQh-xwY.d.ts} +14 -11
- package/dist/{index-CM5W4rcm.d.ts → index-y_ak9_Hi.d.cts} +93 -8
- package/dist/index.cjs +419 -6848
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -13
- package/dist/index.d.ts +14 -13
- package/dist/index.js +132 -27
- package/dist/model/index.cjs +8 -2423
- package/dist/model/index.cjs.map +1 -1
- package/dist/model/index.d.cts +433 -74
- package/dist/model/index.d.ts +433 -74
- package/dist/model/index.js +6 -7
- package/dist/styled-DIRkk9Uz.d.ts +506 -0
- package/dist/styled-DJbkJQfj.d.cts +506 -0
- package/dist/theory/index.cjs +172 -1676
- package/dist/theory/index.cjs.map +1 -1
- package/dist/theory/index.d.cts +151 -233
- package/dist/theory/index.d.ts +151 -233
- package/dist/theory/index.js +31 -7
- package/dist/{types-MGP29r3t.d.cts → types-BN6_Q9Kl.d.cts} +11 -2
- package/dist/{types-MGP29r3t.d.ts → types-BN6_Q9Kl.d.ts} +11 -2
- package/package.json +73 -24
- package/dist/chunk-5HTNMQW4.js.map +0 -1
- package/dist/chunk-7Y7WF64D.js.map +0 -1
- package/dist/chunk-A4532ZFR.js.map +0 -1
- package/dist/chunk-BHUT2S5G.js +0 -22
- package/dist/chunk-BHUT2S5G.js.map +0 -1
- package/dist/chunk-CCBLVAPK.js +0 -42
- package/dist/chunk-CCBLVAPK.js.map +0 -1
- package/dist/chunk-COKTX2G5.js.map +0 -1
- package/dist/chunk-DYWFNC4A.js +0 -152
- package/dist/chunk-DYWFNC4A.js.map +0 -1
- package/dist/chunk-GQKN5KDT.js.map +0 -1
- package/dist/chunk-LN7ZZMD2.js.map +0 -1
- package/dist/chunk-MSWFZF7J.js +0 -118
- package/dist/chunk-MSWFZF7J.js.map +0 -1
- package/dist/chunk-R3S2LUBH.js.map +0 -1
- package/dist/chunk-SDM3VJJ5.js +0 -41
- package/dist/chunk-SDM3VJJ5.js.map +0 -1
- package/dist/chunk-XTC3X6MS.js.map +0 -1
- package/dist/chunk-ZXW5YIWK.js +0 -55
- package/dist/chunk-ZXW5YIWK.js.map +0 -1
- package/dist/index-CGMZNCx6.d.cts +0 -140
- package/dist/index-CGMZNCx6.d.ts +0 -140
- package/dist/styled-BjXtOFNk.d.cts +0 -282
- package/dist/styled-D7BAx3S3.d.ts +0 -282
- package/src/analyze/arrange/index.ts +0 -21
- package/src/analyze/arrange/internal.ts +0 -125
- package/src/analyze/arrange/tension.ts +0 -187
- package/src/analyze/arrange/tracks.ts +0 -279
- package/src/analyze/detect/index.ts +0 -235
- package/src/analyze/functional/borrowed.ts +0 -84
- package/src/analyze/functional/cadence.ts +0 -66
- package/src/analyze/functional/function.ts +0 -184
- package/src/analyze/functional/index.ts +0 -23
- package/src/analyze/functional/internal.ts +0 -29
- package/src/analyze/functional/roman.ts +0 -393
- package/src/analyze/index.ts +0 -49
- package/src/analyze/timeline/index.ts +0 -415
- package/src/analyze/voice/index.ts +0 -330
- package/src/core/index.ts +0 -47
- package/src/core/interval/index.ts +0 -81
- package/src/core/meter/index.ts +0 -282
- package/src/core/pitch/index.ts +0 -311
- package/src/core/random/index.ts +0 -53
- package/src/core/tuning/index.ts +0 -156
- package/src/core/types.ts +0 -29
- package/src/generate/bass/index.ts +0 -350
- package/src/generate/countermelody/index.ts +0 -379
- package/src/generate/drums/beat.ts +0 -266
- package/src/generate/drums/euclid.ts +0 -58
- package/src/generate/drums/fills.ts +0 -356
- package/src/generate/drums/ghost.ts +0 -119
- package/src/generate/drums/hihat.ts +0 -285
- package/src/generate/drums/hit.ts +0 -31
- package/src/generate/drums/index.ts +0 -329
- package/src/generate/drums/internal.ts +0 -257
- package/src/generate/drums/kick.ts +0 -160
- package/src/generate/drums/percussion.ts +0 -121
- package/src/generate/drums/rng.ts +0 -7
- package/src/generate/drums/swing.ts +0 -71
- package/src/generate/groove/index.ts +0 -326
- package/src/generate/harmonize/index.ts +0 -440
- package/src/generate/index.ts +0 -59
- package/src/generate/motif/index.ts +0 -398
- package/src/generate/progression/index.ts +0 -370
- package/src/generate/reharmony/index.ts +0 -330
- package/src/generate/rhythm/index.ts +0 -165
- package/src/index.ts +0 -247
- package/src/model/chord.ts +0 -423
- package/src/model/index.ts +0 -15
- package/src/model/interval.ts +0 -82
- package/src/model/key.ts +0 -266
- package/src/model/note.ts +0 -176
- package/src/model/progression.ts +0 -161
- package/src/model/shared.ts +0 -12
- package/src/theory/chord/index.ts +0 -373
- package/src/theory/chordscale/index.ts +0 -374
- package/src/theory/counterpoint/index.ts +0 -230
- package/src/theory/harmony/index.ts +0 -92
- package/src/theory/index.ts +0 -107
- package/src/theory/safety/index.ts +0 -419
- package/src/theory/scale/degrees.ts +0 -123
- package/src/theory/scale/index.ts +0 -28
- package/src/theory/scale/key.ts +0 -56
- package/src/theory/scale/masks.ts +0 -153
- package/src/theory/spelling/index.ts +0 -182
- package/src/theory/symbol/index.ts +0 -268
- package/src/theory/voicing/index.ts +0 -5
- package/src/theory/voicing/internal.ts +0 -168
- package/src/theory/voicing/leading.ts +0 -112
- package/src/theory/voicing/satb.ts +0 -195
- package/src/theory/voicing/styled.ts +0 -176
- package/tsconfig.json +0 -23
package/dist/generate/index.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
|
+
BASS_STYLES,
|
|
3
|
+
BORROWED_DEGREES,
|
|
4
|
+
DRUM_NOTES,
|
|
2
5
|
applyGrooveTemplate,
|
|
3
6
|
developMotif,
|
|
7
|
+
drumVoiceOf,
|
|
4
8
|
extractGrooveTemplate,
|
|
5
9
|
generateBassLine,
|
|
6
10
|
generateCounterMelody,
|
|
@@ -10,27 +14,34 @@ import {
|
|
|
10
14
|
generateRhythm,
|
|
11
15
|
harmonizeMelody,
|
|
12
16
|
humanize,
|
|
17
|
+
motifToNoteEvents,
|
|
13
18
|
onsetWeightCurve,
|
|
19
|
+
pickProgressionPreset,
|
|
14
20
|
progressions,
|
|
15
21
|
progressionsByStyle,
|
|
16
22
|
rhythmDensity,
|
|
23
|
+
rhythmToNoteEvents,
|
|
17
24
|
transformMotif
|
|
18
|
-
} from "../chunk-
|
|
19
|
-
import "../chunk-
|
|
20
|
-
import "../chunk-
|
|
25
|
+
} from "../chunk-7NKDPF74.js";
|
|
26
|
+
import "../chunk-HKGYCQ34.js";
|
|
27
|
+
import "../chunk-YLEMGEFH.js";
|
|
21
28
|
import {
|
|
22
29
|
modalInterchangePalette,
|
|
23
30
|
negativeHarmonyMirror,
|
|
24
31
|
substituteChord
|
|
25
|
-
} from "../chunk-
|
|
26
|
-
import "../chunk-
|
|
27
|
-
import "../chunk-
|
|
28
|
-
import "../chunk-
|
|
29
|
-
import "../chunk-
|
|
30
|
-
import "../chunk-
|
|
32
|
+
} from "../chunk-GQSGS2N4.js";
|
|
33
|
+
import "../chunk-KMHOICIY.js";
|
|
34
|
+
import "../chunk-NKIBQ6PT.js";
|
|
35
|
+
import "../chunk-NYYWMV2C.js";
|
|
36
|
+
import "../chunk-D2FAJBYL.js";
|
|
37
|
+
import "../chunk-XEBG3G53.js";
|
|
31
38
|
export {
|
|
39
|
+
BASS_STYLES,
|
|
40
|
+
BORROWED_DEGREES,
|
|
41
|
+
DRUM_NOTES,
|
|
32
42
|
applyGrooveTemplate,
|
|
33
43
|
developMotif,
|
|
44
|
+
drumVoiceOf,
|
|
34
45
|
extractGrooveTemplate,
|
|
35
46
|
generateBassLine,
|
|
36
47
|
generateCounterMelody,
|
|
@@ -41,11 +52,14 @@ export {
|
|
|
41
52
|
harmonizeMelody,
|
|
42
53
|
humanize,
|
|
43
54
|
modalInterchangePalette,
|
|
55
|
+
motifToNoteEvents,
|
|
44
56
|
negativeHarmonyMirror,
|
|
45
57
|
onsetWeightCurve,
|
|
58
|
+
pickProgressionPreset,
|
|
46
59
|
progressions,
|
|
47
60
|
progressionsByStyle,
|
|
48
61
|
rhythmDensity,
|
|
62
|
+
rhythmToNoteEvents,
|
|
49
63
|
substituteChord,
|
|
50
64
|
transformMotif
|
|
51
65
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { K as KeyScale } from './types-
|
|
2
|
-
import { C as Chord } from './index-
|
|
1
|
+
import { K as KeyScale } from './types-BN6_Q9Kl.js';
|
|
2
|
+
import { C as Chord } from './index-C83mZI1P.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Severity policy: `strict` counterpoint vs. lenient `pop` voice-leading.
|
|
@@ -102,7 +102,22 @@ type SafetyResult = {
|
|
|
102
102
|
* ```
|
|
103
103
|
* @category Arrangement & Analysis
|
|
104
104
|
*/
|
|
105
|
-
declare function evaluateSafety(q: SafetyQuery): SafetyResult;
|
|
105
|
+
declare function evaluateSafety(q: SafetyQuery, opts?: EvaluateSafetyOptions): SafetyResult;
|
|
106
|
+
/**
|
|
107
|
+
* Options for {@link evaluateSafety}.
|
|
108
|
+
*
|
|
109
|
+
* @category Arrangement & Analysis
|
|
110
|
+
*/
|
|
111
|
+
type EvaluateSafetyOptions = {
|
|
112
|
+
/**
|
|
113
|
+
* Whether to search for safe replacement pitches when the verdict is not
|
|
114
|
+
* safe. Turning it off skips up to two dozen extra evaluations per rejected
|
|
115
|
+
* pitch, which is worth doing when only the verdict is wanted.
|
|
116
|
+
*
|
|
117
|
+
* @defaultValue true
|
|
118
|
+
*/
|
|
119
|
+
suggestions?: boolean;
|
|
120
|
+
};
|
|
106
121
|
/**
|
|
107
122
|
* Enumerate placeable pitches in a range, chord tones first, descending.
|
|
108
123
|
*
|
|
@@ -110,6 +125,7 @@ declare function evaluateSafety(q: SafetyQuery): SafetyResult;
|
|
|
110
125
|
* @param pitchLow Lowest MIDI pitch to consider (inclusive).
|
|
111
126
|
* @param pitchHigh Highest MIDI pitch to consider (inclusive).
|
|
112
127
|
* @returns Placeable pitches (non-dissonant), chord tones before others, each group descending.
|
|
128
|
+
* @throws If either bound is non-finite/non-integral, reversed, or exceeds the generation budget.
|
|
113
129
|
* @example
|
|
114
130
|
* ```ts
|
|
115
131
|
* import { enumerateSafePitches, makeChord, majorKey } from '@libraz/libcantus';
|
|
@@ -124,4 +140,4 @@ declare function evaluateSafety(q: SafetyQuery): SafetyResult;
|
|
|
124
140
|
*/
|
|
125
141
|
declare function enumerateSafePitches(q: Omit<SafetyQuery, 'candidatePitch'>, pitchLow: number, pitchHigh: number): number[];
|
|
126
142
|
|
|
127
|
-
export { NoteSafety as N, ReasonFlag as R, type SafetyProfile as S, type VoiceSnapshot as V, type SafetyQuery as a, type SafetyResult as b, evaluateSafety as c, enumerateSafePitches as e };
|
|
143
|
+
export { type EvaluateSafetyOptions as E, NoteSafety as N, ReasonFlag as R, type SafetyProfile as S, type VoiceSnapshot as V, type SafetyQuery as a, type SafetyResult as b, evaluateSafety as c, enumerateSafePitches as e };
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { K as KeyScale, N as NoteEvent } from './types-BN6_Q9Kl.js';
|
|
2
|
+
import { a as ChordQuality, C as Chord } from './index-C83mZI1P.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Recognition: infer a chord name from a set of pitches, or a key from a set of
|
|
6
|
+
* pitch classes. This is the inverse direction of the chord/scale builders,
|
|
7
|
+
* which only go name -> notes.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A candidate chord interpretation of a pitch set.
|
|
12
|
+
*
|
|
13
|
+
* @category Recognition
|
|
14
|
+
*/
|
|
15
|
+
type ChordMatch = {
|
|
16
|
+
rootPc: number;
|
|
17
|
+
quality: ChordQuality;
|
|
18
|
+
/** Chord tones absent from the input (an incomplete voicing). */
|
|
19
|
+
missingPcs: number[];
|
|
20
|
+
/** Input pitch classes not belonging to the chord. */
|
|
21
|
+
extraPcs: number[];
|
|
22
|
+
/** True when the input pitch-class set equals the chord exactly. */
|
|
23
|
+
exact: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Inversion implied by a known bass: 0 for root position, 1..n for an
|
|
26
|
+
* inversion. Null when no inversion can be named — either the input is an
|
|
27
|
+
* unordered pitch-class set with no bass, or the bass is not a chord tone (a
|
|
28
|
+
* pedal or passing bass), in which case `bassPc` still reports it.
|
|
29
|
+
*/
|
|
30
|
+
inversion: number | null;
|
|
31
|
+
/** Bass pitch class when the lowest note is not the root. */
|
|
32
|
+
bassPc?: number;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Input interpretation for {@link detectChord} and {@link detectChordBest}.
|
|
36
|
+
*
|
|
37
|
+
* @category Recognition
|
|
38
|
+
*/
|
|
39
|
+
type DetectChordOptions = {
|
|
40
|
+
/**
|
|
41
|
+
* `midi` uses the numerically lowest pitch as bass; `pitchClass` treats the
|
|
42
|
+
* input as unordered. `auto` (default) selects pitch-class mode only when all
|
|
43
|
+
* values lie in 0..11.
|
|
44
|
+
*/
|
|
45
|
+
input?: 'auto' | 'midi' | 'pitchClass';
|
|
46
|
+
/** Explicit bass pitch class, including for an unordered pitch-class set. */
|
|
47
|
+
bassPc?: number;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* A candidate key interpretation of a pitch-class set.
|
|
51
|
+
*
|
|
52
|
+
* @category Recognition
|
|
53
|
+
*/
|
|
54
|
+
type KeyMatch = {
|
|
55
|
+
/** The scale that scored best for this tonic and mode, `variant` included. */
|
|
56
|
+
key: KeyScale;
|
|
57
|
+
mode: 'major' | 'minor';
|
|
58
|
+
/** Which scale form `key` uses; minor keys pick the best-scoring of the three. */
|
|
59
|
+
variant: KeyVariant;
|
|
60
|
+
/**
|
|
61
|
+
* Fraction of the distinct input pitch classes that belong to `key`, in
|
|
62
|
+
* [0, 1]. Measured against the returned scale, so it always agrees with
|
|
63
|
+
* `isScaleTone(pc, match.key)`. This is a coverage figure, not the ranking:
|
|
64
|
+
* see `score`.
|
|
65
|
+
*/
|
|
66
|
+
fit: number;
|
|
67
|
+
/**
|
|
68
|
+
* The value the results are ranked by, in [0, 1.5]. Unlike `fit` it counts
|
|
69
|
+
* every occurrence rather than every distinct pitch class, so a repeated tone
|
|
70
|
+
* weighs more, and it adds half a count per sounding of the tonic itself to
|
|
71
|
+
* break ties between keys that contain the same notes.
|
|
72
|
+
*/
|
|
73
|
+
score: number;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Which form of a scale a {@link KeyMatch} settled on.
|
|
77
|
+
*
|
|
78
|
+
* @category Recognition
|
|
79
|
+
*/
|
|
80
|
+
type KeyVariant = 'major' | 'natural' | 'harmonic' | 'melodic';
|
|
81
|
+
/**
|
|
82
|
+
* Input weighting for {@link detectKey}.
|
|
83
|
+
*
|
|
84
|
+
* @category Recognition
|
|
85
|
+
*/
|
|
86
|
+
type DetectKeyOptions = {
|
|
87
|
+
/**
|
|
88
|
+
* How much each pitch counts toward the histogram, one entry per pitch.
|
|
89
|
+
* Defaults to one per pitch, which weighs a thirty-second-note ornament as
|
|
90
|
+
* heavily as the whole note under it. {@link detectKeyFromNotes} supplies
|
|
91
|
+
* duration times velocity, matching how chord inference weighs its own
|
|
92
|
+
* histogram.
|
|
93
|
+
*/
|
|
94
|
+
weights?: readonly number[];
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Identify chords matching a set of pitches.
|
|
98
|
+
*
|
|
99
|
+
* Every input pitch class is tried as a root against every known chord quality.
|
|
100
|
+
* A match is reported when all of the chord's tones are present in the input, or
|
|
101
|
+
* when the only absent tone is the perfect fifth (a common omission in shell
|
|
102
|
+
* voicings); matches are ranked best-first by fewest extra notes, then fewest
|
|
103
|
+
* missing notes, then most specific (largest) chord. An exact match (no extras,
|
|
104
|
+
* no missing) is flagged and ranked first.
|
|
105
|
+
*
|
|
106
|
+
* @param pitches MIDI pitches or bare pitch classes (octave-agnostic).
|
|
107
|
+
* @returns Ranked chord interpretations (may be empty).
|
|
108
|
+
* @example
|
|
109
|
+
* ```ts
|
|
110
|
+
* import { detectChord } from '@libraz/libcantus';
|
|
111
|
+
* const matches = detectChord([60, 64, 67]); // C E G
|
|
112
|
+
* matches[0]; // { rootPc: 0, quality: 'maj', exact: true, ... }
|
|
113
|
+
* ```
|
|
114
|
+
* @category Recognition
|
|
115
|
+
*/
|
|
116
|
+
declare function detectChord(pitches: readonly number[], opts?: DetectChordOptions): ChordMatch[];
|
|
117
|
+
/**
|
|
118
|
+
* The single best chord interpretation of a pitch set, or null if none.
|
|
119
|
+
*
|
|
120
|
+
* @param pitches MIDI pitches or bare pitch classes.
|
|
121
|
+
* @returns The top-ranked chord, or null when nothing matches.
|
|
122
|
+
* @example
|
|
123
|
+
* ```ts
|
|
124
|
+
* import { detectChordBest } from '@libraz/libcantus';
|
|
125
|
+
* detectChordBest([60, 64, 67]); // C major triad: { rootPc: 0, quality: 'maj', ... }
|
|
126
|
+
* ```
|
|
127
|
+
* @category Recognition
|
|
128
|
+
*/
|
|
129
|
+
declare function detectChordBest(pitches: readonly number[], opts?: DetectChordOptions): Chord | null;
|
|
130
|
+
/**
|
|
131
|
+
* Rank major and minor keys by how well they contain a set of pitch classes.
|
|
132
|
+
*
|
|
133
|
+
* Ranking is by `score`, which counts repetitions and adds a tonic weight so
|
|
134
|
+
* that, among equally-fitting keys, the one whose root is actually sounded is
|
|
135
|
+
* preferred. Minor candidates are scored against the natural, harmonic, and
|
|
136
|
+
* melodic minor variants and keep the best of the three, so a minor cadence
|
|
137
|
+
* containing the leading tone still resolves to its own tonic; the winning
|
|
138
|
+
* variant is what `key` and `variant` report, so `fit` describes the scale the
|
|
139
|
+
* caller receives. Returns all 24 keys ranked best-first, or an empty array for
|
|
140
|
+
* an empty input (mirroring {@link detectChord}).
|
|
141
|
+
*
|
|
142
|
+
* @param pitches MIDI pitches or bare pitch classes.
|
|
143
|
+
* @returns Ranked key interpretations (empty for an empty input).
|
|
144
|
+
* @example
|
|
145
|
+
* ```ts
|
|
146
|
+
* import { detectKey } from '@libraz/libcantus';
|
|
147
|
+
* const keys = detectKey([60, 62, 64, 65, 67, 69, 71]); // C major scale
|
|
148
|
+
* keys[0].mode; // 'major', with keys[0].key.rootPc === 0
|
|
149
|
+
* ```
|
|
150
|
+
* @category Recognition
|
|
151
|
+
*/
|
|
152
|
+
declare function detectKey(pitches: readonly number[], opts?: DetectKeyOptions): KeyMatch[];
|
|
153
|
+
/**
|
|
154
|
+
* Rank keys by how well they contain a set of note events, weighting each note
|
|
155
|
+
* by how much of the music it actually occupies.
|
|
156
|
+
*
|
|
157
|
+
* {@link detectKey} counts every pitch once, which lets a run of fast ornamental
|
|
158
|
+
* notes outvote the sustained harmony that establishes the key. This weighs
|
|
159
|
+
* each note by duration times velocity, the same measure chord inference uses,
|
|
160
|
+
* so the two agree on what the music emphasises. Notes that never sound (zero
|
|
161
|
+
* or negative duration) are ignored.
|
|
162
|
+
*
|
|
163
|
+
* @param notes The note events to weigh.
|
|
164
|
+
* @returns Ranked key interpretations (empty when nothing sounds).
|
|
165
|
+
* @example
|
|
166
|
+
* ```ts
|
|
167
|
+
* import { detectKeyFromNotes } from '@libraz/libcantus';
|
|
168
|
+
* detectKeyFromNotes([{ pitch: 60, startBeat: 0, durationBeat: 4 }])[0]?.key.rootPc; // 0
|
|
169
|
+
* ```
|
|
170
|
+
* @category Recognition
|
|
171
|
+
*/
|
|
172
|
+
declare function detectKeyFromNotes(notes: readonly NoteEvent[]): KeyMatch[];
|
|
173
|
+
/**
|
|
174
|
+
* The single best key interpretation of a pitch set.
|
|
175
|
+
*
|
|
176
|
+
* The counterpart of {@link detectChordBest}: the ranked list is the general
|
|
177
|
+
* answer, but a caller that just wants "what key is this" should not have to
|
|
178
|
+
* index into it and assert the result is there.
|
|
179
|
+
*
|
|
180
|
+
* @param pitches MIDI pitches or bare pitch classes.
|
|
181
|
+
* @param opts How to weigh the input; see {@link DetectKeyOptions}.
|
|
182
|
+
* @returns The top-ranked key, or null when nothing sounds.
|
|
183
|
+
* @example
|
|
184
|
+
* ```ts
|
|
185
|
+
* import { detectKeyBest } from '@libraz/libcantus';
|
|
186
|
+
* detectKeyBest([0, 2, 4, 5, 7, 9, 11])?.mode; // 'major'
|
|
187
|
+
* ```
|
|
188
|
+
* @category Recognition
|
|
189
|
+
*/
|
|
190
|
+
declare function detectKeyBest(pitches: readonly number[], opts?: DetectKeyOptions): KeyMatch | null;
|
|
191
|
+
|
|
192
|
+
export { type ChordMatch as C, type DetectChordOptions as D, type KeyMatch as K, type DetectKeyOptions as a, type KeyVariant as b, detectChordBest as c, detectChord as d, detectKey as e, detectKeyBest as f, detectKeyFromNotes as g };
|
|
@@ -1,18 +1,8 @@
|
|
|
1
|
-
import { T as TimeSignature } from './index-
|
|
2
|
-
import { K as KeyScale, N as NoteEvent } from './types-
|
|
3
|
-
import { C as Chord, b as ChordSpan } from './index-
|
|
4
|
-
import { C as Cadence } from './function-
|
|
1
|
+
import { T as TimeSignature } from './index-DXd9JikN.cjs';
|
|
2
|
+
import { K as KeyScale, N as NoteEvent } from './types-BN6_Q9Kl.cjs';
|
|
3
|
+
import { C as Chord, b as ChordSegment, c as ChordSpan } from './index-y_ak9_Hi.cjs';
|
|
4
|
+
import { C as Cadence } from './function-DNugAOrt.cjs';
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
* A chord occupying a half-open beat span.
|
|
8
|
-
*
|
|
9
|
-
* @category Arrangement & Analysis
|
|
10
|
-
*/
|
|
11
|
-
type ChordSegment = {
|
|
12
|
-
startBeat: number;
|
|
13
|
-
endBeat: number;
|
|
14
|
-
chord: Chord;
|
|
15
|
-
};
|
|
16
6
|
/**
|
|
17
7
|
* A beat-indexed sequence of chord segments.
|
|
18
8
|
*
|
|
@@ -36,14 +26,14 @@ type ChordTimeline = {
|
|
|
36
26
|
* @returns A queryable chord timeline.
|
|
37
27
|
* @category Arrangement & Analysis
|
|
38
28
|
*/
|
|
39
|
-
declare function chordTimelineFromChords(chords: ChordSpan[], totalBeats: number): ChordTimeline;
|
|
29
|
+
declare function chordTimelineFromChords(chords: readonly ChordSpan[], totalBeats: number): ChordTimeline;
|
|
40
30
|
/**
|
|
41
31
|
* Options controlling {@link chordTimelineFromNotes}.
|
|
42
32
|
*
|
|
43
33
|
* @category Arrangement & Analysis
|
|
44
34
|
*/
|
|
45
35
|
type ChordTimelineOptions = {
|
|
46
|
-
/** Key context; inferred from the notes with {@link
|
|
36
|
+
/** Key context; inferred from the notes with {@link detectKeyFromNotes} when omitted. */
|
|
47
37
|
key?: KeyScale;
|
|
48
38
|
/**
|
|
49
39
|
* Time signature used for metric accents; defaults to 4/4.
|
|
@@ -63,6 +53,17 @@ type ChordTimelineOptions = {
|
|
|
63
53
|
* @defaultValue the end of the last note
|
|
64
54
|
*/
|
|
65
55
|
totalBeats?: number;
|
|
56
|
+
/**
|
|
57
|
+
* Upper bound on the work this call may do — note counts, windows, and
|
|
58
|
+
* candidate counts are each checked against it before anything is allocated.
|
|
59
|
+
*
|
|
60
|
+
* Raise it to analyse a piece larger than the default allows; the default is
|
|
61
|
+
* {@link DEFAULT_GENERATION_BUDGET}, chosen so a runaway input fails fast
|
|
62
|
+
* rather than blocking the thread.
|
|
63
|
+
*
|
|
64
|
+
* @defaultValue {@link DEFAULT_GENERATION_BUDGET}
|
|
65
|
+
*/
|
|
66
|
+
budget?: number;
|
|
66
67
|
};
|
|
67
68
|
/**
|
|
68
69
|
* The result of {@link chordTimelineFromNotes}.
|
|
@@ -148,4 +149,4 @@ type CadenceHit = {
|
|
|
148
149
|
*/
|
|
149
150
|
declare function detectCadences(timeline: ChordTimeline, key: KeyScale): CadenceHit[];
|
|
150
151
|
|
|
151
|
-
export { type CadenceHit as C, type
|
|
152
|
+
export { type CadenceHit as C, type ChordTimeline as a, type ChordTimelineOptions as b, type ChordTimelineResult as c, chordTimelineFromChords as d, chordTimelineFromNotes as e, detectCadences as f };
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { K as KeyScale, N as NoteEvent } from './types-BN6_Q9Kl.cjs';
|
|
2
|
+
import { a as ChordQuality, C as Chord } from './index-y_ak9_Hi.cjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Recognition: infer a chord name from a set of pitches, or a key from a set of
|
|
6
|
+
* pitch classes. This is the inverse direction of the chord/scale builders,
|
|
7
|
+
* which only go name -> notes.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A candidate chord interpretation of a pitch set.
|
|
12
|
+
*
|
|
13
|
+
* @category Recognition
|
|
14
|
+
*/
|
|
15
|
+
type ChordMatch = {
|
|
16
|
+
rootPc: number;
|
|
17
|
+
quality: ChordQuality;
|
|
18
|
+
/** Chord tones absent from the input (an incomplete voicing). */
|
|
19
|
+
missingPcs: number[];
|
|
20
|
+
/** Input pitch classes not belonging to the chord. */
|
|
21
|
+
extraPcs: number[];
|
|
22
|
+
/** True when the input pitch-class set equals the chord exactly. */
|
|
23
|
+
exact: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Inversion implied by a known bass: 0 for root position, 1..n for an
|
|
26
|
+
* inversion. Null when no inversion can be named — either the input is an
|
|
27
|
+
* unordered pitch-class set with no bass, or the bass is not a chord tone (a
|
|
28
|
+
* pedal or passing bass), in which case `bassPc` still reports it.
|
|
29
|
+
*/
|
|
30
|
+
inversion: number | null;
|
|
31
|
+
/** Bass pitch class when the lowest note is not the root. */
|
|
32
|
+
bassPc?: number;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Input interpretation for {@link detectChord} and {@link detectChordBest}.
|
|
36
|
+
*
|
|
37
|
+
* @category Recognition
|
|
38
|
+
*/
|
|
39
|
+
type DetectChordOptions = {
|
|
40
|
+
/**
|
|
41
|
+
* `midi` uses the numerically lowest pitch as bass; `pitchClass` treats the
|
|
42
|
+
* input as unordered. `auto` (default) selects pitch-class mode only when all
|
|
43
|
+
* values lie in 0..11.
|
|
44
|
+
*/
|
|
45
|
+
input?: 'auto' | 'midi' | 'pitchClass';
|
|
46
|
+
/** Explicit bass pitch class, including for an unordered pitch-class set. */
|
|
47
|
+
bassPc?: number;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* A candidate key interpretation of a pitch-class set.
|
|
51
|
+
*
|
|
52
|
+
* @category Recognition
|
|
53
|
+
*/
|
|
54
|
+
type KeyMatch = {
|
|
55
|
+
/** The scale that scored best for this tonic and mode, `variant` included. */
|
|
56
|
+
key: KeyScale;
|
|
57
|
+
mode: 'major' | 'minor';
|
|
58
|
+
/** Which scale form `key` uses; minor keys pick the best-scoring of the three. */
|
|
59
|
+
variant: KeyVariant;
|
|
60
|
+
/**
|
|
61
|
+
* Fraction of the distinct input pitch classes that belong to `key`, in
|
|
62
|
+
* [0, 1]. Measured against the returned scale, so it always agrees with
|
|
63
|
+
* `isScaleTone(pc, match.key)`. This is a coverage figure, not the ranking:
|
|
64
|
+
* see `score`.
|
|
65
|
+
*/
|
|
66
|
+
fit: number;
|
|
67
|
+
/**
|
|
68
|
+
* The value the results are ranked by, in [0, 1.5]. Unlike `fit` it counts
|
|
69
|
+
* every occurrence rather than every distinct pitch class, so a repeated tone
|
|
70
|
+
* weighs more, and it adds half a count per sounding of the tonic itself to
|
|
71
|
+
* break ties between keys that contain the same notes.
|
|
72
|
+
*/
|
|
73
|
+
score: number;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Which form of a scale a {@link KeyMatch} settled on.
|
|
77
|
+
*
|
|
78
|
+
* @category Recognition
|
|
79
|
+
*/
|
|
80
|
+
type KeyVariant = 'major' | 'natural' | 'harmonic' | 'melodic';
|
|
81
|
+
/**
|
|
82
|
+
* Input weighting for {@link detectKey}.
|
|
83
|
+
*
|
|
84
|
+
* @category Recognition
|
|
85
|
+
*/
|
|
86
|
+
type DetectKeyOptions = {
|
|
87
|
+
/**
|
|
88
|
+
* How much each pitch counts toward the histogram, one entry per pitch.
|
|
89
|
+
* Defaults to one per pitch, which weighs a thirty-second-note ornament as
|
|
90
|
+
* heavily as the whole note under it. {@link detectKeyFromNotes} supplies
|
|
91
|
+
* duration times velocity, matching how chord inference weighs its own
|
|
92
|
+
* histogram.
|
|
93
|
+
*/
|
|
94
|
+
weights?: readonly number[];
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Identify chords matching a set of pitches.
|
|
98
|
+
*
|
|
99
|
+
* Every input pitch class is tried as a root against every known chord quality.
|
|
100
|
+
* A match is reported when all of the chord's tones are present in the input, or
|
|
101
|
+
* when the only absent tone is the perfect fifth (a common omission in shell
|
|
102
|
+
* voicings); matches are ranked best-first by fewest extra notes, then fewest
|
|
103
|
+
* missing notes, then most specific (largest) chord. An exact match (no extras,
|
|
104
|
+
* no missing) is flagged and ranked first.
|
|
105
|
+
*
|
|
106
|
+
* @param pitches MIDI pitches or bare pitch classes (octave-agnostic).
|
|
107
|
+
* @returns Ranked chord interpretations (may be empty).
|
|
108
|
+
* @example
|
|
109
|
+
* ```ts
|
|
110
|
+
* import { detectChord } from '@libraz/libcantus';
|
|
111
|
+
* const matches = detectChord([60, 64, 67]); // C E G
|
|
112
|
+
* matches[0]; // { rootPc: 0, quality: 'maj', exact: true, ... }
|
|
113
|
+
* ```
|
|
114
|
+
* @category Recognition
|
|
115
|
+
*/
|
|
116
|
+
declare function detectChord(pitches: readonly number[], opts?: DetectChordOptions): ChordMatch[];
|
|
117
|
+
/**
|
|
118
|
+
* The single best chord interpretation of a pitch set, or null if none.
|
|
119
|
+
*
|
|
120
|
+
* @param pitches MIDI pitches or bare pitch classes.
|
|
121
|
+
* @returns The top-ranked chord, or null when nothing matches.
|
|
122
|
+
* @example
|
|
123
|
+
* ```ts
|
|
124
|
+
* import { detectChordBest } from '@libraz/libcantus';
|
|
125
|
+
* detectChordBest([60, 64, 67]); // C major triad: { rootPc: 0, quality: 'maj', ... }
|
|
126
|
+
* ```
|
|
127
|
+
* @category Recognition
|
|
128
|
+
*/
|
|
129
|
+
declare function detectChordBest(pitches: readonly number[], opts?: DetectChordOptions): Chord | null;
|
|
130
|
+
/**
|
|
131
|
+
* Rank major and minor keys by how well they contain a set of pitch classes.
|
|
132
|
+
*
|
|
133
|
+
* Ranking is by `score`, which counts repetitions and adds a tonic weight so
|
|
134
|
+
* that, among equally-fitting keys, the one whose root is actually sounded is
|
|
135
|
+
* preferred. Minor candidates are scored against the natural, harmonic, and
|
|
136
|
+
* melodic minor variants and keep the best of the three, so a minor cadence
|
|
137
|
+
* containing the leading tone still resolves to its own tonic; the winning
|
|
138
|
+
* variant is what `key` and `variant` report, so `fit` describes the scale the
|
|
139
|
+
* caller receives. Returns all 24 keys ranked best-first, or an empty array for
|
|
140
|
+
* an empty input (mirroring {@link detectChord}).
|
|
141
|
+
*
|
|
142
|
+
* @param pitches MIDI pitches or bare pitch classes.
|
|
143
|
+
* @returns Ranked key interpretations (empty for an empty input).
|
|
144
|
+
* @example
|
|
145
|
+
* ```ts
|
|
146
|
+
* import { detectKey } from '@libraz/libcantus';
|
|
147
|
+
* const keys = detectKey([60, 62, 64, 65, 67, 69, 71]); // C major scale
|
|
148
|
+
* keys[0].mode; // 'major', with keys[0].key.rootPc === 0
|
|
149
|
+
* ```
|
|
150
|
+
* @category Recognition
|
|
151
|
+
*/
|
|
152
|
+
declare function detectKey(pitches: readonly number[], opts?: DetectKeyOptions): KeyMatch[];
|
|
153
|
+
/**
|
|
154
|
+
* Rank keys by how well they contain a set of note events, weighting each note
|
|
155
|
+
* by how much of the music it actually occupies.
|
|
156
|
+
*
|
|
157
|
+
* {@link detectKey} counts every pitch once, which lets a run of fast ornamental
|
|
158
|
+
* notes outvote the sustained harmony that establishes the key. This weighs
|
|
159
|
+
* each note by duration times velocity, the same measure chord inference uses,
|
|
160
|
+
* so the two agree on what the music emphasises. Notes that never sound (zero
|
|
161
|
+
* or negative duration) are ignored.
|
|
162
|
+
*
|
|
163
|
+
* @param notes The note events to weigh.
|
|
164
|
+
* @returns Ranked key interpretations (empty when nothing sounds).
|
|
165
|
+
* @example
|
|
166
|
+
* ```ts
|
|
167
|
+
* import { detectKeyFromNotes } from '@libraz/libcantus';
|
|
168
|
+
* detectKeyFromNotes([{ pitch: 60, startBeat: 0, durationBeat: 4 }])[0]?.key.rootPc; // 0
|
|
169
|
+
* ```
|
|
170
|
+
* @category Recognition
|
|
171
|
+
*/
|
|
172
|
+
declare function detectKeyFromNotes(notes: readonly NoteEvent[]): KeyMatch[];
|
|
173
|
+
/**
|
|
174
|
+
* The single best key interpretation of a pitch set.
|
|
175
|
+
*
|
|
176
|
+
* The counterpart of {@link detectChordBest}: the ranked list is the general
|
|
177
|
+
* answer, but a caller that just wants "what key is this" should not have to
|
|
178
|
+
* index into it and assert the result is there.
|
|
179
|
+
*
|
|
180
|
+
* @param pitches MIDI pitches or bare pitch classes.
|
|
181
|
+
* @param opts How to weigh the input; see {@link DetectKeyOptions}.
|
|
182
|
+
* @returns The top-ranked key, or null when nothing sounds.
|
|
183
|
+
* @example
|
|
184
|
+
* ```ts
|
|
185
|
+
* import { detectKeyBest } from '@libraz/libcantus';
|
|
186
|
+
* detectKeyBest([0, 2, 4, 5, 7, 9, 11])?.mode; // 'major'
|
|
187
|
+
* ```
|
|
188
|
+
* @category Recognition
|
|
189
|
+
*/
|
|
190
|
+
declare function detectKeyBest(pitches: readonly number[], opts?: DetectKeyOptions): KeyMatch | null;
|
|
191
|
+
|
|
192
|
+
export { type ChordMatch as C, type DetectChordOptions as D, type KeyMatch as K, type DetectKeyOptions as a, type KeyVariant as b, detectChordBest as c, detectChord as d, detectKey as e, detectKeyBest as f, detectKeyFromNotes as g };
|
|
@@ -1,18 +1,8 @@
|
|
|
1
|
-
import { T as TimeSignature } from './index-
|
|
2
|
-
import { K as KeyScale, N as NoteEvent } from './types-
|
|
3
|
-
import { C as Chord, b as ChordSpan } from './index-
|
|
4
|
-
import { C as Cadence } from './function-
|
|
1
|
+
import { T as TimeSignature } from './index-DXd9JikN.js';
|
|
2
|
+
import { K as KeyScale, N as NoteEvent } from './types-BN6_Q9Kl.js';
|
|
3
|
+
import { C as Chord, b as ChordSegment, c as ChordSpan } from './index-C83mZI1P.js';
|
|
4
|
+
import { C as Cadence } from './function-BtiZb9i9.js';
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
* A chord occupying a half-open beat span.
|
|
8
|
-
*
|
|
9
|
-
* @category Arrangement & Analysis
|
|
10
|
-
*/
|
|
11
|
-
type ChordSegment = {
|
|
12
|
-
startBeat: number;
|
|
13
|
-
endBeat: number;
|
|
14
|
-
chord: Chord;
|
|
15
|
-
};
|
|
16
6
|
/**
|
|
17
7
|
* A beat-indexed sequence of chord segments.
|
|
18
8
|
*
|
|
@@ -36,14 +26,14 @@ type ChordTimeline = {
|
|
|
36
26
|
* @returns A queryable chord timeline.
|
|
37
27
|
* @category Arrangement & Analysis
|
|
38
28
|
*/
|
|
39
|
-
declare function chordTimelineFromChords(chords: ChordSpan[], totalBeats: number): ChordTimeline;
|
|
29
|
+
declare function chordTimelineFromChords(chords: readonly ChordSpan[], totalBeats: number): ChordTimeline;
|
|
40
30
|
/**
|
|
41
31
|
* Options controlling {@link chordTimelineFromNotes}.
|
|
42
32
|
*
|
|
43
33
|
* @category Arrangement & Analysis
|
|
44
34
|
*/
|
|
45
35
|
type ChordTimelineOptions = {
|
|
46
|
-
/** Key context; inferred from the notes with {@link
|
|
36
|
+
/** Key context; inferred from the notes with {@link detectKeyFromNotes} when omitted. */
|
|
47
37
|
key?: KeyScale;
|
|
48
38
|
/**
|
|
49
39
|
* Time signature used for metric accents; defaults to 4/4.
|
|
@@ -63,6 +53,17 @@ type ChordTimelineOptions = {
|
|
|
63
53
|
* @defaultValue the end of the last note
|
|
64
54
|
*/
|
|
65
55
|
totalBeats?: number;
|
|
56
|
+
/**
|
|
57
|
+
* Upper bound on the work this call may do — note counts, windows, and
|
|
58
|
+
* candidate counts are each checked against it before anything is allocated.
|
|
59
|
+
*
|
|
60
|
+
* Raise it to analyse a piece larger than the default allows; the default is
|
|
61
|
+
* {@link DEFAULT_GENERATION_BUDGET}, chosen so a runaway input fails fast
|
|
62
|
+
* rather than blocking the thread.
|
|
63
|
+
*
|
|
64
|
+
* @defaultValue {@link DEFAULT_GENERATION_BUDGET}
|
|
65
|
+
*/
|
|
66
|
+
budget?: number;
|
|
66
67
|
};
|
|
67
68
|
/**
|
|
68
69
|
* The result of {@link chordTimelineFromNotes}.
|
|
@@ -148,4 +149,4 @@ type CadenceHit = {
|
|
|
148
149
|
*/
|
|
149
150
|
declare function detectCadences(timeline: ChordTimeline, key: KeyScale): CadenceHit[];
|
|
150
151
|
|
|
151
|
-
export { type CadenceHit as C, type
|
|
152
|
+
export { type CadenceHit as C, type ChordTimeline as a, type ChordTimelineOptions as b, type ChordTimelineResult as c, chordTimelineFromChords as d, chordTimelineFromNotes as e, detectCadences as f };
|