@tspro/web-music-score 4.0.0 → 4.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/CHANGELOG.md +19 -0
- package/README.md +18 -9
- package/dist/audio/index.d.mts +40 -1
- package/dist/audio/index.d.ts +40 -1
- package/dist/audio/index.js +1 -1
- package/dist/audio/index.mjs +2 -2
- package/dist/audio-cg/index.d.mts +3 -0
- package/dist/audio-cg/index.d.ts +3 -0
- package/dist/audio-cg/index.js +1 -1
- package/dist/audio-cg/index.mjs +2 -2
- package/dist/{chunk-D643HZHM.mjs → chunk-MHNTJ6FU.mjs} +2 -2
- package/dist/core/index.d.mts +12 -0
- package/dist/core/index.d.ts +12 -0
- package/dist/core/index.js +3 -2
- package/dist/core/index.mjs +4 -3
- package/dist/guitar-CaZJDA05.d.ts +35 -0
- package/dist/guitar-DdexKdN6.d.mts +35 -0
- package/dist/iife/index.global.js +11 -11
- package/dist/{interface-XoKiryoV.d.mts → music-objects-DIaqNPjs.d.mts} +616 -114
- package/dist/{interface-7k8qGG44.d.ts → music-objects-xJJNlFwK.d.ts} +616 -114
- package/dist/note-eA2xPPiG.d.mts +294 -0
- package/dist/note-eA2xPPiG.d.ts +294 -0
- package/dist/pieces/index.d.mts +22 -3
- package/dist/pieces/index.d.ts +22 -3
- package/dist/pieces/index.js +5 -2
- package/dist/pieces/index.mjs +6 -3
- package/dist/react-ui/index.d.mts +166 -17
- package/dist/react-ui/index.d.ts +166 -17
- package/dist/react-ui/index.js +78 -1
- package/dist/react-ui/index.mjs +79 -2
- package/dist/scale-DQNA-YLD.d.ts +230 -0
- package/dist/scale-bnD0WnMV.d.mts +230 -0
- package/dist/score/index.d.mts +315 -47
- package/dist/score/index.d.ts +315 -47
- package/dist/score/index.js +684 -173
- package/dist/score/index.mjs +683 -174
- package/dist/tempo-Bp1UzsrZ.d.ts +399 -0
- package/dist/tempo-S85Q7uJA.d.mts +399 -0
- package/dist/theory/index.d.mts +29 -13
- package/dist/theory/index.d.ts +29 -13
- package/dist/theory/index.js +433 -42
- package/dist/theory/index.mjs +432 -43
- package/package.json +3 -2
- package/dist/guitar-DggbM2UL.d.mts +0 -17
- package/dist/guitar-cNmE-EvH.d.ts +0 -17
- package/dist/note-BFa43I86.d.mts +0 -85
- package/dist/note-CcVdUFqS.d.ts +0 -85
- package/dist/scale-C2pCNxdE.d.mts +0 -75
- package/dist/scale-CvPbJvfN.d.ts +0 -75
- package/dist/tempo-BAYoZ_Li.d.mts +0 -187
- package/dist/tempo-r2sb6Ku2.d.ts +0 -187
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { N as Note, S as SymbolSet } from './note-eA2xPPiG.mjs';
|
|
2
|
+
import { K as KeySignature } from './tempo-S85Q7uJA.mjs';
|
|
3
|
+
|
|
4
|
+
/** Interval direction type. */
|
|
5
|
+
type IntervalDirection = "Unison" | "Ascending" | "Descending";
|
|
6
|
+
/** Interval quality type. */
|
|
7
|
+
type IntervalQuality = "Perfect" | "Major" | "minor" | "Augmented" | "Doubly Augmented" | "diminished" | "doubly diminished";
|
|
8
|
+
/**
|
|
9
|
+
* Validate interval quality of unkown value.
|
|
10
|
+
* @param q - Interval quality to validate.
|
|
11
|
+
* @returns - Interval quality if valid, else throws.
|
|
12
|
+
*/
|
|
13
|
+
declare function validateIntervalQuality(q: unknown): IntervalQuality;
|
|
14
|
+
/** Interval class. */
|
|
15
|
+
declare class Interval {
|
|
16
|
+
readonly note1: Note;
|
|
17
|
+
readonly note2: Note;
|
|
18
|
+
/** Interval direction. */
|
|
19
|
+
readonly direction: IntervalDirection;
|
|
20
|
+
/** Number of semitones. */
|
|
21
|
+
readonly semitones: number;
|
|
22
|
+
/** Interval quantity. */
|
|
23
|
+
readonly quantity: number;
|
|
24
|
+
/** Interval quality. */
|
|
25
|
+
readonly quality: IntervalQuality;
|
|
26
|
+
private constructor();
|
|
27
|
+
/**
|
|
28
|
+
* Get interval between given two notes.
|
|
29
|
+
* @param note1 - First note.
|
|
30
|
+
* @param note2 - Second note.
|
|
31
|
+
* @returns - Interval if valid, or undefined.
|
|
32
|
+
*/
|
|
33
|
+
static get(note1: Note, note2: Note): Interval | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Get string presentation of interval (e.g. "Descending Major 2").
|
|
36
|
+
* @returns - Interval string.
|
|
37
|
+
*/
|
|
38
|
+
toString(): string;
|
|
39
|
+
/**
|
|
40
|
+
* Get abbrevated string presentation of interval (e.g. "↓M2").
|
|
41
|
+
* @returns - Interval abbrevated string.
|
|
42
|
+
*/
|
|
43
|
+
toAbbrString(): string;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** Degree type. */
|
|
47
|
+
type Degree = 1 | 2 | "b3" | 3 | 4 | "b5" | 5 | "#5" | 6 | "bb7" | "b7" | 7 | "#7" | "b9" | 9 | "#9" | 11 | 13;
|
|
48
|
+
/** Scale type enum. */
|
|
49
|
+
declare enum ScaleType {
|
|
50
|
+
/** Major scale. */
|
|
51
|
+
Major = "Major",
|
|
52
|
+
/** Natural minor scale. */
|
|
53
|
+
NaturalMinor = "Natural Minor",
|
|
54
|
+
/** Harmonic minor scale. */
|
|
55
|
+
HarmonicMinor = "Harmonic Minor",
|
|
56
|
+
/** Mode: Ionian. */
|
|
57
|
+
Ionian = "Ionian",
|
|
58
|
+
/** Mode: Dorian. */
|
|
59
|
+
Dorian = "Dorian",
|
|
60
|
+
/** Mode: Phrygian. */
|
|
61
|
+
Phrygian = "Phrygian",
|
|
62
|
+
/** Mode: Lydian. */
|
|
63
|
+
Lydian = "Lydian",
|
|
64
|
+
/** Mode: Mixolydian. */
|
|
65
|
+
Mixolydian = "Mixolydian",
|
|
66
|
+
/** Mode: Aeolian (minor). */
|
|
67
|
+
Aeolian = "Aeolian",
|
|
68
|
+
/** Mode: Locrian (rare). */
|
|
69
|
+
Locrian = "Locrian",
|
|
70
|
+
/** Major pentatonic scale. */
|
|
71
|
+
MajorPentatonic = "Major Pentatonic",
|
|
72
|
+
/** Minor pentatoni scale. */
|
|
73
|
+
MinorPentatonic = "Minor Pentatonic",
|
|
74
|
+
/** Major hexatonic blues scale. */
|
|
75
|
+
MajorHexatonicBlues = "Major Hexatonic Blues",
|
|
76
|
+
/** Minor hexatonic blues scale. */
|
|
77
|
+
MinorHexatonicBlues = "Minor Hexatonic Blues",
|
|
78
|
+
/** Heptatonic blues scale. */
|
|
79
|
+
HeptatonicBlues = "Heptatonic Blues"
|
|
80
|
+
}
|
|
81
|
+
/** Scale class. */
|
|
82
|
+
declare class Scale extends KeySignature {
|
|
83
|
+
readonly tonic: string;
|
|
84
|
+
readonly scaleType: ScaleType;
|
|
85
|
+
/** Degrees of scale notes. */
|
|
86
|
+
private readonly scaleDegrees;
|
|
87
|
+
/** Scale notes. */
|
|
88
|
+
private readonly scaleNotes;
|
|
89
|
+
/** Degrees (or undefined) of chromatic classes. */
|
|
90
|
+
private readonly chromaticClassDegree;
|
|
91
|
+
/**
|
|
92
|
+
* Create nev scale object instance.
|
|
93
|
+
* @param tonic - Tonic (e.g. "C" in "C Major").
|
|
94
|
+
* @param scaleType - Scale typo ("e.g. "Major" in "C Major").
|
|
95
|
+
*/
|
|
96
|
+
constructor(tonic: string, scaleType: ScaleType);
|
|
97
|
+
/**
|
|
98
|
+
* Compare if two scales equals.
|
|
99
|
+
* @param a - Scale a.
|
|
100
|
+
* @param b - Scale b.
|
|
101
|
+
* @returns - Boolean equality of given scales.
|
|
102
|
+
*/
|
|
103
|
+
static equals(a: Scale | null | undefined, b: Scale | null | undefined): boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Get scale name.
|
|
106
|
+
* @param symbolSet - Symbol set to format scale name in ascii or unicode.
|
|
107
|
+
* @returns - Scale name string.
|
|
108
|
+
*/
|
|
109
|
+
getScaleName(symbolSet?: SymbolSet): string;
|
|
110
|
+
/**
|
|
111
|
+
* Get scale notes.
|
|
112
|
+
* @param bottomNote - Computed scale notes begin no lower than this note.
|
|
113
|
+
* @param numOctaves - How many octaves?
|
|
114
|
+
* @returns - Array of scale notes.
|
|
115
|
+
*/
|
|
116
|
+
getScaleNotes(bottomNote: string, numOctaves: number): ReadonlyArray<Note>;
|
|
117
|
+
/**
|
|
118
|
+
* Get scale overview (e.g. "C - D - E - F - G - A - B" for "C Major" scale).
|
|
119
|
+
* @returns - Scale overview string.
|
|
120
|
+
*/
|
|
121
|
+
getScaleOverview(): string;
|
|
122
|
+
/**
|
|
123
|
+
* Get scale steps, array of 1 (half step) and 2 (whole step), (e.g. [2, 2, 1, 2, 2, 2, 1] for Major scale).
|
|
124
|
+
* @returns - Array of scale steps.
|
|
125
|
+
*/
|
|
126
|
+
getScaleSteps(): number[];
|
|
127
|
+
/**
|
|
128
|
+
* Get scale steps string presentation, array of "H" (half step) and "W" (whole step), (e.g. ["W", "W", "H", "W", "W", "W", "H"] for Major scale).
|
|
129
|
+
* @returns - Array of scale steps string presentation.
|
|
130
|
+
*/
|
|
131
|
+
getScaleStringSteps(): string[];
|
|
132
|
+
/**
|
|
133
|
+
* Test if given note is scale note.
|
|
134
|
+
* @param note - Note to test.
|
|
135
|
+
* @returns - True/false.
|
|
136
|
+
*/
|
|
137
|
+
isScaleNote(note: Note): boolean;
|
|
138
|
+
/**
|
|
139
|
+
* Test if given note is scale root note.
|
|
140
|
+
* @param note - Note to test.
|
|
141
|
+
* @returns - True/false.
|
|
142
|
+
*/
|
|
143
|
+
isScaleRootNote(note: Note): boolean;
|
|
144
|
+
/**
|
|
145
|
+
* Get interval value between scale root note and given note.
|
|
146
|
+
* @param note - Note.
|
|
147
|
+
* @returns - Interval.
|
|
148
|
+
*/
|
|
149
|
+
getIntervalFromRootNote(note: Note): Interval;
|
|
150
|
+
private preferredChromaticNoteCache;
|
|
151
|
+
/**
|
|
152
|
+
* Get preferred chromatic note from given chromatic id.
|
|
153
|
+
* @param chromaticId - Chromatic id.
|
|
154
|
+
* @returns - Note.
|
|
155
|
+
*/
|
|
156
|
+
getPreferredChromaticNote(chromaticId: number): Note;
|
|
157
|
+
}
|
|
158
|
+
/** Scale factory class. */
|
|
159
|
+
declare class ScaleFactory {
|
|
160
|
+
readonly type: ScaleType;
|
|
161
|
+
private tonicList;
|
|
162
|
+
private scaleMap;
|
|
163
|
+
/**
|
|
164
|
+
* Create new scale factory object instance.
|
|
165
|
+
* @param type - Scale type.
|
|
166
|
+
*/
|
|
167
|
+
constructor(type: ScaleType);
|
|
168
|
+
/**
|
|
169
|
+
* Get list of tonics (e.g. "C", "C#", ... for Major scale type).
|
|
170
|
+
* @returns - Array of tonics.
|
|
171
|
+
*/
|
|
172
|
+
getTonicList(): ReadonlyArray<string>;
|
|
173
|
+
/**
|
|
174
|
+
* Get default tonic.
|
|
175
|
+
* @returns - Default tonic.
|
|
176
|
+
*/
|
|
177
|
+
getDefaultTonic(): string;
|
|
178
|
+
/**
|
|
179
|
+
* Get scale type.
|
|
180
|
+
* @returns - SCale type.
|
|
181
|
+
*/
|
|
182
|
+
getType(): ScaleType;
|
|
183
|
+
/**
|
|
184
|
+
* Get scale by given tonic.
|
|
185
|
+
* @param tonic - Tonic (e.g. "C").
|
|
186
|
+
* @returns - Scale.
|
|
187
|
+
*/
|
|
188
|
+
getScale(tonic: string): Scale;
|
|
189
|
+
/**
|
|
190
|
+
* Test if this scale factory has scale for given tonic value.
|
|
191
|
+
* @param tonic - Tonic.
|
|
192
|
+
* @returns - True/false.
|
|
193
|
+
*/
|
|
194
|
+
hasScale(tonic: string): boolean;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Get array of scale factories, has some title string between to category.
|
|
198
|
+
* @returns - Array of scale factories.
|
|
199
|
+
*/
|
|
200
|
+
declare function getScaleFactoryList(): ReadonlyArray<ScaleFactory | string>;
|
|
201
|
+
/**
|
|
202
|
+
* Get scale factory for given scale type.
|
|
203
|
+
* @param scaleType - Scale type.
|
|
204
|
+
* @returns - Scale factory.
|
|
205
|
+
*/
|
|
206
|
+
declare function getScaleFactory(scaleType: ScaleType | `${ScaleType}`): ScaleFactory;
|
|
207
|
+
/**
|
|
208
|
+
* Validate scale type.
|
|
209
|
+
* @param scaleType - Scale type of unknown value.
|
|
210
|
+
* @returns - Scale type if given argument was valid scale type, or throws.
|
|
211
|
+
*/
|
|
212
|
+
declare function validateScaleType(scaleType: unknown): ScaleType;
|
|
213
|
+
/**
|
|
214
|
+
* Get scale.
|
|
215
|
+
* @param tonic - Tonic (e.g. "C").
|
|
216
|
+
* @param scaleType - Scale type (e.g. "Major").
|
|
217
|
+
*/
|
|
218
|
+
declare function getScale(tonic: string, scaleType: ScaleType | `${ScaleType}`): Scale;
|
|
219
|
+
/**
|
|
220
|
+
* Get scale.
|
|
221
|
+
* @param scale - Scale name (e.g. "C Major").
|
|
222
|
+
*/
|
|
223
|
+
declare function getScale(scale: string): Scale;
|
|
224
|
+
/**
|
|
225
|
+
* Get default scale ("C Major").
|
|
226
|
+
* @returns - Default scale.
|
|
227
|
+
*/
|
|
228
|
+
declare function getDefaultScale(): Scale;
|
|
229
|
+
|
|
230
|
+
export { type Degree as D, type IntervalDirection as I, ScaleType as S, type IntervalQuality as a, Interval as b, Scale as c, ScaleFactory as d, getScaleFactory as e, validateScaleType as f, getScaleFactoryList as g, getScale as h, getDefaultScale as i, validateIntervalQuality as v };
|
package/dist/score/index.d.mts
CHANGED
|
@@ -1,63 +1,209 @@
|
|
|
1
|
-
import { N as NoteOptions, R as RestOptions, S as StaffPreset, a as ScoreConfiguration, M as MDocument, V as VoiceId, T as TupletOptions, F as Fermata, b as StaffTabOrGroups, c as Navigation, A as Annotation, L as Label, C as Connective,
|
|
2
|
-
export {
|
|
3
|
-
import { N as Note } from '../note-
|
|
4
|
-
import { S as ScaleType, c as Scale } from '../scale-
|
|
5
|
-
import { N as NoteLength,
|
|
1
|
+
import { N as NoteOptions, R as RestOptions, S as StaffPreset, a as ScoreConfiguration, M as MDocument, V as VoiceId, T as TupletOptions, F as Fermata, b as StaffTabOrGroups, c as Navigation, A as AnnotationText, d as Annotation, L as Label, C as Connective, e as TieType, f as NoteAnchor, g as VerticalPosition } from '../music-objects-DIaqNPjs.mjs';
|
|
2
|
+
export { a6 as Arpeggio, $ as Clef, D as DivRect, a8 as DynamicsAnnotation, q as MAccidental, s as MArpeggio, E as MBarLineLeft, B as MBarLineRight, t as MBeamGroup, r as MConnective, v as MEnding, _ as MExtensionLine, w as MFermata, x as MHeader, y as MImage, z as MMeasure, H as MNoteGroup, o as MPlaybackButtons, m as MPlayer, n as MRenderer, K as MRest, P as MRhythmColumn, Q as MScoreRow, X as MSignature, Y as MSpecialText, U as MStaff, u as MStaffBeamGroup, I as MStaffNoteGroup, O as MStaffRest, G as MStaffTabBarLine, W as MTab, J as MTabNoteGroup, Z as MText, p as MusicInterface, aa as PlayState, ab as PlayStateChangeListener, i as ScoreEvent, l as ScoreEventListener, h as ScoreEventType, k as ScoreObjectEvent, j as ScoreStaffPosEvent, a0 as StaffConfig, a7 as StaffTabOrGroup, a5 as Stem, a3 as StringNumber, a1 as TabConfig, a9 as TempoAnnotation, a4 as getStringNumbers, a2 as getVoiceIds } from '../music-objects-DIaqNPjs.mjs';
|
|
3
|
+
import { N as Note } from '../note-eA2xPPiG.mjs';
|
|
4
|
+
import { S as ScaleType, c as Scale } from '../scale-bnD0WnMV.mjs';
|
|
5
|
+
import { N as NoteLength, i as NoteLengthStr, K as KeySignature, b as TimeSignature, T as TimeSignatures, B as BeamGrouping, k as TupletRatio } from '../tempo-S85Q7uJA.mjs';
|
|
6
6
|
import '@tspro/ts-utils-lib';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
cresc = "cresc.",
|
|
10
|
-
decresc = "decresc.",
|
|
11
|
-
dim = "dim.",
|
|
12
|
-
ppp = "ppp",
|
|
13
|
-
pp = "pp",
|
|
14
|
-
p = "p",
|
|
15
|
-
mp = "mp",
|
|
16
|
-
m = "m",
|
|
17
|
-
mf = "mf",
|
|
18
|
-
f = "f",
|
|
19
|
-
ff = "ff",
|
|
20
|
-
fff = "fff"
|
|
21
|
-
}
|
|
22
|
-
declare enum TempoAnnotations {
|
|
23
|
-
accel = "accel.",
|
|
24
|
-
rit = "rit.",
|
|
25
|
-
a_tempo = "a tempo"
|
|
26
|
-
}
|
|
27
|
-
type AnnotationsType = `${DynamicsAnnotations}` | `${TempoAnnotations}`;
|
|
28
|
-
|
|
8
|
+
/** Tuplet builder type. */
|
|
29
9
|
type TupletBuilder = {
|
|
10
|
+
/**
|
|
11
|
+
* Add note to a tuplet.
|
|
12
|
+
* @param note - Note instance of Note or string (e.g. "D4").
|
|
13
|
+
* @param noteLength - Note length (e.g. "4n").
|
|
14
|
+
* @param options - Note options.
|
|
15
|
+
* @returns - This tuplet builder object.
|
|
16
|
+
*/
|
|
30
17
|
addNote: (note: Note | string, noteLength: NoteLength | NoteLengthStr, options?: NoteOptions) => TupletBuilder;
|
|
18
|
+
/**
|
|
19
|
+
* Add chord to a tuplet.
|
|
20
|
+
* @param notes - Array of notes, each instance of Note or string (e.g. "D4").
|
|
21
|
+
* @param noteLength - Note length (e.g. "4n").
|
|
22
|
+
* @param options - Note options.
|
|
23
|
+
* @returns - This tuplet builder object.
|
|
24
|
+
*/
|
|
31
25
|
addChord: (notes: (Note | string)[], noteLength: NoteLength | NoteLengthStr, options?: NoteOptions) => TupletBuilder;
|
|
26
|
+
/**
|
|
27
|
+
* Add rest to a tuplet.
|
|
28
|
+
* @param restLength - Rest length (e.g. "4n").
|
|
29
|
+
* @param options - Rest options.
|
|
30
|
+
* @returns - This tuplet builder object.
|
|
31
|
+
*/
|
|
32
32
|
addRest: (restLength: NoteLength | NoteLengthStr, options?: RestOptions) => TupletBuilder;
|
|
33
33
|
};
|
|
34
|
+
/** Etension builder type. */
|
|
34
35
|
type ExtensionBuilder = {
|
|
36
|
+
/**
|
|
37
|
+
* Increase extension length by note length multiplied by number of notes.
|
|
38
|
+
* @param noteLength - Length of note (e.g. "2n").
|
|
39
|
+
* @param noteCount - Number of note lengths (default = 1).
|
|
40
|
+
* @returns - this extension builder object.
|
|
41
|
+
*/
|
|
35
42
|
notes: (noteLength: NoteLength | NoteLengthStr, noteCount?: number) => ExtensionBuilder;
|
|
43
|
+
/**
|
|
44
|
+
* Increase length of extension length by given number of measures.
|
|
45
|
+
* @param measureCount - Number of measures.
|
|
46
|
+
* @returns - this extension builder object.
|
|
47
|
+
*/
|
|
36
48
|
measures: (measureCount: number) => ExtensionBuilder;
|
|
49
|
+
/**
|
|
50
|
+
* Create as long extension line as possible.
|
|
51
|
+
* @returns - this extension builder object.
|
|
52
|
+
*/
|
|
37
53
|
infinity: () => ExtensionBuilder;
|
|
54
|
+
/**
|
|
55
|
+
* Create an invisible extension.
|
|
56
|
+
* @returns - this extension builder object.
|
|
57
|
+
*/
|
|
38
58
|
hide: () => ExtensionBuilder;
|
|
39
59
|
};
|
|
60
|
+
/**
|
|
61
|
+
* Document builder class.
|
|
62
|
+
* <pre>
|
|
63
|
+
* // Example
|
|
64
|
+
* let doc = new Score.DocumentBuilder()
|
|
65
|
+
* .addScoreConfiguration({ type: "staff", clef: "G", isOctavewDown: true })
|
|
66
|
+
* .setMeasuresPerRow(4)
|
|
67
|
+
* .addMeasure()
|
|
68
|
+
* .addNote(1, "C3", "4n")
|
|
69
|
+
* .addChord(1, ["C3", "E3", "G3"], "4n").addLabel("chord", "C")
|
|
70
|
+
* .addRest(1, "4n")
|
|
71
|
+
* // etc.
|
|
72
|
+
* .getDEocument();
|
|
73
|
+
* </pre>
|
|
74
|
+
*/
|
|
40
75
|
declare class DocumentBuilder {
|
|
41
76
|
private readonly doc;
|
|
77
|
+
/**
|
|
78
|
+
* Create new document builder instance.
|
|
79
|
+
*/
|
|
42
80
|
constructor();
|
|
81
|
+
/**
|
|
82
|
+
* Use staff preset values to set score confguration. This call will request new score row.
|
|
83
|
+
* @param staffPreset - Staff preset (e.g. "treble").
|
|
84
|
+
*/
|
|
43
85
|
setScoreConfiguration(staffPreset: StaffPreset | `${StaffPreset}`): DocumentBuilder;
|
|
86
|
+
/**
|
|
87
|
+
* Use staff preset values to set score confguration. This call will request new score row.
|
|
88
|
+
* @param config - Score configuration (e.g. { type: "staff", clef: "G", isOctavewDown: true }).
|
|
89
|
+
*/
|
|
44
90
|
setScoreConfiguration(config: ScoreConfiguration): DocumentBuilder;
|
|
45
91
|
private getMeasure;
|
|
92
|
+
/**
|
|
93
|
+
* Get music document after finished building.
|
|
94
|
+
* @returns - Music document.
|
|
95
|
+
*/
|
|
46
96
|
getDocument(): MDocument;
|
|
97
|
+
/**
|
|
98
|
+
* Set header texts.
|
|
99
|
+
* @param title - Title of this docmument/musical piece.
|
|
100
|
+
* @param composer - Composer of this document/musical piece.
|
|
101
|
+
* @param arranger - Arranger of this document/musical piece.
|
|
102
|
+
* @returns - This document builder instance.
|
|
103
|
+
*/
|
|
47
104
|
setHeader(title?: string, composer?: string, arranger?: string): DocumentBuilder;
|
|
105
|
+
/**
|
|
106
|
+
* Automatically limit number of measures per score row.
|
|
107
|
+
* @param measuresPerRow - Number of measures per row. Must be integer >=1 or Infinity.
|
|
108
|
+
* @returns - This document builder instance.
|
|
109
|
+
*/
|
|
48
110
|
setMeasuresPerRow(measuresPerRow: number): DocumentBuilder;
|
|
111
|
+
/**
|
|
112
|
+
* Add new measure.
|
|
113
|
+
* @returns - This document builder instance.
|
|
114
|
+
*/
|
|
49
115
|
addMeasure(): DocumentBuilder;
|
|
116
|
+
/**
|
|
117
|
+
* Set key signature for current measure and forward.
|
|
118
|
+
* @param tonic - Tonic note (e.g. "C").
|
|
119
|
+
* @param scaleType - Scale type (e.g. string "Major" or ScaleType.Major).
|
|
120
|
+
* @returns - This document builder instance.
|
|
121
|
+
*/
|
|
50
122
|
setKeySignature(tonic: string, scaleType: ScaleType | `${ScaleType}`): DocumentBuilder;
|
|
123
|
+
/**
|
|
124
|
+
* Set key signature for current measure and forward.
|
|
125
|
+
* @param keySignature - KeySignature object instance.
|
|
126
|
+
* @returns - This document builder instance.
|
|
127
|
+
*/
|
|
51
128
|
setKeySignature(keySignature: KeySignature): DocumentBuilder;
|
|
129
|
+
/**
|
|
130
|
+
* Set key signature for current measure and forward.
|
|
131
|
+
* @param keySignature - Key signature string (e.g. "C Major").
|
|
132
|
+
* @returns - This document builder instance.
|
|
133
|
+
*/
|
|
52
134
|
setKeySignature(keySignature: string): DocumentBuilder;
|
|
135
|
+
/**
|
|
136
|
+
* Set key signature for current measure and forward.
|
|
137
|
+
* @param scale - Scale object instance.
|
|
138
|
+
* @returns - This document builder instance.
|
|
139
|
+
*/
|
|
53
140
|
setKeySignature(scale: Scale): DocumentBuilder;
|
|
54
|
-
|
|
141
|
+
/**
|
|
142
|
+
* Set time signature for current measure and forward.
|
|
143
|
+
* @param timeSignature - TimeSignature object instance.
|
|
144
|
+
* @returns - This document builder instance.
|
|
145
|
+
*/
|
|
146
|
+
setTimeSignature(timeSignature: TimeSignature): DocumentBuilder;
|
|
147
|
+
/**
|
|
148
|
+
* Set time signature for current measure and forward.
|
|
149
|
+
* @param timeSignature - TimeSignatures enum value or string (e.g. "3/4").
|
|
150
|
+
* @param beamGrouping - Beam grouping (e.g. "3-2" for time signature "5/8").
|
|
151
|
+
* @returns - This document builder instance.
|
|
152
|
+
*/
|
|
153
|
+
setTimeSignature(timeSignature: TimeSignatures | `${TimeSignatures}`, beamGrouping?: BeamGrouping | `${BeamGrouping}`): DocumentBuilder;
|
|
154
|
+
/**
|
|
155
|
+
* Set time signature for current measure and forward.
|
|
156
|
+
* @param beatCount - Beat count of time signature (e.g. 3 in "3/4").
|
|
157
|
+
* @param beatSize - Beat size of time signature (e.g. 4 in "3/4").
|
|
158
|
+
* @param beamGrouping - Beam grouping (e.g. "3-2" for time signature "5/8").
|
|
159
|
+
* @returns - This document builder instance.
|
|
160
|
+
*/
|
|
161
|
+
setTimeSignature(beatCount: number, beatSize: number, beamGrouping?: BeamGrouping | `${BeamGrouping}`): DocumentBuilder;
|
|
162
|
+
/**
|
|
163
|
+
* Set tempo.
|
|
164
|
+
* @param beatsPerMinute - Tempo beats per minute.
|
|
165
|
+
* @returns - This document builder instance.
|
|
166
|
+
*/
|
|
55
167
|
setTempo(beatsPerMinute: number): DocumentBuilder;
|
|
168
|
+
/**
|
|
169
|
+
* Set tempo.
|
|
170
|
+
* @param beatsPerMinute - Tempo beats per minute.
|
|
171
|
+
* @param beatLength - Length of one beat.
|
|
172
|
+
* @returns - This document builder instance.
|
|
173
|
+
*/
|
|
56
174
|
setTempo(beatsPerMinute: number, beatLength: NoteLength | NoteLengthStr): DocumentBuilder;
|
|
57
|
-
/**
|
|
175
|
+
/**
|
|
176
|
+
* @deprecated - Use dotted beatLength instead (e.g. "4..").
|
|
177
|
+
* @param beatsPerMinute - Tempo beats per minute.
|
|
178
|
+
* @param beatLength - Length of one beat.
|
|
179
|
+
* @param dotted - Dot count of length of one beat.
|
|
180
|
+
* @returns - This document builder instance.
|
|
181
|
+
*/
|
|
58
182
|
setTempo(beatsPerMinute: number, beatLength: NoteLength | NoteLengthStr, dotted: boolean | number): DocumentBuilder;
|
|
183
|
+
/**
|
|
184
|
+
* Add note o current measure.
|
|
185
|
+
* @param voiceId - Voice id to add note to.
|
|
186
|
+
* @param note - Note instance of Note or string (e.g. "D4").
|
|
187
|
+
* @param noteLength - Note length (e.g. "4n").
|
|
188
|
+
* @param options - Note options.
|
|
189
|
+
* @returns - This document builder instance.
|
|
190
|
+
*/
|
|
59
191
|
addNote(voiceId: number, note: Note | string, noteLength: NoteLength | NoteLengthStr, options?: NoteOptions): DocumentBuilder;
|
|
192
|
+
/**
|
|
193
|
+
* @param voiceId - Voice id to add chord to.
|
|
194
|
+
* @param notes - Array of notes, each instance of Note or string (e.g. "D4").
|
|
195
|
+
* @param noteLength - Note length (e.g. "4n").
|
|
196
|
+
* @param options - Note options.
|
|
197
|
+
* @returns - This document builder instance.
|
|
198
|
+
*/
|
|
60
199
|
addChord(voiceId: number, notes: (Note | string)[], noteLength: NoteLength | NoteLengthStr, options?: NoteOptions): DocumentBuilder;
|
|
200
|
+
/**
|
|
201
|
+
*
|
|
202
|
+
* @param voiceId - Voice id to add rest to.
|
|
203
|
+
* @param restLength - Rest length (e.g. "4n").
|
|
204
|
+
* @param options - Rest options.
|
|
205
|
+
* @returns - This document builder instance.
|
|
206
|
+
*/
|
|
61
207
|
addRest(voiceId: number, restLength: NoteLength | NoteLengthStr, options?: RestOptions): DocumentBuilder;
|
|
62
208
|
/**
|
|
63
209
|
* Usage:
|
|
@@ -69,66 +215,188 @@ declare class DocumentBuilder {
|
|
|
69
215
|
* });
|
|
70
216
|
* </pre>
|
|
71
217
|
*
|
|
72
|
-
* @param voiceId
|
|
218
|
+
* @param voiceId - Voice id to add tuplet to.
|
|
73
219
|
* @param tupletRatio - You can also use Theory.Tuplet presets (e.g. Theory.Tuplet.Triplet).
|
|
74
|
-
* @param tupletBuilder
|
|
75
|
-
* @returns
|
|
220
|
+
* @param tupletBuilder - Tuplet builder function to build tuplet.
|
|
221
|
+
* @returns - This document builder instance.
|
|
76
222
|
*/
|
|
77
223
|
addTuplet(voiceId: VoiceId, tupletRatio: TupletRatio & TupletOptions, tupletBuilder: (notes: TupletBuilder) => void): DocumentBuilder;
|
|
78
224
|
private addFermataInternal;
|
|
225
|
+
/**
|
|
226
|
+
* Add fermata to current measure.
|
|
227
|
+
* @param fermata - Fermata type (e.g. "atNote" or Fermata.AtrNote).
|
|
228
|
+
* @returns - This document builder instance.
|
|
229
|
+
*/
|
|
79
230
|
addFermata(fermata?: Fermata | `${Fermata}`): DocumentBuilder;
|
|
80
|
-
/**
|
|
231
|
+
/**
|
|
232
|
+
* Add Fermata to current measure to given staff/tab/group.
|
|
233
|
+
* @param staffTabOrGroups - staff/tab index (0=top), staff/tab name, or staff group name.
|
|
234
|
+
* @param fermata - Fermata type (e.g. "atNote" or Fermata.AtrNote).
|
|
235
|
+
* @returns - This document builder instance.
|
|
236
|
+
*/
|
|
81
237
|
addFermataTo(staffTabOrGroups: StaffTabOrGroups, fermata?: Fermata | `${Fermata}`): DocumentBuilder;
|
|
82
238
|
private addNavigationInternal;
|
|
239
|
+
/**
|
|
240
|
+
* Add navigation element to current measure.
|
|
241
|
+
* @param navigation - Navigation element (e.g. "D.S. al Fine" or Navigation.DS_al_Fine).
|
|
242
|
+
* @returns - This document builder instance.
|
|
243
|
+
*/
|
|
83
244
|
addNavigation(navigation: Navigation | `${Navigation}`): DocumentBuilder;
|
|
245
|
+
/**
|
|
246
|
+
* Add end repeat navigation element to current measure.
|
|
247
|
+
* @param navigation - End repeat navigation element ("endRepeat" or Navigation.EndRepeat).
|
|
248
|
+
* @param playCount - Number of times to play the ended repeat section.
|
|
249
|
+
* @returns - This document builder instance.
|
|
250
|
+
*/
|
|
84
251
|
addNavigation(navigation: Navigation.EndRepeat | `${Navigation.EndRepeat}`, playCount: number): DocumentBuilder;
|
|
252
|
+
/**
|
|
253
|
+
* Add ending navigation element to current measure.
|
|
254
|
+
* @param navigation - Ending navigation element ("ending" or Navigation.Ending).
|
|
255
|
+
* @param passages - Passage numbers for measure marked by this ending is played.
|
|
256
|
+
* @returns - This document builder instance.
|
|
257
|
+
*/
|
|
85
258
|
addNavigation(navigation: Navigation.Ending | `${Navigation.Ending}`, ...passages: number[]): DocumentBuilder;
|
|
86
|
-
/**
|
|
259
|
+
/**
|
|
260
|
+
* Add navigation element to current measure to given staff/tab/group.
|
|
261
|
+
* @param staffTabOrGroups - staff/tab index (0=top), staff/tab name, or staff group name.
|
|
262
|
+
* @param navigation
|
|
263
|
+
* @returns - This document builder instance.
|
|
264
|
+
*/
|
|
87
265
|
addNavigationTo(staffTabOrGroups: StaffTabOrGroups, navigation: Navigation | `${Navigation}`): DocumentBuilder;
|
|
88
|
-
/**
|
|
266
|
+
/**
|
|
267
|
+
* Add end repeat navigation element to current measure to given staff/tab/group.
|
|
268
|
+
* @param staffTabOrGroups - staff/tab index (0=top), staff/tab name, or staff group name.
|
|
269
|
+
* @param navigation
|
|
270
|
+
* @param playCount
|
|
271
|
+
* @returns - This document builder instance.
|
|
272
|
+
*/
|
|
89
273
|
addNavigationTo(staffTabOrGroups: StaffTabOrGroups, navigation: Navigation.EndRepeat | `${Navigation.EndRepeat}`, playCount: number): DocumentBuilder;
|
|
90
|
-
/**
|
|
274
|
+
/**
|
|
275
|
+
* Add ending navigation element to current measure to given staff/tab/group.
|
|
276
|
+
* @param staffTabOrGroups - staff/tab index (0=top), staff/tab name, or staff group name.
|
|
277
|
+
* @param navigation
|
|
278
|
+
* @param passages
|
|
279
|
+
* @returns - This document builder instance.
|
|
280
|
+
*/
|
|
91
281
|
addNavigationTo(staffTabOrGroups: StaffTabOrGroups, navigation: Navigation.Ending | `${Navigation.Ending}`, ...passages: number[]): DocumentBuilder;
|
|
92
282
|
private addAnnotationInternal;
|
|
93
|
-
|
|
283
|
+
/**
|
|
284
|
+
* Add annotation text to column of last added note/chord/rest in current measure.
|
|
285
|
+
* @param text - Known annotation text (e.g. "pp").
|
|
286
|
+
* @returns - This document builder instance.
|
|
287
|
+
*/
|
|
288
|
+
addAnnotation(text: AnnotationText): DocumentBuilder;
|
|
289
|
+
/**
|
|
290
|
+
* Add annotation text to column of last added note/chord/rest in current measure.
|
|
291
|
+
* @param annotation - Annotation type (e.g. "tempo" or Annotation.Tempo).
|
|
292
|
+
* @param text - Annotation text (unrestricted).
|
|
293
|
+
* @returns - This document builder instance.
|
|
294
|
+
*/
|
|
94
295
|
addAnnotation(annotation: Annotation | `${Annotation}`, text: string): DocumentBuilder;
|
|
95
|
-
/**
|
|
96
|
-
|
|
97
|
-
|
|
296
|
+
/**
|
|
297
|
+
* Add annotation text to column of last added note/chord/rest in current measure to given staff/tab/group.
|
|
298
|
+
* @param staffTabOrGroups - staff/tab index (0=top), staff/tab name, or staff group name.
|
|
299
|
+
* @param text - Known annotation text (e.g. "pp").
|
|
300
|
+
* @returns - This document builder instance.
|
|
301
|
+
*/
|
|
302
|
+
addAnnotationTo(staffTabOrGroups: StaffTabOrGroups, text: AnnotationText): DocumentBuilder;
|
|
303
|
+
/**
|
|
304
|
+
* Add annotation text to column of last added note/chord/rest in current measure to given staff/tab/group.
|
|
305
|
+
* @param staffTabOrGroups - staff/tab index (0=top), staff/tab name, or staff group name.
|
|
306
|
+
* @param annotation - Annotation type (e.g. "tempo" or Annotation.Tempo).
|
|
307
|
+
* @param text - Annotation text (unrestricted).
|
|
308
|
+
* @returns - This document builder instance.
|
|
309
|
+
*/
|
|
98
310
|
addAnnotationTo(staffTabOrGroups: StaffTabOrGroups, annotation: Annotation | `${Annotation}`, text: string): DocumentBuilder;
|
|
99
311
|
private addLabelInternal;
|
|
312
|
+
/**
|
|
313
|
+
* Add label text to column of last added note/chord/rest in current measure.
|
|
314
|
+
* @param label - Label type (e.g. "chord" or Label.Chord).
|
|
315
|
+
* @param text - label text (e.g. "Am").
|
|
316
|
+
* @returns - This document builder instance.
|
|
317
|
+
*/
|
|
100
318
|
addLabel(label: Label | `${Label}`, text: string): DocumentBuilder;
|
|
101
|
-
/**
|
|
319
|
+
/**
|
|
320
|
+
* Add label text to column of last added note/chord/rest in current measure to given staff/tab/group.
|
|
321
|
+
* @param staffTabOrGroups - staff/tab index (0=top), staff/tab name, or staff group name.
|
|
322
|
+
* @param label - Label type (e.g. "chord" or Label.Chord).
|
|
323
|
+
* @param text - label text (e.g. "Am").
|
|
324
|
+
* @returns - This document builder instance.
|
|
325
|
+
*/
|
|
102
326
|
addLabelTo(staffTabOrGroups: StaffTabOrGroups, label: Label | `${Label}`, text: string): DocumentBuilder;
|
|
327
|
+
/**
|
|
328
|
+
* Add tie starting from last added note/chord.
|
|
329
|
+
* @param connective - Connective type ("tie" or Connective.Tie).
|
|
330
|
+
* @param tieSpan - How many notes across this tie spans.
|
|
331
|
+
* @param notAnchor - Anchor point for note and this tie.
|
|
332
|
+
* @returns - This document builder instance.
|
|
333
|
+
*/
|
|
103
334
|
addConnective(connective: Connective.Tie | `${Connective.Tie}`, tieSpan?: number | TieType | `${TieType}`, notAnchor?: NoteAnchor | `${NoteAnchor}`): DocumentBuilder;
|
|
335
|
+
/**
|
|
336
|
+
* Add slur starting from last added note/chord.
|
|
337
|
+
* @param connective - Connective type ("slur" or Connective.Slur).
|
|
338
|
+
* @param slurSpan - How many notes across this slur spans.
|
|
339
|
+
* @param notAnchor - Anchor point for note and this slur.
|
|
340
|
+
* @returns - This document builder instance.
|
|
341
|
+
*/
|
|
104
342
|
addConnective(connective: Connective.Slur | `${Connective.Slur}`, slurSpan?: number, notAnchor?: NoteAnchor | `${NoteAnchor}`): DocumentBuilder;
|
|
343
|
+
/**
|
|
344
|
+
* Add slide starting from last added note/chord.
|
|
345
|
+
* @param connective - Connective type ("slide" or Connective.Slide).
|
|
346
|
+
* @param notAnchor - Anchor point for note and this slide.
|
|
347
|
+
* @returns - This document builder instance.
|
|
348
|
+
*/
|
|
105
349
|
addConnective(connective: Connective.Slide | `${Connective.Slide}`, notAnchor?: NoteAnchor | `${NoteAnchor}`): DocumentBuilder;
|
|
106
350
|
/**
|
|
107
|
-
*
|
|
351
|
+
* Add extension line to previously added annotation or label element.
|
|
108
352
|
* <pre>
|
|
353
|
+
* // Example
|
|
109
354
|
* addExtension(ext => ext.notes("1n", 2)) // length is 2 whole notes
|
|
110
355
|
* addExtension(ext => ext.measures(3).hide()) // length is 3 measures, hidden
|
|
111
356
|
* addExtension(ext => ext.measures(1).notes("8n")) // length is 1 measure + 1 eigth note
|
|
112
357
|
* addExtension(ext => ext.infinity()) // length is as long as possible
|
|
113
358
|
* </pre>
|
|
114
|
-
* @param
|
|
115
|
-
* @
|
|
116
|
-
* @returns
|
|
359
|
+
* @param extensionBuilder - Extension builder function used to build exstension.
|
|
360
|
+
* @returns - This document builder instance.
|
|
117
361
|
*/
|
|
118
362
|
addExtension(extensionBuilder?: (ext: ExtensionBuilder) => void): DocumentBuilder;
|
|
119
363
|
/**
|
|
120
|
-
*
|
|
364
|
+
* Add staff group.
|
|
121
365
|
* @param groupName - Name of staff group.
|
|
122
366
|
* @param staffsTabsAndGroups - staff/tab index (0=top), staff/tab name, or staff group name. Single value or array.
|
|
123
367
|
* @param verticalPosition - Vertical position, are elements added above, below or both.
|
|
124
|
-
* @returns
|
|
368
|
+
* @returns - This document builder instance.
|
|
125
369
|
*/
|
|
126
370
|
addStaffGroup(groupName: string, staffsTabsAndGroups: number | string | (number | string)[], verticalPosition?: VerticalPosition | `${VerticalPosition}`): DocumentBuilder;
|
|
371
|
+
/**
|
|
372
|
+
* Add song end. Adds certain bar line at the end of measure.
|
|
373
|
+
* @returns - This document builder instance.
|
|
374
|
+
*/
|
|
127
375
|
endSong(): DocumentBuilder;
|
|
376
|
+
/**
|
|
377
|
+
* Add section end. Adds certain bar line at the end of measure.
|
|
378
|
+
* @returns - This document builder instance.
|
|
379
|
+
*/
|
|
128
380
|
endSection(): DocumentBuilder;
|
|
381
|
+
/**
|
|
382
|
+
* End current score row. Next measure will start new row.
|
|
383
|
+
* @returns - This document builder instance.
|
|
384
|
+
*/
|
|
129
385
|
endRow(): DocumentBuilder;
|
|
386
|
+
/**
|
|
387
|
+
* Add rests to fill current measure.
|
|
388
|
+
* @param voiceId - Voice id to add rests to. Single value, array or all if omitted.
|
|
389
|
+
* @returns - This document builder instance.
|
|
390
|
+
*/
|
|
130
391
|
completeRests(voiceId?: VoiceId | VoiceId[]): DocumentBuilder;
|
|
392
|
+
/**
|
|
393
|
+
* Add notes of given scale in ascending order.
|
|
394
|
+
* @param scale - Scale.
|
|
395
|
+
* @param bottomNote - Scale starts from note >= bottom note.
|
|
396
|
+
* @param numOctaves - Number of octaves to add.
|
|
397
|
+
* @returns - This document builder instance.
|
|
398
|
+
*/
|
|
131
399
|
addScaleArpeggio(scale: Scale, bottomNote: string, numOctaves: number): DocumentBuilder;
|
|
132
400
|
}
|
|
133
401
|
|
|
134
|
-
export { Annotation, Connective, DocumentBuilder, type ExtensionBuilder, Fermata, Label, MDocument, Navigation, NoteAnchor, NoteOptions, RestOptions, ScoreConfiguration, StaffPreset, StaffTabOrGroups, TieType, type TupletBuilder, TupletOptions, VerticalPosition, VoiceId };
|
|
402
|
+
export { Annotation, AnnotationText, Connective, DocumentBuilder, type ExtensionBuilder, Fermata, Label, MDocument, Navigation, NoteAnchor, NoteOptions, RestOptions, ScoreConfiguration, StaffPreset, StaffTabOrGroups, TieType, type TupletBuilder, TupletOptions, VerticalPosition, VoiceId };
|