@tspro/web-music-score 4.0.0 → 4.0.1
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 +12 -0
- package/README.md +1 -1
- 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-YFPLOHP2.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-DJQ4d2OA.d.mts} +549 -53
- package/dist/{interface-7k8qGG44.d.ts → music-objects-Dc3kR-XF.d.ts} +549 -53
- 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-B2Icbetz.d.ts +230 -0
- package/dist/scale-BbDJTbrG.d.mts +230 -0
- package/dist/score/index.d.mts +299 -46
- package/dist/score/index.d.ts +299 -46
- package/dist/score/index.js +553 -76
- package/dist/score/index.mjs +550 -75
- package/dist/{tempo-BAYoZ_Li.d.mts → tempo-CtUhvJbr.d.mts} +187 -5
- package/dist/{tempo-r2sb6Ku2.d.ts → tempo-Dt8aHpol.d.ts} +187 -5
- package/dist/theory/index.d.mts +29 -13
- package/dist/theory/index.d.ts +29 -13
- package/dist/theory/index.js +369 -25
- package/dist/theory/index.mjs +370 -26
- package/package.json +1 -1
- 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
|
@@ -1,19 +1,35 @@
|
|
|
1
|
-
import { N as Note, A as Accidental } from './note-
|
|
1
|
+
import { N as Note, A as Accidental } from './note-eA2xPPiG.mjs';
|
|
2
2
|
|
|
3
|
+
/** Mode enum. */
|
|
3
4
|
declare enum Mode {
|
|
5
|
+
/** Mode 1: Ionian (Major). */
|
|
4
6
|
Ionian = 1,
|
|
7
|
+
/** Mode 2: Dorian. */
|
|
5
8
|
Dorian = 2,
|
|
9
|
+
/** Mode 3: Phrygian. */
|
|
6
10
|
Phrygian = 3,
|
|
11
|
+
/** Mode 4: Lydian. */
|
|
7
12
|
Lydian = 4,
|
|
13
|
+
/** Mode 5: Mixolydian. */
|
|
8
14
|
Mixolydian = 5,
|
|
15
|
+
/** Mode 6: Aeolian (minor). */
|
|
9
16
|
Aeolian = 6,
|
|
17
|
+
/** Mode 7: Locrian. */
|
|
10
18
|
Locrian = 7
|
|
11
19
|
}
|
|
20
|
+
/** Accidental type enum. */
|
|
12
21
|
declare enum AccidentalType {
|
|
22
|
+
/** Natural type has no accidentals. */
|
|
13
23
|
Natural = 0,
|
|
24
|
+
/** Flats type has one or more flats. */
|
|
14
25
|
Flats = 1,
|
|
26
|
+
/** Sharps type has one or more sharps. */
|
|
15
27
|
Sharps = 2
|
|
16
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Get default key signature (key signature of "C Major" scale).
|
|
31
|
+
* @returns - Default key signature.
|
|
32
|
+
*/
|
|
17
33
|
declare function getDefaultKeySignature(): KeySignature;
|
|
18
34
|
declare class KeySignature {
|
|
19
35
|
readonly tonic: string;
|
|
@@ -28,74 +44,168 @@ declare class KeySignature {
|
|
|
28
44
|
* @param mode - Mode: Ionian/Major = 1, Dorian = 2, ..., Locrian = 7
|
|
29
45
|
*/
|
|
30
46
|
protected constructor(tonic: string, mode: Mode);
|
|
47
|
+
/**
|
|
48
|
+
* Get accidental type sharps, flats, or natural (without accidentals).
|
|
49
|
+
* @returns - Accidental type.
|
|
50
|
+
*/
|
|
31
51
|
getAccidentalType(): AccidentalType;
|
|
52
|
+
/**
|
|
53
|
+
* Get natural scale notes of this key signature, natural scale has 7 steps (e.g. Major scale: W, W, H, W, W, W, H).
|
|
54
|
+
* @returns - Array of notes.
|
|
55
|
+
*/
|
|
32
56
|
getNaturalScaleNotes(): ReadonlyArray<Note>;
|
|
57
|
+
/**
|
|
58
|
+
* Get accidental for given diatonic id.
|
|
59
|
+
* @param diatonicId - Diatonic id.
|
|
60
|
+
* @returns - Accidental -2, -1, 0, 1 or 2.
|
|
61
|
+
*/
|
|
33
62
|
getAccidental(diatonicId: number): Accidental;
|
|
63
|
+
/**
|
|
64
|
+
* Get number of accidentals this key signature has.
|
|
65
|
+
* @returns - Number of accidentals.
|
|
66
|
+
*/
|
|
34
67
|
getNumAccidentals(): number;
|
|
68
|
+
/**
|
|
69
|
+
* Get accidental notes in correct order.
|
|
70
|
+
* @returns - Array of accidental notes.
|
|
71
|
+
*/
|
|
35
72
|
getOrderedAccidentalNotes(): ReadonlyArray<Note>;
|
|
36
73
|
/**
|
|
37
|
-
*
|
|
38
|
-
* @param degree - number 1
|
|
39
|
-
* @returns
|
|
74
|
+
* Get note of key signature by degree value.
|
|
75
|
+
* @param degree - Degree number in range [1, 7] or string e.g "b5" or "#4".
|
|
76
|
+
* @returns - Note.
|
|
40
77
|
*/
|
|
41
78
|
getNoteByDegree(degree: number | string): Note;
|
|
79
|
+
/**
|
|
80
|
+
* Test equality of given key signatures.
|
|
81
|
+
* @param a - Key signature a.
|
|
82
|
+
* @param b - Key signature b.
|
|
83
|
+
* @returns - True/false.
|
|
84
|
+
*/
|
|
42
85
|
static equals(a: KeySignature | null | undefined, b: KeySignature | null | undefined): boolean;
|
|
43
86
|
}
|
|
44
87
|
|
|
88
|
+
/** Note length enum. */
|
|
45
89
|
declare enum NoteLength {
|
|
90
|
+
/** Whole note. */
|
|
46
91
|
Whole = "1n",
|
|
92
|
+
/** Whole note creating a triplet. */
|
|
47
93
|
WholeTriplet = "1t",
|
|
94
|
+
/** Dotted whole note. */
|
|
48
95
|
WholeDot = "1.",
|
|
96
|
+
/** Double dotted whole note. */
|
|
97
|
+
Whole2Dots = "1..",
|
|
98
|
+
/** @deprecated - Use Whole2Dots instead. Accidentally had misspelled enum name! */
|
|
49
99
|
Whole12Dots = "1..",
|
|
100
|
+
/** Triple dotted whole note. */
|
|
50
101
|
Whole3Dots = "1...",
|
|
102
|
+
/** Quadruple-dotted whole note. */
|
|
51
103
|
Whole4Dots = "1....",
|
|
104
|
+
/** Quintuple-dotted whole note. */
|
|
52
105
|
Whole5Dots = "1.....",
|
|
106
|
+
/** Sextuple-dotted whole note. */
|
|
53
107
|
Whole6Dots = "1......",
|
|
108
|
+
/** Half note. */
|
|
54
109
|
Half = "2n",
|
|
110
|
+
/** Half note creating a triplet. */
|
|
55
111
|
HalfTriplet = "2t",
|
|
112
|
+
/** Dotted half note. */
|
|
56
113
|
HalfDot = "2.",
|
|
114
|
+
/** Double dotted half note. */
|
|
57
115
|
Half2Dots = "2..",
|
|
116
|
+
/** Triple dotted half note. */
|
|
58
117
|
Half3Dots = "2...",
|
|
118
|
+
/** Quadruple-dotted half note. */
|
|
59
119
|
Half4Dots = "2....",
|
|
120
|
+
/** Quintuple-dotted half notre. */
|
|
60
121
|
Half5Dots = "2.....",
|
|
122
|
+
/** Quarter note. */
|
|
61
123
|
Quarter = "4n",
|
|
124
|
+
/** Quarter note creating a triplet. */
|
|
62
125
|
QuarterTriplet = "4t",
|
|
126
|
+
/** Dotted quarter note. */
|
|
63
127
|
QuarterDot = "4.",
|
|
128
|
+
/** Double dotted quarter note. */
|
|
64
129
|
Quarter2Dots = "4..",
|
|
130
|
+
/** Triple dotted quarter note. */
|
|
65
131
|
Quarter3Dots = "4...",
|
|
132
|
+
/** Quadruple-dotted quarter note. */
|
|
66
133
|
Quarter4Dots = "4....",
|
|
134
|
+
/** Eighth note. */
|
|
67
135
|
Eighth = "8n",
|
|
136
|
+
/** Eighth note creating a triplet. */
|
|
68
137
|
EighthTriplet = "8t",
|
|
138
|
+
/** Dotted eighth note. */
|
|
69
139
|
EighthDot = "8.",
|
|
140
|
+
/** Double dotted eighth note. */
|
|
70
141
|
Eighth2Dots = "8..",
|
|
142
|
+
/** Triple dotted eighth note. */
|
|
71
143
|
Eighth3Dots = "8...",
|
|
144
|
+
/** Sixteenth note. */
|
|
72
145
|
Sixteenth = "16n",
|
|
146
|
+
/** Sixteenth note creating a triplet. */
|
|
73
147
|
SixteenthTriplet = "16t",
|
|
148
|
+
/** Dotted sixteenth note. */
|
|
74
149
|
SixteenthDot = "16.",
|
|
150
|
+
/** Double dotted sixteenth note. */
|
|
75
151
|
Sixteenth2Dots = "16..",
|
|
152
|
+
/** Thirtysecond note. */
|
|
76
153
|
ThirtySecond = "32n",
|
|
154
|
+
/** Thirtysecond note creating a triplet. */
|
|
77
155
|
ThirtySecondTriplet = "32t",
|
|
156
|
+
/** Dotted thritysecond note. */
|
|
78
157
|
ThirtySecondDot = "32.",
|
|
158
|
+
/** Sixtyfourth note. */
|
|
79
159
|
SixtyFourth = "64n",
|
|
160
|
+
/** Sixtyfourth note creating a triplet. */
|
|
80
161
|
SixtyFourthTriplet = "64t"
|
|
81
162
|
}
|
|
163
|
+
/** String values type of note length enum. */
|
|
82
164
|
type NoteLengthStr = `${NoteLength}`;
|
|
165
|
+
/**
|
|
166
|
+
* Validate if given argument is note length.
|
|
167
|
+
* @param noteLength - Note length to validate.
|
|
168
|
+
* @returns - Valid note length or throws.
|
|
169
|
+
*/
|
|
83
170
|
declare function validateNoteLength(noteLength: unknown): NoteLength;
|
|
171
|
+
/** Note length props class. */
|
|
84
172
|
declare class NoteLengthProps {
|
|
173
|
+
/** Longest note size (e.g. 1 = whole note). */
|
|
85
174
|
static LongestNoteSize: number;
|
|
175
|
+
/** Shortest note size (e.g. 64 = sixtyfourth note). */
|
|
86
176
|
static ShortestNoteSize: number;
|
|
177
|
+
/** Note length. */
|
|
87
178
|
readonly noteLength: NoteLength;
|
|
179
|
+
/** Note size (whole=1, half=2, quarter=4, ...). */
|
|
88
180
|
readonly noteSize: number;
|
|
181
|
+
/** Number of ticks (not altered by isTriplet). */
|
|
89
182
|
readonly ticks: number;
|
|
183
|
+
/** Flag count. */
|
|
90
184
|
readonly flagCount: number;
|
|
185
|
+
/** Dot count. */
|
|
91
186
|
readonly dotCount: number;
|
|
187
|
+
/** Max dot count. */
|
|
92
188
|
readonly maxDotCount: number;
|
|
189
|
+
/** Is triplet? */
|
|
93
190
|
readonly isTriplet: boolean;
|
|
191
|
+
/** Has note stem. */
|
|
94
192
|
readonly hasStem: boolean;
|
|
193
|
+
/** Is note head solid (black)? */
|
|
95
194
|
readonly isSolid: boolean;
|
|
96
195
|
private constructor();
|
|
97
196
|
private static cache;
|
|
197
|
+
/**
|
|
198
|
+
* Get note length props.
|
|
199
|
+
* @param noteLength - Note length.
|
|
200
|
+
* @returns - Note length props.
|
|
201
|
+
*/
|
|
98
202
|
static get(noteLength: NoteLength | NoteLengthStr | string): NoteLengthProps;
|
|
203
|
+
/**
|
|
204
|
+
* Create note length props.
|
|
205
|
+
* @param noteLength - Note length or note size.
|
|
206
|
+
* @param dotCount - Dot count.
|
|
207
|
+
* @returns - Note length props.
|
|
208
|
+
*/
|
|
99
209
|
static create(noteLength: NoteLength | NoteLengthStr | string | number, dotCount?: number): NoteLengthProps;
|
|
100
210
|
/**
|
|
101
211
|
* Compare note lengths/sizes. Whole (1) > half (2) > quarter (4), etc.
|
|
@@ -114,25 +224,54 @@ declare class NoteLengthProps {
|
|
|
114
224
|
*/
|
|
115
225
|
static equals(a: NoteLengthProps | NoteLength | NoteLengthStr | number, b: NoteLengthProps | NoteLength | NoteLengthStr | number): boolean;
|
|
116
226
|
}
|
|
227
|
+
/** Tuplet ratio interface. */
|
|
117
228
|
interface TupletRatio {
|
|
229
|
+
/** Number of parts (notes). */
|
|
118
230
|
parts: number;
|
|
231
|
+
/** Played int time of (notes). */
|
|
119
232
|
inTimeOf: number;
|
|
120
233
|
}
|
|
234
|
+
/**
|
|
235
|
+
* Validate if given argument is tuplet ratio.
|
|
236
|
+
* @param tupletRatio - Tuplet ratio to validate.
|
|
237
|
+
* @returns - Valid tuplet ratio or throws.
|
|
238
|
+
*/
|
|
121
239
|
declare function validateTupletRatio(tupletRatio: unknown): TupletRatio;
|
|
240
|
+
/** Some preset tuplet ratio values. */
|
|
122
241
|
declare const Tuplet: Record<"Duplet" | "Triplet" | "Quadruplet", TupletRatio>;
|
|
242
|
+
/** Rhythm props class. */
|
|
123
243
|
declare class RhythmProps {
|
|
244
|
+
/** Note length. */
|
|
124
245
|
readonly noteLength: NoteLength;
|
|
246
|
+
/** Note size (whole=1, half=2, quarter=4, ...). */
|
|
125
247
|
readonly noteSize: number;
|
|
248
|
+
/** Dot count. */
|
|
126
249
|
readonly dotCount: number;
|
|
250
|
+
/** Tuplet ratio. */
|
|
127
251
|
readonly tupletRatio?: TupletRatio;
|
|
252
|
+
/** Number of ticks. */
|
|
128
253
|
readonly ticks: number;
|
|
254
|
+
/** Flag count. */
|
|
129
255
|
readonly flagCount: number;
|
|
256
|
+
/** Has note stem. */
|
|
130
257
|
readonly hasStem: boolean;
|
|
258
|
+
/** Is note head solid (black)? */
|
|
131
259
|
readonly isSolidNoteHead: boolean;
|
|
132
260
|
private constructor();
|
|
133
261
|
private static NoteSymbolMap;
|
|
262
|
+
/**
|
|
263
|
+
* Get string presentation of rhythm props.
|
|
264
|
+
* @returns - String presentation.
|
|
265
|
+
*/
|
|
134
266
|
toString(): string;
|
|
135
267
|
private static cache;
|
|
268
|
+
/**
|
|
269
|
+
* Get rhythm props with given arguments.
|
|
270
|
+
* @param noteLength - Note length.
|
|
271
|
+
* @param dotCount - Dot count.
|
|
272
|
+
* @param tupletRatio - Tuplet ratio.
|
|
273
|
+
* @returns - Rhythm props.
|
|
274
|
+
*/
|
|
136
275
|
static get(noteLength: NoteLength | NoteLengthStr, dotCount?: number, tupletRatio?: TupletRatio): RhythmProps;
|
|
137
276
|
/**
|
|
138
277
|
* Compare duration of rhythm props.
|
|
@@ -150,38 +289,81 @@ declare class RhythmProps {
|
|
|
150
289
|
static equals(a: RhythmProps, b: RhythmProps): boolean;
|
|
151
290
|
}
|
|
152
291
|
|
|
292
|
+
/** Time signature string type. */
|
|
153
293
|
type TimeSignatureString = "2/4" | "3/4" | "4/4" | "6/8" | "9/8";
|
|
294
|
+
/** Time signature class. */
|
|
154
295
|
declare class TimeSignature {
|
|
296
|
+
/** Number of beats in measure, upper value (e.g. "3" in "3/4"). */
|
|
155
297
|
readonly beatCount: number;
|
|
298
|
+
/** Beat size of time signature, lower value (e.g. "4" in "3/4"). */
|
|
156
299
|
readonly beatSize: number;
|
|
157
|
-
/**
|
|
300
|
+
/** Beat length. */
|
|
158
301
|
readonly beatLength: NoteLength;
|
|
302
|
+
/** Number of ticks in measure. */
|
|
159
303
|
readonly measureTicks: number;
|
|
304
|
+
/** Number of beam groups in measure. */
|
|
160
305
|
readonly beamGroupCount: number;
|
|
306
|
+
/** Length of one beam group. */
|
|
161
307
|
readonly beamGroupLength: number;
|
|
162
308
|
/**
|
|
309
|
+
* Create new time signature instance.
|
|
163
310
|
* @param str - For example "4/4".
|
|
164
311
|
*/
|
|
165
312
|
constructor(str: TimeSignatureString);
|
|
166
313
|
/**
|
|
314
|
+
* Create new time signature instance.
|
|
167
315
|
* @param beatCount - Measure beat count.
|
|
168
316
|
* @param beatSize - Size value: whole-note=1, half-note=2, quarter-note=4, etc.
|
|
169
317
|
*/
|
|
170
318
|
constructor(beatCount: number, beatSize: number);
|
|
319
|
+
/**
|
|
320
|
+
* Test whether this time signature has given beat count and size.
|
|
321
|
+
* @param beatCount - Beat count.
|
|
322
|
+
* @param beatSize - Beat size.
|
|
323
|
+
* @returns - Boolean whether this time signature match given beat count and size.
|
|
324
|
+
*/
|
|
171
325
|
is(beatCount: number, beatSize: number): boolean;
|
|
326
|
+
/**
|
|
327
|
+
* Get string representation of this time signature (e.g. "3/4").
|
|
328
|
+
* @returns - String representation.
|
|
329
|
+
*/
|
|
172
330
|
toString(): string;
|
|
173
331
|
}
|
|
332
|
+
/**
|
|
333
|
+
* Get default time signature ("4/4").
|
|
334
|
+
* @returns - Default time signature.
|
|
335
|
+
*/
|
|
174
336
|
declare function getDefaultTimeSignature(): TimeSignature;
|
|
175
337
|
|
|
338
|
+
/** Tempo type. */
|
|
176
339
|
type Tempo = {
|
|
340
|
+
/** Beats per minute value. */
|
|
177
341
|
beatsPerMinute: number;
|
|
342
|
+
/** Optional tempo props. */
|
|
178
343
|
options: {
|
|
344
|
+
/** Length of ane beat. */
|
|
179
345
|
beatLength: NoteLength;
|
|
346
|
+
/** Dot count for length of one beat. */
|
|
180
347
|
dotCount: number;
|
|
181
348
|
};
|
|
182
349
|
};
|
|
350
|
+
/**
|
|
351
|
+
* Get default tempo, which is 120 bpm with quarter note beat length.
|
|
352
|
+
* @returns - Default tempo.
|
|
353
|
+
*/
|
|
183
354
|
declare function getDefaultTempo(): Readonly<Tempo>;
|
|
355
|
+
/**
|
|
356
|
+
* Get formatted tempo string (e.g. "♩=120").
|
|
357
|
+
* @param tempo - Tempo.
|
|
358
|
+
* @returns - Formatted tempo string.
|
|
359
|
+
*/
|
|
184
360
|
declare function getTempoString(tempo: Tempo): string;
|
|
361
|
+
/**
|
|
362
|
+
* Get copy of tempo with altered speed.
|
|
363
|
+
* @param tempo - Tempo.
|
|
364
|
+
* @param speed - Speed factor, used to multiply beats per minute to.
|
|
365
|
+
* @returns - Altered tempo.
|
|
366
|
+
*/
|
|
185
367
|
declare function alterTempoSpeed(tempo: Tempo, speed: number): Tempo;
|
|
186
368
|
|
|
187
369
|
export { AccidentalType as A, KeySignature as K, Mode as M, NoteLength as N, RhythmProps as R, type TimeSignatureString as T, TimeSignature as a, getDefaultTimeSignature as b, type Tempo as c, getDefaultTempo as d, getTempoString as e, alterTempoSpeed as f, getDefaultKeySignature as g, type NoteLengthStr as h, NoteLengthProps as i, type TupletRatio as j, validateTupletRatio as k, Tuplet as l, validateNoteLength as v };
|
|
@@ -1,19 +1,35 @@
|
|
|
1
|
-
import { N as Note, A as Accidental } from './note-
|
|
1
|
+
import { N as Note, A as Accidental } from './note-eA2xPPiG.js';
|
|
2
2
|
|
|
3
|
+
/** Mode enum. */
|
|
3
4
|
declare enum Mode {
|
|
5
|
+
/** Mode 1: Ionian (Major). */
|
|
4
6
|
Ionian = 1,
|
|
7
|
+
/** Mode 2: Dorian. */
|
|
5
8
|
Dorian = 2,
|
|
9
|
+
/** Mode 3: Phrygian. */
|
|
6
10
|
Phrygian = 3,
|
|
11
|
+
/** Mode 4: Lydian. */
|
|
7
12
|
Lydian = 4,
|
|
13
|
+
/** Mode 5: Mixolydian. */
|
|
8
14
|
Mixolydian = 5,
|
|
15
|
+
/** Mode 6: Aeolian (minor). */
|
|
9
16
|
Aeolian = 6,
|
|
17
|
+
/** Mode 7: Locrian. */
|
|
10
18
|
Locrian = 7
|
|
11
19
|
}
|
|
20
|
+
/** Accidental type enum. */
|
|
12
21
|
declare enum AccidentalType {
|
|
22
|
+
/** Natural type has no accidentals. */
|
|
13
23
|
Natural = 0,
|
|
24
|
+
/** Flats type has one or more flats. */
|
|
14
25
|
Flats = 1,
|
|
26
|
+
/** Sharps type has one or more sharps. */
|
|
15
27
|
Sharps = 2
|
|
16
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Get default key signature (key signature of "C Major" scale).
|
|
31
|
+
* @returns - Default key signature.
|
|
32
|
+
*/
|
|
17
33
|
declare function getDefaultKeySignature(): KeySignature;
|
|
18
34
|
declare class KeySignature {
|
|
19
35
|
readonly tonic: string;
|
|
@@ -28,74 +44,168 @@ declare class KeySignature {
|
|
|
28
44
|
* @param mode - Mode: Ionian/Major = 1, Dorian = 2, ..., Locrian = 7
|
|
29
45
|
*/
|
|
30
46
|
protected constructor(tonic: string, mode: Mode);
|
|
47
|
+
/**
|
|
48
|
+
* Get accidental type sharps, flats, or natural (without accidentals).
|
|
49
|
+
* @returns - Accidental type.
|
|
50
|
+
*/
|
|
31
51
|
getAccidentalType(): AccidentalType;
|
|
52
|
+
/**
|
|
53
|
+
* Get natural scale notes of this key signature, natural scale has 7 steps (e.g. Major scale: W, W, H, W, W, W, H).
|
|
54
|
+
* @returns - Array of notes.
|
|
55
|
+
*/
|
|
32
56
|
getNaturalScaleNotes(): ReadonlyArray<Note>;
|
|
57
|
+
/**
|
|
58
|
+
* Get accidental for given diatonic id.
|
|
59
|
+
* @param diatonicId - Diatonic id.
|
|
60
|
+
* @returns - Accidental -2, -1, 0, 1 or 2.
|
|
61
|
+
*/
|
|
33
62
|
getAccidental(diatonicId: number): Accidental;
|
|
63
|
+
/**
|
|
64
|
+
* Get number of accidentals this key signature has.
|
|
65
|
+
* @returns - Number of accidentals.
|
|
66
|
+
*/
|
|
34
67
|
getNumAccidentals(): number;
|
|
68
|
+
/**
|
|
69
|
+
* Get accidental notes in correct order.
|
|
70
|
+
* @returns - Array of accidental notes.
|
|
71
|
+
*/
|
|
35
72
|
getOrderedAccidentalNotes(): ReadonlyArray<Note>;
|
|
36
73
|
/**
|
|
37
|
-
*
|
|
38
|
-
* @param degree - number 1
|
|
39
|
-
* @returns
|
|
74
|
+
* Get note of key signature by degree value.
|
|
75
|
+
* @param degree - Degree number in range [1, 7] or string e.g "b5" or "#4".
|
|
76
|
+
* @returns - Note.
|
|
40
77
|
*/
|
|
41
78
|
getNoteByDegree(degree: number | string): Note;
|
|
79
|
+
/**
|
|
80
|
+
* Test equality of given key signatures.
|
|
81
|
+
* @param a - Key signature a.
|
|
82
|
+
* @param b - Key signature b.
|
|
83
|
+
* @returns - True/false.
|
|
84
|
+
*/
|
|
42
85
|
static equals(a: KeySignature | null | undefined, b: KeySignature | null | undefined): boolean;
|
|
43
86
|
}
|
|
44
87
|
|
|
88
|
+
/** Note length enum. */
|
|
45
89
|
declare enum NoteLength {
|
|
90
|
+
/** Whole note. */
|
|
46
91
|
Whole = "1n",
|
|
92
|
+
/** Whole note creating a triplet. */
|
|
47
93
|
WholeTriplet = "1t",
|
|
94
|
+
/** Dotted whole note. */
|
|
48
95
|
WholeDot = "1.",
|
|
96
|
+
/** Double dotted whole note. */
|
|
97
|
+
Whole2Dots = "1..",
|
|
98
|
+
/** @deprecated - Use Whole2Dots instead. Accidentally had misspelled enum name! */
|
|
49
99
|
Whole12Dots = "1..",
|
|
100
|
+
/** Triple dotted whole note. */
|
|
50
101
|
Whole3Dots = "1...",
|
|
102
|
+
/** Quadruple-dotted whole note. */
|
|
51
103
|
Whole4Dots = "1....",
|
|
104
|
+
/** Quintuple-dotted whole note. */
|
|
52
105
|
Whole5Dots = "1.....",
|
|
106
|
+
/** Sextuple-dotted whole note. */
|
|
53
107
|
Whole6Dots = "1......",
|
|
108
|
+
/** Half note. */
|
|
54
109
|
Half = "2n",
|
|
110
|
+
/** Half note creating a triplet. */
|
|
55
111
|
HalfTriplet = "2t",
|
|
112
|
+
/** Dotted half note. */
|
|
56
113
|
HalfDot = "2.",
|
|
114
|
+
/** Double dotted half note. */
|
|
57
115
|
Half2Dots = "2..",
|
|
116
|
+
/** Triple dotted half note. */
|
|
58
117
|
Half3Dots = "2...",
|
|
118
|
+
/** Quadruple-dotted half note. */
|
|
59
119
|
Half4Dots = "2....",
|
|
120
|
+
/** Quintuple-dotted half notre. */
|
|
60
121
|
Half5Dots = "2.....",
|
|
122
|
+
/** Quarter note. */
|
|
61
123
|
Quarter = "4n",
|
|
124
|
+
/** Quarter note creating a triplet. */
|
|
62
125
|
QuarterTriplet = "4t",
|
|
126
|
+
/** Dotted quarter note. */
|
|
63
127
|
QuarterDot = "4.",
|
|
128
|
+
/** Double dotted quarter note. */
|
|
64
129
|
Quarter2Dots = "4..",
|
|
130
|
+
/** Triple dotted quarter note. */
|
|
65
131
|
Quarter3Dots = "4...",
|
|
132
|
+
/** Quadruple-dotted quarter note. */
|
|
66
133
|
Quarter4Dots = "4....",
|
|
134
|
+
/** Eighth note. */
|
|
67
135
|
Eighth = "8n",
|
|
136
|
+
/** Eighth note creating a triplet. */
|
|
68
137
|
EighthTriplet = "8t",
|
|
138
|
+
/** Dotted eighth note. */
|
|
69
139
|
EighthDot = "8.",
|
|
140
|
+
/** Double dotted eighth note. */
|
|
70
141
|
Eighth2Dots = "8..",
|
|
142
|
+
/** Triple dotted eighth note. */
|
|
71
143
|
Eighth3Dots = "8...",
|
|
144
|
+
/** Sixteenth note. */
|
|
72
145
|
Sixteenth = "16n",
|
|
146
|
+
/** Sixteenth note creating a triplet. */
|
|
73
147
|
SixteenthTriplet = "16t",
|
|
148
|
+
/** Dotted sixteenth note. */
|
|
74
149
|
SixteenthDot = "16.",
|
|
150
|
+
/** Double dotted sixteenth note. */
|
|
75
151
|
Sixteenth2Dots = "16..",
|
|
152
|
+
/** Thirtysecond note. */
|
|
76
153
|
ThirtySecond = "32n",
|
|
154
|
+
/** Thirtysecond note creating a triplet. */
|
|
77
155
|
ThirtySecondTriplet = "32t",
|
|
156
|
+
/** Dotted thritysecond note. */
|
|
78
157
|
ThirtySecondDot = "32.",
|
|
158
|
+
/** Sixtyfourth note. */
|
|
79
159
|
SixtyFourth = "64n",
|
|
160
|
+
/** Sixtyfourth note creating a triplet. */
|
|
80
161
|
SixtyFourthTriplet = "64t"
|
|
81
162
|
}
|
|
163
|
+
/** String values type of note length enum. */
|
|
82
164
|
type NoteLengthStr = `${NoteLength}`;
|
|
165
|
+
/**
|
|
166
|
+
* Validate if given argument is note length.
|
|
167
|
+
* @param noteLength - Note length to validate.
|
|
168
|
+
* @returns - Valid note length or throws.
|
|
169
|
+
*/
|
|
83
170
|
declare function validateNoteLength(noteLength: unknown): NoteLength;
|
|
171
|
+
/** Note length props class. */
|
|
84
172
|
declare class NoteLengthProps {
|
|
173
|
+
/** Longest note size (e.g. 1 = whole note). */
|
|
85
174
|
static LongestNoteSize: number;
|
|
175
|
+
/** Shortest note size (e.g. 64 = sixtyfourth note). */
|
|
86
176
|
static ShortestNoteSize: number;
|
|
177
|
+
/** Note length. */
|
|
87
178
|
readonly noteLength: NoteLength;
|
|
179
|
+
/** Note size (whole=1, half=2, quarter=4, ...). */
|
|
88
180
|
readonly noteSize: number;
|
|
181
|
+
/** Number of ticks (not altered by isTriplet). */
|
|
89
182
|
readonly ticks: number;
|
|
183
|
+
/** Flag count. */
|
|
90
184
|
readonly flagCount: number;
|
|
185
|
+
/** Dot count. */
|
|
91
186
|
readonly dotCount: number;
|
|
187
|
+
/** Max dot count. */
|
|
92
188
|
readonly maxDotCount: number;
|
|
189
|
+
/** Is triplet? */
|
|
93
190
|
readonly isTriplet: boolean;
|
|
191
|
+
/** Has note stem. */
|
|
94
192
|
readonly hasStem: boolean;
|
|
193
|
+
/** Is note head solid (black)? */
|
|
95
194
|
readonly isSolid: boolean;
|
|
96
195
|
private constructor();
|
|
97
196
|
private static cache;
|
|
197
|
+
/**
|
|
198
|
+
* Get note length props.
|
|
199
|
+
* @param noteLength - Note length.
|
|
200
|
+
* @returns - Note length props.
|
|
201
|
+
*/
|
|
98
202
|
static get(noteLength: NoteLength | NoteLengthStr | string): NoteLengthProps;
|
|
203
|
+
/**
|
|
204
|
+
* Create note length props.
|
|
205
|
+
* @param noteLength - Note length or note size.
|
|
206
|
+
* @param dotCount - Dot count.
|
|
207
|
+
* @returns - Note length props.
|
|
208
|
+
*/
|
|
99
209
|
static create(noteLength: NoteLength | NoteLengthStr | string | number, dotCount?: number): NoteLengthProps;
|
|
100
210
|
/**
|
|
101
211
|
* Compare note lengths/sizes. Whole (1) > half (2) > quarter (4), etc.
|
|
@@ -114,25 +224,54 @@ declare class NoteLengthProps {
|
|
|
114
224
|
*/
|
|
115
225
|
static equals(a: NoteLengthProps | NoteLength | NoteLengthStr | number, b: NoteLengthProps | NoteLength | NoteLengthStr | number): boolean;
|
|
116
226
|
}
|
|
227
|
+
/** Tuplet ratio interface. */
|
|
117
228
|
interface TupletRatio {
|
|
229
|
+
/** Number of parts (notes). */
|
|
118
230
|
parts: number;
|
|
231
|
+
/** Played int time of (notes). */
|
|
119
232
|
inTimeOf: number;
|
|
120
233
|
}
|
|
234
|
+
/**
|
|
235
|
+
* Validate if given argument is tuplet ratio.
|
|
236
|
+
* @param tupletRatio - Tuplet ratio to validate.
|
|
237
|
+
* @returns - Valid tuplet ratio or throws.
|
|
238
|
+
*/
|
|
121
239
|
declare function validateTupletRatio(tupletRatio: unknown): TupletRatio;
|
|
240
|
+
/** Some preset tuplet ratio values. */
|
|
122
241
|
declare const Tuplet: Record<"Duplet" | "Triplet" | "Quadruplet", TupletRatio>;
|
|
242
|
+
/** Rhythm props class. */
|
|
123
243
|
declare class RhythmProps {
|
|
244
|
+
/** Note length. */
|
|
124
245
|
readonly noteLength: NoteLength;
|
|
246
|
+
/** Note size (whole=1, half=2, quarter=4, ...). */
|
|
125
247
|
readonly noteSize: number;
|
|
248
|
+
/** Dot count. */
|
|
126
249
|
readonly dotCount: number;
|
|
250
|
+
/** Tuplet ratio. */
|
|
127
251
|
readonly tupletRatio?: TupletRatio;
|
|
252
|
+
/** Number of ticks. */
|
|
128
253
|
readonly ticks: number;
|
|
254
|
+
/** Flag count. */
|
|
129
255
|
readonly flagCount: number;
|
|
256
|
+
/** Has note stem. */
|
|
130
257
|
readonly hasStem: boolean;
|
|
258
|
+
/** Is note head solid (black)? */
|
|
131
259
|
readonly isSolidNoteHead: boolean;
|
|
132
260
|
private constructor();
|
|
133
261
|
private static NoteSymbolMap;
|
|
262
|
+
/**
|
|
263
|
+
* Get string presentation of rhythm props.
|
|
264
|
+
* @returns - String presentation.
|
|
265
|
+
*/
|
|
134
266
|
toString(): string;
|
|
135
267
|
private static cache;
|
|
268
|
+
/**
|
|
269
|
+
* Get rhythm props with given arguments.
|
|
270
|
+
* @param noteLength - Note length.
|
|
271
|
+
* @param dotCount - Dot count.
|
|
272
|
+
* @param tupletRatio - Tuplet ratio.
|
|
273
|
+
* @returns - Rhythm props.
|
|
274
|
+
*/
|
|
136
275
|
static get(noteLength: NoteLength | NoteLengthStr, dotCount?: number, tupletRatio?: TupletRatio): RhythmProps;
|
|
137
276
|
/**
|
|
138
277
|
* Compare duration of rhythm props.
|
|
@@ -150,38 +289,81 @@ declare class RhythmProps {
|
|
|
150
289
|
static equals(a: RhythmProps, b: RhythmProps): boolean;
|
|
151
290
|
}
|
|
152
291
|
|
|
292
|
+
/** Time signature string type. */
|
|
153
293
|
type TimeSignatureString = "2/4" | "3/4" | "4/4" | "6/8" | "9/8";
|
|
294
|
+
/** Time signature class. */
|
|
154
295
|
declare class TimeSignature {
|
|
296
|
+
/** Number of beats in measure, upper value (e.g. "3" in "3/4"). */
|
|
155
297
|
readonly beatCount: number;
|
|
298
|
+
/** Beat size of time signature, lower value (e.g. "4" in "3/4"). */
|
|
156
299
|
readonly beatSize: number;
|
|
157
|
-
/**
|
|
300
|
+
/** Beat length. */
|
|
158
301
|
readonly beatLength: NoteLength;
|
|
302
|
+
/** Number of ticks in measure. */
|
|
159
303
|
readonly measureTicks: number;
|
|
304
|
+
/** Number of beam groups in measure. */
|
|
160
305
|
readonly beamGroupCount: number;
|
|
306
|
+
/** Length of one beam group. */
|
|
161
307
|
readonly beamGroupLength: number;
|
|
162
308
|
/**
|
|
309
|
+
* Create new time signature instance.
|
|
163
310
|
* @param str - For example "4/4".
|
|
164
311
|
*/
|
|
165
312
|
constructor(str: TimeSignatureString);
|
|
166
313
|
/**
|
|
314
|
+
* Create new time signature instance.
|
|
167
315
|
* @param beatCount - Measure beat count.
|
|
168
316
|
* @param beatSize - Size value: whole-note=1, half-note=2, quarter-note=4, etc.
|
|
169
317
|
*/
|
|
170
318
|
constructor(beatCount: number, beatSize: number);
|
|
319
|
+
/**
|
|
320
|
+
* Test whether this time signature has given beat count and size.
|
|
321
|
+
* @param beatCount - Beat count.
|
|
322
|
+
* @param beatSize - Beat size.
|
|
323
|
+
* @returns - Boolean whether this time signature match given beat count and size.
|
|
324
|
+
*/
|
|
171
325
|
is(beatCount: number, beatSize: number): boolean;
|
|
326
|
+
/**
|
|
327
|
+
* Get string representation of this time signature (e.g. "3/4").
|
|
328
|
+
* @returns - String representation.
|
|
329
|
+
*/
|
|
172
330
|
toString(): string;
|
|
173
331
|
}
|
|
332
|
+
/**
|
|
333
|
+
* Get default time signature ("4/4").
|
|
334
|
+
* @returns - Default time signature.
|
|
335
|
+
*/
|
|
174
336
|
declare function getDefaultTimeSignature(): TimeSignature;
|
|
175
337
|
|
|
338
|
+
/** Tempo type. */
|
|
176
339
|
type Tempo = {
|
|
340
|
+
/** Beats per minute value. */
|
|
177
341
|
beatsPerMinute: number;
|
|
342
|
+
/** Optional tempo props. */
|
|
178
343
|
options: {
|
|
344
|
+
/** Length of ane beat. */
|
|
179
345
|
beatLength: NoteLength;
|
|
346
|
+
/** Dot count for length of one beat. */
|
|
180
347
|
dotCount: number;
|
|
181
348
|
};
|
|
182
349
|
};
|
|
350
|
+
/**
|
|
351
|
+
* Get default tempo, which is 120 bpm with quarter note beat length.
|
|
352
|
+
* @returns - Default tempo.
|
|
353
|
+
*/
|
|
183
354
|
declare function getDefaultTempo(): Readonly<Tempo>;
|
|
355
|
+
/**
|
|
356
|
+
* Get formatted tempo string (e.g. "♩=120").
|
|
357
|
+
* @param tempo - Tempo.
|
|
358
|
+
* @returns - Formatted tempo string.
|
|
359
|
+
*/
|
|
184
360
|
declare function getTempoString(tempo: Tempo): string;
|
|
361
|
+
/**
|
|
362
|
+
* Get copy of tempo with altered speed.
|
|
363
|
+
* @param tempo - Tempo.
|
|
364
|
+
* @param speed - Speed factor, used to multiply beats per minute to.
|
|
365
|
+
* @returns - Altered tempo.
|
|
366
|
+
*/
|
|
185
367
|
declare function alterTempoSpeed(tempo: Tempo, speed: number): Tempo;
|
|
186
368
|
|
|
187
369
|
export { AccidentalType as A, KeySignature as K, Mode as M, NoteLength as N, RhythmProps as R, type TimeSignatureString as T, TimeSignature as a, getDefaultTimeSignature as b, type Tempo as c, getDefaultTempo as d, getTempoString as e, alterTempoSpeed as f, getDefaultKeySignature as g, type NoteLengthStr as h, NoteLengthProps as i, type TupletRatio as j, validateTupletRatio as k, Tuplet as l, validateNoteLength as v };
|