@libraz/libcantus 1.0.0 → 1.1.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-TTCLJX6D.js → chunk-57WB2EDF.js} +10 -8
- package/dist/chunk-57WB2EDF.js.map +1 -0
- package/dist/chunk-5JJ6EHEZ.cjs +457 -0
- package/dist/chunk-5JJ6EHEZ.cjs.map +1 -0
- package/dist/{chunk-AFM2ULJH.cjs → chunk-5KW7DNCJ.cjs} +1567 -1067
- package/dist/chunk-5KW7DNCJ.cjs.map +1 -0
- package/dist/chunk-7GOKQJTQ.js +145 -0
- package/dist/chunk-7GOKQJTQ.js.map +1 -0
- package/dist/{chunk-H3VORETI.js → chunk-AWEMD747.js} +487 -592
- package/dist/chunk-AWEMD747.js.map +1 -0
- package/dist/{chunk-4A2RMUCC.js → chunk-DKICR7AN.js} +1216 -611
- package/dist/chunk-DKICR7AN.js.map +1 -0
- package/dist/{chunk-INHVXP6Z.js → chunk-FPBZFNCD.js} +1159 -415
- package/dist/chunk-FPBZFNCD.js.map +1 -0
- package/dist/{chunk-M4CWTJWJ.cjs → chunk-GDKE6RQW.cjs} +1453 -848
- package/dist/chunk-GDKE6RQW.cjs.map +1 -0
- package/dist/chunk-H66ARFU5.js +363 -0
- package/dist/chunk-H66ARFU5.js.map +1 -0
- package/dist/{chunk-YH3BIKHH.js → chunk-HOHFYGKW.js} +146 -49
- package/dist/chunk-HOHFYGKW.js.map +1 -0
- package/dist/chunk-HSY2VQXZ.js +2272 -0
- package/dist/chunk-HSY2VQXZ.js.map +1 -0
- package/dist/{chunk-E3F4AHAH.cjs → chunk-J772DL3B.cjs} +221 -134
- package/dist/chunk-J772DL3B.cjs.map +1 -0
- package/dist/chunk-K6OZXIR6.js +1 -0
- package/dist/{chunk-VTI6FOLB.js → chunk-PQL7E5F6.js} +709 -133
- package/dist/chunk-PQL7E5F6.js.map +1 -0
- package/dist/chunk-Q6R3QAZD.cjs +3329 -0
- package/dist/chunk-Q6R3QAZD.cjs.map +1 -0
- package/dist/{chunk-MXO72PLY.cjs → chunk-QCXYKSZS.cjs} +21 -19
- package/dist/chunk-QCXYKSZS.cjs.map +1 -0
- package/dist/{chunk-VOHZB45S.js → chunk-R5VUXQMP.js} +1321 -821
- package/dist/chunk-R5VUXQMP.js.map +1 -0
- package/dist/chunk-R7B5N2JK.cjs +363 -0
- package/dist/chunk-R7B5N2JK.cjs.map +1 -0
- package/dist/{chunk-WWURE4XT.cjs → chunk-RVS4G4MR.cjs} +624 -729
- package/dist/chunk-RVS4G4MR.cjs.map +1 -0
- package/dist/chunk-TT6PKMPR.cjs +145 -0
- package/dist/chunk-TT6PKMPR.cjs.map +1 -0
- package/dist/chunk-UGLFDG7L.cjs +1 -0
- package/dist/chunk-UGLFDG7L.cjs.map +1 -0
- package/dist/chunk-VLE5R7PF.js +3329 -0
- package/dist/chunk-VLE5R7PF.js.map +1 -0
- package/dist/{chunk-FVSI36UV.js → chunk-X6RJAHII.js} +197 -110
- package/dist/chunk-X6RJAHII.js.map +1 -0
- package/dist/{chunk-Q2WGKJNN.cjs → chunk-XKSO2V5I.cjs} +699 -123
- package/dist/chunk-XKSO2V5I.cjs.map +1 -0
- package/dist/chunk-XVMJO3QF.cjs +2272 -0
- package/dist/chunk-XVMJO3QF.cjs.map +1 -0
- package/dist/{chunk-UADYAYAT.cjs → chunk-YPB3A3EY.cjs} +1309 -565
- package/dist/chunk-YPB3A3EY.cjs.map +1 -0
- package/dist/{index-C_8o--VE.d.cts → coerce-CJlgULrQ.d.cts} +210 -199
- package/dist/{index-szBv3496.d.ts → coerce-wwdELNYS.d.ts} +210 -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-Dzr13q3d.d.cts → index-B3WCj_Hm.d.cts} +135 -58
- package/dist/{index-BO6xE9YU.d.cts → index-BUtIf2go.d.ts} +460 -254
- package/dist/{index-CCNJRG-P.d.cts → index-BaoKVVhE.d.cts} +293 -56
- package/dist/{index-Chbst3Jx.d.ts → index-BpWOhkkE.d.ts} +135 -58
- package/dist/{index-BGFW-8P2.d.cts → index-BzLNkmA7.d.cts} +196 -114
- package/dist/{index-CunYKLiu.d.ts → index-CBCP84rv.d.cts} +1 -1
- package/dist/{index-BkGmlyI3.d.cts → index-Ci3xyows.d.ts} +60 -23
- package/dist/{index-9wcMhG73.d.ts → index-CnHQgqNh.d.ts} +293 -56
- package/dist/{index-B4o55NDr.d.cts → index-CnIdP4EZ.d.ts} +1 -1
- 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-D57QRbVn.d.ts → index-DTsKaPaC.d.cts} +460 -254
- package/dist/{index-Cj49F892.d.ts → index-D_hzxD8w.d.cts} +60 -23
- package/dist/{index-CgHqxdps.d.ts → index-DpC-mDlV.d.ts} +196 -114
- 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.ts → masks-C8TWLFIi.d.cts} +49 -2
- package/dist/{masks-DYbE485J.d.cts → masks-O73Rhj5d.d.ts} +49 -2
- package/dist/model/index.cjs +19 -12
- package/dist/model/index.cjs.map +1 -1
- package/dist/model/index.d.cts +502 -181
- package/dist/model/index.d.ts +502 -181
- 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 +6 -5
- package/dist/chunk-3JXCW6DX.cjs +0 -3220
- package/dist/chunk-3JXCW6DX.cjs.map +0 -1
- package/dist/chunk-4A2RMUCC.js.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-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-GOZG57ER.js +0 -3220
- package/dist/chunk-GOZG57ER.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-M4CWTJWJ.cjs.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-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/core/index.d.cts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export { D as DurationData, I as IndexedNoteEvent, J as JUST_RATIOS, N as NOTE_VALUES, a as NoteEventIndex, b as NoteEventIndexOptions, c as NotePlacement, d as NoteValue, O as OnsetTieBreak, P as PlayabilityIssue, e as PlayabilityIssueType, f as PlayabilityLayer, g as PlayabilityReport, S as SpelledDuration, T as TWELVE_TET, h as TempoEvent, i as TempoMap, j as TuningTable, k as Tuplet, l as beatsToDuration, m as beatsToSeconds, n as beatsToTicks, o as beatsToTiedDurations, p as centsBetweenFreq, q as centsFromNearestStep, r as centsOfSteps, s as centsToRatio, t as createNoteEventIndex, u as durationToBeats, v as durationToSeconds, w as edo, x as frequencyOf, y as justDeviationCents, z as nearestStep, A as playability, B as ratioToCents, C as secondsToBeats, E as stepOf, F as stepsOfCents, G as tempoAt, H as ticksToBeats } from '../index-
|
|
2
|
-
import {
|
|
3
|
-
export { A as ARTICULATIONS, a as Articulation, B as BudgetExceededError, I as
|
|
4
|
-
import { f as StringedProfile } from '../positional-
|
|
5
|
-
export { I as InstrumentProfile, a as InstrumentProfileCommon, b as InstrumentProfileLike, L as LIMBS, c as Limb, P as PercussionProfile, d as PositionalRng, S as SeedPath, e as StringFingering, g as
|
|
1
|
+
export { D as DurationData, I as IndexedNoteEvent, J as JUST_RATIOS, N as NOTE_VALUES, a as NoteEventIndex, b as NoteEventIndexOptions, c as NotePlacement, d as NoteValue, O as OnsetTieBreak, P as PlayabilityIssue, e as PlayabilityIssueType, f as PlayabilityLayer, g as PlayabilityReport, S as SpelledDuration, T as TWELVE_TET, h as TempoEvent, i as TempoMap, j as TuningTable, k as Tuplet, l as beatsToDuration, m as beatsToSeconds, n as beatsToTicks, o as beatsToTiedDurations, p as centsBetweenFreq, q as centsFromNearestStep, r as centsOfSteps, s as centsToRatio, t as createNoteEventIndex, u as durationToBeats, v as durationToSeconds, w as edo, x as frequencyOf, y as justDeviationCents, z as nearestStep, A as playability, B as ratioToCents, C as secondsToBeats, E as stepOf, F as stepsOfCents, G as tempoAt, H as ticksToBeats } from '../index-cHvbYgJI.cjs';
|
|
2
|
+
import { h as NoteEvent } from '../index-Cy15oTvh.cjs';
|
|
3
|
+
export { A as ARTICULATIONS, a as Articulation, B as BudgetExceededError, I as IntervalData, b as IntervalLike, c as IntervalQualityLabel, d as InvalidInputError, K as KeyName, e as KeyScale, L as LibcantusError, f as LibcantusErrorCode, N as NoSolutionError, g as NoteData, i as NoteLike, j as NoteNameOptions, k as NoteNameSystem, P as ParseResult, S as SpelledInterval, l as detectNoteNameSystem, m as diatonicLetterOf, n as formatKeyName, o as formatNote, p as intervalSemitones, q as isLibcantusError, r as midiToNote, s as naturalPitchClassOf, t as noteToMidi, u as noteToPitchClass, v as parseInterval, w as parseKeyName, x as parseNote, y as pitchClassOf, z as spelledInterval, C as toNoteData, D as toSpelledInterval, E as transposeByInterval, F as transposeNote, G as tryParseInterval, H as tryParseKeyName, J as tryParseNote } from '../index-Cy15oTvh.cjs';
|
|
4
|
+
import { f as StringedProfile } from '../positional-DMZer-FM.cjs';
|
|
5
|
+
export { I as InstrumentProfile, a as InstrumentProfileCommon, b as InstrumentProfileLike, L as LIMBS, c as Limb, P as PercussionProfile, d as PositionalRng, S as SeedPath, e as StringFingering, V as ValidatedPercussionProfile, g as ValidatedProfile, h as ValidatedStringedProfile, i as canSound, j as createPositionalRng, k as deriveSeed, l as fingeringsFor, m as foldIntoRange, n as includeAt, o as instrumentRange, t as toInstrumentProfile, p as toStringedProfile } from '../positional-DMZer-FM.cjs';
|
|
6
6
|
export { C as ConsonanceClass, c as classifyInterval, i as isConsonantInterval, a as isPerfectInterval } from '../index-DInQqT8Q.cjs';
|
|
7
|
-
import { c as MeterMap, T as TimeSignature } from '../index-
|
|
8
|
-
export { B as BarPosition, M as MeterChange, a as MeterData, b as MeterLike, d as barIndexAt, e as barPositionToBeat, f as barPositionToPulse, g as barStartBeat, h as beatToBarPosition, i as beatsPerBar, j as beatsPerBarAt, k as formatBarPosition, l as formatTimeSignature, m as isCompound, n as isStrongBeat, o as meterAt, p as metricWeight, q as parseTimeSignature, r as pulseBeats, s as pulsesPerBar, t as resolveMeters, u as toMeterData, v as tryParseTimeSignature, w as tuplet } from '../index-
|
|
7
|
+
import { c as MeterMap, T as TimeSignature } from '../index-D_hzxD8w.cjs';
|
|
8
|
+
export { B as BarPosition, M as MeterChange, a as MeterData, b as MeterLike, d as barIndexAt, e as barPositionToBeat, f as barPositionToPulse, g as barStartBeat, h as beatToBarPosition, i as beatsPerBar, j as beatsPerBarAt, k as formatBarPosition, l as formatTimeSignature, m as isCompound, n as isStrongBeat, o as meterAt, p as metricWeight, q as parseTimeSignature, r as pulseBeats, s as pulsesPerBar, t as resolveMeters, u as toMeterData, v as tryParseTimeSignature, w as tuplet } from '../index-D_hzxD8w.cjs';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Electric bass in standard tuning: E1 A1 D2 G2 over a 24-fret neck.
|
|
@@ -34,105 +34,6 @@ declare const GUITAR_STANDARD: StringedProfile;
|
|
|
34
34
|
*/
|
|
35
35
|
declare const GUITAR_DROP_D: StringedProfile;
|
|
36
36
|
|
|
37
|
-
/**
|
|
38
|
-
* The reproducibility contract for generated output.
|
|
39
|
-
*
|
|
40
|
-
* A saved project is a seed plus parameters, and it only reopens as the same
|
|
41
|
-
* piece if the library still turns them into the same notes. Package versions
|
|
42
|
-
* cannot carry that promise: a bug fix inside a generator is a patch release
|
|
43
|
-
* and still moves every note. The algorithm version is the separate number
|
|
44
|
-
* that does carry it, declared here and recorded by the caller alongside the
|
|
45
|
-
* seed.
|
|
46
|
-
*/
|
|
47
|
-
/**
|
|
48
|
-
* The generator algorithm version this build produces by default.
|
|
49
|
-
*
|
|
50
|
-
* The guarantee it carries: for a fixed algorithm version, the same inputs —
|
|
51
|
-
* seed, version and every documented parameter — produce the same generated
|
|
52
|
-
* output from any build of this library that accepts that version. It covers
|
|
53
|
-
* what the generators return, and nothing else: analysis results, error
|
|
54
|
-
* messages and output taken under a different version are outside it.
|
|
55
|
-
*
|
|
56
|
-
* Changing what a generator returns for a version it already accepts is a
|
|
57
|
-
* defect. New behaviour raises this constant instead, and the older version
|
|
58
|
-
* keeps producing what it produced. Withdrawing an accepted version is a
|
|
59
|
-
* breaking change, and a project pinned to a withdrawn or not-yet-known
|
|
60
|
-
* version is rejected rather than reinterpreted.
|
|
61
|
-
*
|
|
62
|
-
* @category Utilities
|
|
63
|
-
*/
|
|
64
|
-
declare const ALGORITHM_VERSION = 1;
|
|
65
|
-
/**
|
|
66
|
-
* The oldest algorithm version this build still produces.
|
|
67
|
-
*
|
|
68
|
-
* @category Utilities
|
|
69
|
-
*/
|
|
70
|
-
declare const MIN_ALGORITHM_VERSION = 1;
|
|
71
|
-
/**
|
|
72
|
-
* Resolve the algorithm version a request runs under.
|
|
73
|
-
*
|
|
74
|
-
* An unpinned request runs at {@link ALGORITHM_VERSION}, which is what a
|
|
75
|
-
* caller who wants the current behaviour means; a caller who wants the piece
|
|
76
|
-
* back records the resolved number and passes it next time. A version this
|
|
77
|
-
* build does not produce is rejected — a project saved by a newer build cannot
|
|
78
|
-
* be reproduced by an older one, and quietly rendering it at another version
|
|
79
|
-
* would return a different piece under the same name.
|
|
80
|
-
*
|
|
81
|
-
* @param requested The pinned version, or undefined for the current one.
|
|
82
|
-
* @returns The version to generate under.
|
|
83
|
-
* @throws If the version is not an integer this build produces.
|
|
84
|
-
* @example
|
|
85
|
-
* ```ts
|
|
86
|
-
* import { ALGORITHM_VERSION, resolveAlgorithmVersion } from '@libraz/libcantus';
|
|
87
|
-
* resolveAlgorithmVersion(undefined); // ALGORITHM_VERSION
|
|
88
|
-
* resolveAlgorithmVersion(ALGORITHM_VERSION); // the pinned value, unchanged
|
|
89
|
-
* ```
|
|
90
|
-
* @category Utilities
|
|
91
|
-
*/
|
|
92
|
-
declare function resolveAlgorithmVersion(requested?: number): number;
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Deterministic seeded pseudo-random number generation shared across the
|
|
96
|
-
* generative modules (rhythm, drums, bass, groove, counter-melody). A single
|
|
97
|
-
* mulberry32 core exposes the small set of samplers those modules need; given a
|
|
98
|
-
* seed the stream is fully reproducible.
|
|
99
|
-
*
|
|
100
|
-
* Around that core sit the pieces that make a whole project reproducible: seeds
|
|
101
|
-
* derived hierarchically from one project number, draws addressed by position
|
|
102
|
-
* rather than by call order, and the algorithm version the output is pinned to.
|
|
103
|
-
*/
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* A deterministic PRNG with the sampling helpers the generators need.
|
|
107
|
-
*
|
|
108
|
-
* @category Utilities
|
|
109
|
-
*/
|
|
110
|
-
type Rng = {
|
|
111
|
-
/** Next float in [0, 1). */
|
|
112
|
-
next: () => number;
|
|
113
|
-
/** True with probability `p`. */
|
|
114
|
-
prob: (p: number) => boolean;
|
|
115
|
-
/** Integer in the inclusive range [lo, hi]. */
|
|
116
|
-
range: (lo: number, hi: number) => number;
|
|
117
|
-
/** Float in [lo, hi). */
|
|
118
|
-
float: (lo: number, hi: number) => number;
|
|
119
|
-
};
|
|
120
|
-
/**
|
|
121
|
-
* Create a seeded PRNG (mulberry32) exposing the shared samplers.
|
|
122
|
-
*
|
|
123
|
-
* @param seed The 32-bit seed; the same seed always yields the same stream.
|
|
124
|
-
* @returns The seeded generator.
|
|
125
|
-
* @example
|
|
126
|
-
* ```ts
|
|
127
|
-
* import { createRng } from '@libraz/libcantus';
|
|
128
|
-
* const rng = createRng(42);
|
|
129
|
-
* rng.next(); // deterministic float in [0, 1)
|
|
130
|
-
* rng.range(1, 6); // deterministic integer in [1, 6]
|
|
131
|
-
* ```
|
|
132
|
-
* @category Utilities
|
|
133
|
-
*/
|
|
134
|
-
declare function createRng(seed: number): Rng;
|
|
135
|
-
|
|
136
37
|
/**
|
|
137
38
|
* Default upper bound for synchronous event/window/candidate generation.
|
|
138
39
|
*
|
|
@@ -195,7 +96,10 @@ declare const soundingNotesOnly: typeof dropSilentNotes;
|
|
|
195
96
|
* @param allowed Every accepted name.
|
|
196
97
|
* @param name What the value is, for the error message.
|
|
197
98
|
* @returns The value, narrowed to the allowed union.
|
|
198
|
-
* @throws If the value is not one of `allowed`.
|
|
99
|
+
* @throws If the value is not one of `allowed`. The message names the value by
|
|
100
|
+
* its type unless it is a string, and echoes at most the head of that string,
|
|
101
|
+
* so building it cannot itself fail on a circular object and cannot grow with
|
|
102
|
+
* the size of what was pasted into the field.
|
|
199
103
|
*
|
|
200
104
|
* @category Core
|
|
201
105
|
*/
|
|
@@ -230,7 +134,13 @@ declare function assertTimeSignature(ts: TimeSignature, name?: string): TimeSign
|
|
|
230
134
|
*
|
|
231
135
|
* The first entry also governs everything before it, so a map need not start at
|
|
232
136
|
* beat 0 — that is what lets a pickup at a negative beat be read in the
|
|
233
|
-
* signature the piece opens in.
|
|
137
|
+
* signature the piece opens in. Where the first entry is written does not move
|
|
138
|
+
* the bar lines: the opening signature counts its bars from beat 0 either way,
|
|
139
|
+
* so beat 0 is the downbeat of bar 0 and the pickup before it is bar -1.
|
|
140
|
+
*
|
|
141
|
+
* The map is also bounded, the way an event array is: a map is consulted once
|
|
142
|
+
* per analysed slot, so its length is a per-slot cost and not only a one-time
|
|
143
|
+
* one.
|
|
234
144
|
*
|
|
235
145
|
* @category Core
|
|
236
146
|
*/
|
|
@@ -272,4 +182,108 @@ declare function assertNoteEvent(event: NoteEvent, name?: string, options?: Note
|
|
|
272
182
|
*/
|
|
273
183
|
declare function assertNoteEvents(events: readonly NoteEvent[], name?: string, options?: NoteEventAssertOptions): NoteEvent[];
|
|
274
184
|
|
|
185
|
+
/**
|
|
186
|
+
* How generated output is pinned across builds.
|
|
187
|
+
*
|
|
188
|
+
* A saved project is a seed plus parameters, and it reopens as the same piece
|
|
189
|
+
* only while the library turns them into the same notes. The algorithm version
|
|
190
|
+
* is the number that says which reading of those parameters a project was
|
|
191
|
+
* written against. It is drawn into every seed, so two versions never draw the
|
|
192
|
+
* same stream, and a caller records it beside the seed.
|
|
193
|
+
*/
|
|
194
|
+
/**
|
|
195
|
+
* The generator algorithm version this build produces by default.
|
|
196
|
+
*
|
|
197
|
+
* What it carries: for a fixed algorithm version, the same inputs — seed,
|
|
198
|
+
* version and every documented parameter — produce the same generated output
|
|
199
|
+
* from a given build. It covers what the generators return, and nothing else:
|
|
200
|
+
* analysis results, error messages and output taken under a different version
|
|
201
|
+
* are outside it.
|
|
202
|
+
*
|
|
203
|
+
* What it does not carry is a reading frozen against correction. The
|
|
204
|
+
* generators hold one implementation rather than one per version, so pinning
|
|
205
|
+
* an older number selects a different draw of the current implementation and
|
|
206
|
+
* does not restore what that number produced before: a fix to output that was
|
|
207
|
+
* musically wrong moves the notes of a version already in use, ships as a
|
|
208
|
+
* patch, and is stated in the changelog. Reproducing a piece exactly therefore
|
|
209
|
+
* means recording the package version alongside the seed and this number.
|
|
210
|
+
*
|
|
211
|
+
* Raising this constant marks a deliberate change of approach rather than a
|
|
212
|
+
* correction. A project pinned to a version this build does not know is
|
|
213
|
+
* rejected rather than reinterpreted.
|
|
214
|
+
*
|
|
215
|
+
* @category Utilities
|
|
216
|
+
*/
|
|
217
|
+
declare const ALGORITHM_VERSION = 1;
|
|
218
|
+
/**
|
|
219
|
+
* The oldest algorithm version this build still accepts.
|
|
220
|
+
*
|
|
221
|
+
* @category Utilities
|
|
222
|
+
*/
|
|
223
|
+
declare const MIN_ALGORITHM_VERSION = 1;
|
|
224
|
+
/**
|
|
225
|
+
* Resolve the algorithm version a request runs under.
|
|
226
|
+
*
|
|
227
|
+
* An unpinned request runs at {@link ALGORITHM_VERSION}, which is what a
|
|
228
|
+
* caller who wants the current behaviour means; a caller who wants the piece
|
|
229
|
+
* back records the resolved number and passes it next time. A version this
|
|
230
|
+
* build does not produce is rejected — a project saved by a newer build cannot
|
|
231
|
+
* be reproduced by an older one, and quietly rendering it at another version
|
|
232
|
+
* would return a different piece under the same name.
|
|
233
|
+
*
|
|
234
|
+
* @param requested The pinned version, or undefined for the current one.
|
|
235
|
+
* @returns The version to generate under.
|
|
236
|
+
* @throws If the version is not an integer this build produces.
|
|
237
|
+
* @example
|
|
238
|
+
* ```ts
|
|
239
|
+
* import { ALGORITHM_VERSION, resolveAlgorithmVersion } from '@libraz/libcantus';
|
|
240
|
+
* resolveAlgorithmVersion(undefined); // ALGORITHM_VERSION
|
|
241
|
+
* resolveAlgorithmVersion(ALGORITHM_VERSION); // the pinned value, unchanged
|
|
242
|
+
* ```
|
|
243
|
+
* @category Utilities
|
|
244
|
+
*/
|
|
245
|
+
declare function resolveAlgorithmVersion(requested?: number): number;
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Deterministic seeded pseudo-random number generation shared across the
|
|
249
|
+
* generative modules (rhythm, drums, bass, groove, counter-melody). A single
|
|
250
|
+
* mulberry32 core exposes the small set of samplers those modules need; given a
|
|
251
|
+
* seed the stream is fully reproducible.
|
|
252
|
+
*
|
|
253
|
+
* Around that core sit the pieces that make a whole project reproducible: seeds
|
|
254
|
+
* derived hierarchically from one project number, draws addressed by position
|
|
255
|
+
* rather than by call order, and the algorithm version the output is pinned to.
|
|
256
|
+
*/
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* A deterministic PRNG with the sampling helpers the generators need.
|
|
260
|
+
*
|
|
261
|
+
* @category Utilities
|
|
262
|
+
*/
|
|
263
|
+
type Rng = {
|
|
264
|
+
/** Next float in [0, 1). */
|
|
265
|
+
next: () => number;
|
|
266
|
+
/** True with probability `p`. */
|
|
267
|
+
prob: (p: number) => boolean;
|
|
268
|
+
/** Integer in the inclusive range [lo, hi]. */
|
|
269
|
+
range: (lo: number, hi: number) => number;
|
|
270
|
+
/** Float in [lo, hi). */
|
|
271
|
+
float: (lo: number, hi: number) => number;
|
|
272
|
+
};
|
|
273
|
+
/**
|
|
274
|
+
* Create a seeded PRNG (mulberry32) exposing the shared samplers.
|
|
275
|
+
*
|
|
276
|
+
* @param seed The 32-bit seed; the same seed always yields the same stream.
|
|
277
|
+
* @returns The seeded generator.
|
|
278
|
+
* @example
|
|
279
|
+
* ```ts
|
|
280
|
+
* import { createRng } from '@libraz/libcantus';
|
|
281
|
+
* const rng = createRng(42);
|
|
282
|
+
* rng.next(); // deterministic float in [0, 1)
|
|
283
|
+
* rng.range(1, 6); // deterministic integer in [1, 6]
|
|
284
|
+
* ```
|
|
285
|
+
* @category Utilities
|
|
286
|
+
*/
|
|
287
|
+
declare function createRng(seed: number): Rng;
|
|
288
|
+
|
|
275
289
|
export { ALGORITHM_VERSION, BASS_4_STRING, BASS_5_STRING, DEFAULT_GENERATION_BUDGET, GUITAR_DROP_D, GUITAR_STANDARD, MIN_ALGORITHM_VERSION, MeterMap, NoteEvent, type NoteEventAssertOptions, type Rng, StringedProfile, TimeSignature, assertDegree, assertFiniteNumber, assertFiniteSemitones, assertGenerationBudget, assertInteger, assertMeterMap, assertMidiPitch, assertNoteEvent, assertNoteEvents, assertOneOf, assertPositiveInt, assertRange, assertTimeSignature, clampToMidi, createRng, dropSilentNotes, resolveAlgorithmVersion, soundingNotesOnly };
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export { D as DurationData, I as IndexedNoteEvent, J as JUST_RATIOS, N as NOTE_VALUES, a as NoteEventIndex, b as NoteEventIndexOptions, c as NotePlacement, d as NoteValue, O as OnsetTieBreak, P as PlayabilityIssue, e as PlayabilityIssueType, f as PlayabilityLayer, g as PlayabilityReport, S as SpelledDuration, T as TWELVE_TET, h as TempoEvent, i as TempoMap, j as TuningTable, k as Tuplet, l as beatsToDuration, m as beatsToSeconds, n as beatsToTicks, o as beatsToTiedDurations, p as centsBetweenFreq, q as centsFromNearestStep, r as centsOfSteps, s as centsToRatio, t as createNoteEventIndex, u as durationToBeats, v as durationToSeconds, w as edo, x as frequencyOf, y as justDeviationCents, z as nearestStep, A as playability, B as ratioToCents, C as secondsToBeats, E as stepOf, F as stepsOfCents, G as tempoAt, H as ticksToBeats } from '../index-
|
|
2
|
-
import {
|
|
3
|
-
export { A as ARTICULATIONS, a as Articulation, B as BudgetExceededError, I as
|
|
4
|
-
import { f as StringedProfile } from '../positional-
|
|
5
|
-
export { I as InstrumentProfile, a as InstrumentProfileCommon, b as InstrumentProfileLike, L as LIMBS, c as Limb, P as PercussionProfile, d as PositionalRng, S as SeedPath, e as StringFingering, g as
|
|
1
|
+
export { D as DurationData, I as IndexedNoteEvent, J as JUST_RATIOS, N as NOTE_VALUES, a as NoteEventIndex, b as NoteEventIndexOptions, c as NotePlacement, d as NoteValue, O as OnsetTieBreak, P as PlayabilityIssue, e as PlayabilityIssueType, f as PlayabilityLayer, g as PlayabilityReport, S as SpelledDuration, T as TWELVE_TET, h as TempoEvent, i as TempoMap, j as TuningTable, k as Tuplet, l as beatsToDuration, m as beatsToSeconds, n as beatsToTicks, o as beatsToTiedDurations, p as centsBetweenFreq, q as centsFromNearestStep, r as centsOfSteps, s as centsToRatio, t as createNoteEventIndex, u as durationToBeats, v as durationToSeconds, w as edo, x as frequencyOf, y as justDeviationCents, z as nearestStep, A as playability, B as ratioToCents, C as secondsToBeats, E as stepOf, F as stepsOfCents, G as tempoAt, H as ticksToBeats } from '../index-9eoQs2C1.js';
|
|
2
|
+
import { h as NoteEvent } from '../index-Cy15oTvh.js';
|
|
3
|
+
export { A as ARTICULATIONS, a as Articulation, B as BudgetExceededError, I as IntervalData, b as IntervalLike, c as IntervalQualityLabel, d as InvalidInputError, K as KeyName, e as KeyScale, L as LibcantusError, f as LibcantusErrorCode, N as NoSolutionError, g as NoteData, i as NoteLike, j as NoteNameOptions, k as NoteNameSystem, P as ParseResult, S as SpelledInterval, l as detectNoteNameSystem, m as diatonicLetterOf, n as formatKeyName, o as formatNote, p as intervalSemitones, q as isLibcantusError, r as midiToNote, s as naturalPitchClassOf, t as noteToMidi, u as noteToPitchClass, v as parseInterval, w as parseKeyName, x as parseNote, y as pitchClassOf, z as spelledInterval, C as toNoteData, D as toSpelledInterval, E as transposeByInterval, F as transposeNote, G as tryParseInterval, H as tryParseKeyName, J as tryParseNote } from '../index-Cy15oTvh.js';
|
|
4
|
+
import { f as StringedProfile } from '../positional-DJgs6ltD.js';
|
|
5
|
+
export { I as InstrumentProfile, a as InstrumentProfileCommon, b as InstrumentProfileLike, L as LIMBS, c as Limb, P as PercussionProfile, d as PositionalRng, S as SeedPath, e as StringFingering, V as ValidatedPercussionProfile, g as ValidatedProfile, h as ValidatedStringedProfile, i as canSound, j as createPositionalRng, k as deriveSeed, l as fingeringsFor, m as foldIntoRange, n as includeAt, o as instrumentRange, t as toInstrumentProfile, p as toStringedProfile } from '../positional-DJgs6ltD.js';
|
|
6
6
|
export { C as ConsonanceClass, c as classifyInterval, i as isConsonantInterval, a as isPerfectInterval } from '../index-DInQqT8Q.js';
|
|
7
|
-
import { c as MeterMap, T as TimeSignature } from '../index-
|
|
8
|
-
export { B as BarPosition, M as MeterChange, a as MeterData, b as MeterLike, d as barIndexAt, e as barPositionToBeat, f as barPositionToPulse, g as barStartBeat, h as beatToBarPosition, i as beatsPerBar, j as beatsPerBarAt, k as formatBarPosition, l as formatTimeSignature, m as isCompound, n as isStrongBeat, o as meterAt, p as metricWeight, q as parseTimeSignature, r as pulseBeats, s as pulsesPerBar, t as resolveMeters, u as toMeterData, v as tryParseTimeSignature, w as tuplet } from '../index-
|
|
7
|
+
import { c as MeterMap, T as TimeSignature } from '../index-Ci3xyows.js';
|
|
8
|
+
export { B as BarPosition, M as MeterChange, a as MeterData, b as MeterLike, d as barIndexAt, e as barPositionToBeat, f as barPositionToPulse, g as barStartBeat, h as beatToBarPosition, i as beatsPerBar, j as beatsPerBarAt, k as formatBarPosition, l as formatTimeSignature, m as isCompound, n as isStrongBeat, o as meterAt, p as metricWeight, q as parseTimeSignature, r as pulseBeats, s as pulsesPerBar, t as resolveMeters, u as toMeterData, v as tryParseTimeSignature, w as tuplet } from '../index-Ci3xyows.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Electric bass in standard tuning: E1 A1 D2 G2 over a 24-fret neck.
|
|
@@ -34,105 +34,6 @@ declare const GUITAR_STANDARD: StringedProfile;
|
|
|
34
34
|
*/
|
|
35
35
|
declare const GUITAR_DROP_D: StringedProfile;
|
|
36
36
|
|
|
37
|
-
/**
|
|
38
|
-
* The reproducibility contract for generated output.
|
|
39
|
-
*
|
|
40
|
-
* A saved project is a seed plus parameters, and it only reopens as the same
|
|
41
|
-
* piece if the library still turns them into the same notes. Package versions
|
|
42
|
-
* cannot carry that promise: a bug fix inside a generator is a patch release
|
|
43
|
-
* and still moves every note. The algorithm version is the separate number
|
|
44
|
-
* that does carry it, declared here and recorded by the caller alongside the
|
|
45
|
-
* seed.
|
|
46
|
-
*/
|
|
47
|
-
/**
|
|
48
|
-
* The generator algorithm version this build produces by default.
|
|
49
|
-
*
|
|
50
|
-
* The guarantee it carries: for a fixed algorithm version, the same inputs —
|
|
51
|
-
* seed, version and every documented parameter — produce the same generated
|
|
52
|
-
* output from any build of this library that accepts that version. It covers
|
|
53
|
-
* what the generators return, and nothing else: analysis results, error
|
|
54
|
-
* messages and output taken under a different version are outside it.
|
|
55
|
-
*
|
|
56
|
-
* Changing what a generator returns for a version it already accepts is a
|
|
57
|
-
* defect. New behaviour raises this constant instead, and the older version
|
|
58
|
-
* keeps producing what it produced. Withdrawing an accepted version is a
|
|
59
|
-
* breaking change, and a project pinned to a withdrawn or not-yet-known
|
|
60
|
-
* version is rejected rather than reinterpreted.
|
|
61
|
-
*
|
|
62
|
-
* @category Utilities
|
|
63
|
-
*/
|
|
64
|
-
declare const ALGORITHM_VERSION = 1;
|
|
65
|
-
/**
|
|
66
|
-
* The oldest algorithm version this build still produces.
|
|
67
|
-
*
|
|
68
|
-
* @category Utilities
|
|
69
|
-
*/
|
|
70
|
-
declare const MIN_ALGORITHM_VERSION = 1;
|
|
71
|
-
/**
|
|
72
|
-
* Resolve the algorithm version a request runs under.
|
|
73
|
-
*
|
|
74
|
-
* An unpinned request runs at {@link ALGORITHM_VERSION}, which is what a
|
|
75
|
-
* caller who wants the current behaviour means; a caller who wants the piece
|
|
76
|
-
* back records the resolved number and passes it next time. A version this
|
|
77
|
-
* build does not produce is rejected — a project saved by a newer build cannot
|
|
78
|
-
* be reproduced by an older one, and quietly rendering it at another version
|
|
79
|
-
* would return a different piece under the same name.
|
|
80
|
-
*
|
|
81
|
-
* @param requested The pinned version, or undefined for the current one.
|
|
82
|
-
* @returns The version to generate under.
|
|
83
|
-
* @throws If the version is not an integer this build produces.
|
|
84
|
-
* @example
|
|
85
|
-
* ```ts
|
|
86
|
-
* import { ALGORITHM_VERSION, resolveAlgorithmVersion } from '@libraz/libcantus';
|
|
87
|
-
* resolveAlgorithmVersion(undefined); // ALGORITHM_VERSION
|
|
88
|
-
* resolveAlgorithmVersion(ALGORITHM_VERSION); // the pinned value, unchanged
|
|
89
|
-
* ```
|
|
90
|
-
* @category Utilities
|
|
91
|
-
*/
|
|
92
|
-
declare function resolveAlgorithmVersion(requested?: number): number;
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Deterministic seeded pseudo-random number generation shared across the
|
|
96
|
-
* generative modules (rhythm, drums, bass, groove, counter-melody). A single
|
|
97
|
-
* mulberry32 core exposes the small set of samplers those modules need; given a
|
|
98
|
-
* seed the stream is fully reproducible.
|
|
99
|
-
*
|
|
100
|
-
* Around that core sit the pieces that make a whole project reproducible: seeds
|
|
101
|
-
* derived hierarchically from one project number, draws addressed by position
|
|
102
|
-
* rather than by call order, and the algorithm version the output is pinned to.
|
|
103
|
-
*/
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* A deterministic PRNG with the sampling helpers the generators need.
|
|
107
|
-
*
|
|
108
|
-
* @category Utilities
|
|
109
|
-
*/
|
|
110
|
-
type Rng = {
|
|
111
|
-
/** Next float in [0, 1). */
|
|
112
|
-
next: () => number;
|
|
113
|
-
/** True with probability `p`. */
|
|
114
|
-
prob: (p: number) => boolean;
|
|
115
|
-
/** Integer in the inclusive range [lo, hi]. */
|
|
116
|
-
range: (lo: number, hi: number) => number;
|
|
117
|
-
/** Float in [lo, hi). */
|
|
118
|
-
float: (lo: number, hi: number) => number;
|
|
119
|
-
};
|
|
120
|
-
/**
|
|
121
|
-
* Create a seeded PRNG (mulberry32) exposing the shared samplers.
|
|
122
|
-
*
|
|
123
|
-
* @param seed The 32-bit seed; the same seed always yields the same stream.
|
|
124
|
-
* @returns The seeded generator.
|
|
125
|
-
* @example
|
|
126
|
-
* ```ts
|
|
127
|
-
* import { createRng } from '@libraz/libcantus';
|
|
128
|
-
* const rng = createRng(42);
|
|
129
|
-
* rng.next(); // deterministic float in [0, 1)
|
|
130
|
-
* rng.range(1, 6); // deterministic integer in [1, 6]
|
|
131
|
-
* ```
|
|
132
|
-
* @category Utilities
|
|
133
|
-
*/
|
|
134
|
-
declare function createRng(seed: number): Rng;
|
|
135
|
-
|
|
136
37
|
/**
|
|
137
38
|
* Default upper bound for synchronous event/window/candidate generation.
|
|
138
39
|
*
|
|
@@ -195,7 +96,10 @@ declare const soundingNotesOnly: typeof dropSilentNotes;
|
|
|
195
96
|
* @param allowed Every accepted name.
|
|
196
97
|
* @param name What the value is, for the error message.
|
|
197
98
|
* @returns The value, narrowed to the allowed union.
|
|
198
|
-
* @throws If the value is not one of `allowed`.
|
|
99
|
+
* @throws If the value is not one of `allowed`. The message names the value by
|
|
100
|
+
* its type unless it is a string, and echoes at most the head of that string,
|
|
101
|
+
* so building it cannot itself fail on a circular object and cannot grow with
|
|
102
|
+
* the size of what was pasted into the field.
|
|
199
103
|
*
|
|
200
104
|
* @category Core
|
|
201
105
|
*/
|
|
@@ -230,7 +134,13 @@ declare function assertTimeSignature(ts: TimeSignature, name?: string): TimeSign
|
|
|
230
134
|
*
|
|
231
135
|
* The first entry also governs everything before it, so a map need not start at
|
|
232
136
|
* beat 0 — that is what lets a pickup at a negative beat be read in the
|
|
233
|
-
* signature the piece opens in.
|
|
137
|
+
* signature the piece opens in. Where the first entry is written does not move
|
|
138
|
+
* the bar lines: the opening signature counts its bars from beat 0 either way,
|
|
139
|
+
* so beat 0 is the downbeat of bar 0 and the pickup before it is bar -1.
|
|
140
|
+
*
|
|
141
|
+
* The map is also bounded, the way an event array is: a map is consulted once
|
|
142
|
+
* per analysed slot, so its length is a per-slot cost and not only a one-time
|
|
143
|
+
* one.
|
|
234
144
|
*
|
|
235
145
|
* @category Core
|
|
236
146
|
*/
|
|
@@ -272,4 +182,108 @@ declare function assertNoteEvent(event: NoteEvent, name?: string, options?: Note
|
|
|
272
182
|
*/
|
|
273
183
|
declare function assertNoteEvents(events: readonly NoteEvent[], name?: string, options?: NoteEventAssertOptions): NoteEvent[];
|
|
274
184
|
|
|
185
|
+
/**
|
|
186
|
+
* How generated output is pinned across builds.
|
|
187
|
+
*
|
|
188
|
+
* A saved project is a seed plus parameters, and it reopens as the same piece
|
|
189
|
+
* only while the library turns them into the same notes. The algorithm version
|
|
190
|
+
* is the number that says which reading of those parameters a project was
|
|
191
|
+
* written against. It is drawn into every seed, so two versions never draw the
|
|
192
|
+
* same stream, and a caller records it beside the seed.
|
|
193
|
+
*/
|
|
194
|
+
/**
|
|
195
|
+
* The generator algorithm version this build produces by default.
|
|
196
|
+
*
|
|
197
|
+
* What it carries: for a fixed algorithm version, the same inputs — seed,
|
|
198
|
+
* version and every documented parameter — produce the same generated output
|
|
199
|
+
* from a given build. It covers what the generators return, and nothing else:
|
|
200
|
+
* analysis results, error messages and output taken under a different version
|
|
201
|
+
* are outside it.
|
|
202
|
+
*
|
|
203
|
+
* What it does not carry is a reading frozen against correction. The
|
|
204
|
+
* generators hold one implementation rather than one per version, so pinning
|
|
205
|
+
* an older number selects a different draw of the current implementation and
|
|
206
|
+
* does not restore what that number produced before: a fix to output that was
|
|
207
|
+
* musically wrong moves the notes of a version already in use, ships as a
|
|
208
|
+
* patch, and is stated in the changelog. Reproducing a piece exactly therefore
|
|
209
|
+
* means recording the package version alongside the seed and this number.
|
|
210
|
+
*
|
|
211
|
+
* Raising this constant marks a deliberate change of approach rather than a
|
|
212
|
+
* correction. A project pinned to a version this build does not know is
|
|
213
|
+
* rejected rather than reinterpreted.
|
|
214
|
+
*
|
|
215
|
+
* @category Utilities
|
|
216
|
+
*/
|
|
217
|
+
declare const ALGORITHM_VERSION = 1;
|
|
218
|
+
/**
|
|
219
|
+
* The oldest algorithm version this build still accepts.
|
|
220
|
+
*
|
|
221
|
+
* @category Utilities
|
|
222
|
+
*/
|
|
223
|
+
declare const MIN_ALGORITHM_VERSION = 1;
|
|
224
|
+
/**
|
|
225
|
+
* Resolve the algorithm version a request runs under.
|
|
226
|
+
*
|
|
227
|
+
* An unpinned request runs at {@link ALGORITHM_VERSION}, which is what a
|
|
228
|
+
* caller who wants the current behaviour means; a caller who wants the piece
|
|
229
|
+
* back records the resolved number and passes it next time. A version this
|
|
230
|
+
* build does not produce is rejected — a project saved by a newer build cannot
|
|
231
|
+
* be reproduced by an older one, and quietly rendering it at another version
|
|
232
|
+
* would return a different piece under the same name.
|
|
233
|
+
*
|
|
234
|
+
* @param requested The pinned version, or undefined for the current one.
|
|
235
|
+
* @returns The version to generate under.
|
|
236
|
+
* @throws If the version is not an integer this build produces.
|
|
237
|
+
* @example
|
|
238
|
+
* ```ts
|
|
239
|
+
* import { ALGORITHM_VERSION, resolveAlgorithmVersion } from '@libraz/libcantus';
|
|
240
|
+
* resolveAlgorithmVersion(undefined); // ALGORITHM_VERSION
|
|
241
|
+
* resolveAlgorithmVersion(ALGORITHM_VERSION); // the pinned value, unchanged
|
|
242
|
+
* ```
|
|
243
|
+
* @category Utilities
|
|
244
|
+
*/
|
|
245
|
+
declare function resolveAlgorithmVersion(requested?: number): number;
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Deterministic seeded pseudo-random number generation shared across the
|
|
249
|
+
* generative modules (rhythm, drums, bass, groove, counter-melody). A single
|
|
250
|
+
* mulberry32 core exposes the small set of samplers those modules need; given a
|
|
251
|
+
* seed the stream is fully reproducible.
|
|
252
|
+
*
|
|
253
|
+
* Around that core sit the pieces that make a whole project reproducible: seeds
|
|
254
|
+
* derived hierarchically from one project number, draws addressed by position
|
|
255
|
+
* rather than by call order, and the algorithm version the output is pinned to.
|
|
256
|
+
*/
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* A deterministic PRNG with the sampling helpers the generators need.
|
|
260
|
+
*
|
|
261
|
+
* @category Utilities
|
|
262
|
+
*/
|
|
263
|
+
type Rng = {
|
|
264
|
+
/** Next float in [0, 1). */
|
|
265
|
+
next: () => number;
|
|
266
|
+
/** True with probability `p`. */
|
|
267
|
+
prob: (p: number) => boolean;
|
|
268
|
+
/** Integer in the inclusive range [lo, hi]. */
|
|
269
|
+
range: (lo: number, hi: number) => number;
|
|
270
|
+
/** Float in [lo, hi). */
|
|
271
|
+
float: (lo: number, hi: number) => number;
|
|
272
|
+
};
|
|
273
|
+
/**
|
|
274
|
+
* Create a seeded PRNG (mulberry32) exposing the shared samplers.
|
|
275
|
+
*
|
|
276
|
+
* @param seed The 32-bit seed; the same seed always yields the same stream.
|
|
277
|
+
* @returns The seeded generator.
|
|
278
|
+
* @example
|
|
279
|
+
* ```ts
|
|
280
|
+
* import { createRng } from '@libraz/libcantus';
|
|
281
|
+
* const rng = createRng(42);
|
|
282
|
+
* rng.next(); // deterministic float in [0, 1)
|
|
283
|
+
* rng.range(1, 6); // deterministic integer in [1, 6]
|
|
284
|
+
* ```
|
|
285
|
+
* @category Utilities
|
|
286
|
+
*/
|
|
287
|
+
declare function createRng(seed: number): Rng;
|
|
288
|
+
|
|
275
289
|
export { ALGORITHM_VERSION, BASS_4_STRING, BASS_5_STRING, DEFAULT_GENERATION_BUDGET, GUITAR_DROP_D, GUITAR_STANDARD, MIN_ALGORITHM_VERSION, MeterMap, NoteEvent, type NoteEventAssertOptions, type Rng, StringedProfile, TimeSignature, assertDegree, assertFiniteNumber, assertFiniteSemitones, assertGenerationBudget, assertInteger, assertMeterMap, assertMidiPitch, assertNoteEvent, assertNoteEvents, assertOneOf, assertPositiveInt, assertRange, assertTimeSignature, clampToMidi, createRng, dropSilentNotes, resolveAlgorithmVersion, soundingNotesOnly };
|
package/dist/core/index.js
CHANGED
|
@@ -23,10 +23,9 @@ import {
|
|
|
23
23
|
stepsOfCents,
|
|
24
24
|
tempoAt,
|
|
25
25
|
ticksToBeats
|
|
26
|
-
} from "../chunk-
|
|
26
|
+
} from "../chunk-HOHFYGKW.js";
|
|
27
27
|
import {
|
|
28
28
|
ALGORITHM_VERSION,
|
|
29
|
-
ARTICULATIONS,
|
|
30
29
|
BASS_4_STRING,
|
|
31
30
|
BASS_5_STRING,
|
|
32
31
|
GUITAR_DROP_D,
|
|
@@ -42,32 +41,15 @@ import {
|
|
|
42
41
|
includeAt,
|
|
43
42
|
instrumentRange,
|
|
44
43
|
playability,
|
|
45
|
-
resolveAlgorithmVersion
|
|
46
|
-
|
|
44
|
+
resolveAlgorithmVersion,
|
|
45
|
+
toInstrumentProfile,
|
|
46
|
+
toStringedProfile
|
|
47
|
+
} from "../chunk-X6RJAHII.js";
|
|
47
48
|
import {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
barPositionToPulse,
|
|
51
|
-
barStartBeat,
|
|
52
|
-
beatToBarPosition,
|
|
53
|
-
beatsPerBar,
|
|
54
|
-
beatsPerBarAt,
|
|
55
|
-
createNoteEventIndex,
|
|
56
|
-
formatBarPosition,
|
|
57
|
-
formatTimeSignature,
|
|
58
|
-
isCompound,
|
|
59
|
-
isStrongBeat,
|
|
60
|
-
meterAt,
|
|
61
|
-
metricWeight,
|
|
62
|
-
parseTimeSignature,
|
|
63
|
-
pulseBeats,
|
|
64
|
-
pulsesPerBar,
|
|
65
|
-
resolveMeters,
|
|
66
|
-
toMeterData,
|
|
67
|
-
tryParseTimeSignature,
|
|
68
|
-
tuplet
|
|
69
|
-
} from "../chunk-ELCTZUJJ.js";
|
|
49
|
+
createNoteEventIndex
|
|
50
|
+
} from "../chunk-7GOKQJTQ.js";
|
|
70
51
|
import {
|
|
52
|
+
ARTICULATIONS,
|
|
71
53
|
BudgetExceededError,
|
|
72
54
|
ConsonanceClass,
|
|
73
55
|
DEFAULT_GENERATION_BUDGET,
|
|
@@ -86,17 +68,30 @@ import {
|
|
|
86
68
|
assertPositiveInt,
|
|
87
69
|
assertRange,
|
|
88
70
|
assertTimeSignature,
|
|
71
|
+
barIndexAt,
|
|
72
|
+
barPositionToBeat,
|
|
73
|
+
barPositionToPulse,
|
|
74
|
+
barStartBeat,
|
|
75
|
+
beatToBarPosition,
|
|
76
|
+
beatsPerBar,
|
|
77
|
+
beatsPerBarAt,
|
|
89
78
|
clampToMidi,
|
|
90
79
|
classifyInterval,
|
|
91
80
|
detectNoteNameSystem,
|
|
92
81
|
diatonicLetterOf,
|
|
93
82
|
dropSilentNotes,
|
|
83
|
+
formatBarPosition,
|
|
94
84
|
formatKeyName,
|
|
95
85
|
formatNote,
|
|
86
|
+
formatTimeSignature,
|
|
96
87
|
intervalSemitones,
|
|
88
|
+
isCompound,
|
|
97
89
|
isConsonantInterval,
|
|
98
90
|
isLibcantusError,
|
|
99
91
|
isPerfectInterval,
|
|
92
|
+
isStrongBeat,
|
|
93
|
+
meterAt,
|
|
94
|
+
metricWeight,
|
|
100
95
|
midiToNote,
|
|
101
96
|
naturalPitchClassOf,
|
|
102
97
|
noteToMidi,
|
|
@@ -104,17 +99,24 @@ import {
|
|
|
104
99
|
parseInterval,
|
|
105
100
|
parseKeyName,
|
|
106
101
|
parseNote,
|
|
102
|
+
parseTimeSignature,
|
|
107
103
|
pitchClassOf,
|
|
104
|
+
pulseBeats,
|
|
105
|
+
pulsesPerBar,
|
|
106
|
+
resolveMeters,
|
|
108
107
|
soundingNotesOnly,
|
|
109
108
|
spelledInterval,
|
|
109
|
+
toMeterData,
|
|
110
110
|
toNoteData,
|
|
111
111
|
toSpelledInterval,
|
|
112
112
|
transposeByInterval,
|
|
113
113
|
transposeNote,
|
|
114
114
|
tryParseInterval,
|
|
115
115
|
tryParseKeyName,
|
|
116
|
-
tryParseNote
|
|
117
|
-
|
|
116
|
+
tryParseNote,
|
|
117
|
+
tryParseTimeSignature,
|
|
118
|
+
tuplet
|
|
119
|
+
} from "../chunk-PQL7E5F6.js";
|
|
118
120
|
export {
|
|
119
121
|
ALGORITHM_VERSION,
|
|
120
122
|
ARTICULATIONS,
|
|
@@ -214,9 +216,11 @@ export {
|
|
|
214
216
|
stepsOfCents,
|
|
215
217
|
tempoAt,
|
|
216
218
|
ticksToBeats,
|
|
219
|
+
toInstrumentProfile,
|
|
217
220
|
toMeterData,
|
|
218
221
|
toNoteData,
|
|
219
222
|
toSpelledInterval,
|
|
223
|
+
toStringedProfile,
|
|
220
224
|
transposeByInterval,
|
|
221
225
|
transposeNote,
|
|
222
226
|
tryParseInterval,
|