@tspro/web-music-score 1.0.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 +5 -0
- package/LICENSE +57 -0
- package/README.md +443 -0
- package/dist/index.cjs.js +40708 -0
- package/dist/index.d.ts +1258 -0
- package/dist/index.esm.mjs +40699 -0
- package/dist/index.umd.min.js +9 -0
- package/package.json +77 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1258 @@
|
|
|
1
|
+
import * as React_2 from 'react';
|
|
2
|
+
|
|
3
|
+
/** @public */
|
|
4
|
+
export declare type Accidental = -2 | -1 | 0 | 1 | 2;
|
|
5
|
+
|
|
6
|
+
/** @public */
|
|
7
|
+
export declare type AlterTempo = {
|
|
8
|
+
beatsPerMinute: number;
|
|
9
|
+
options?: {
|
|
10
|
+
beatLength: NoteLength;
|
|
11
|
+
dotted?: boolean;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/** @public */
|
|
16
|
+
export declare function alterTempoSpeed(tempo: Tempo, speed: number): Tempo;
|
|
17
|
+
|
|
18
|
+
/** @public */
|
|
19
|
+
export declare enum Annotation {
|
|
20
|
+
/** "ppp", "pp", "p", "mp", "m", "mf", "f", "ff", "fff", "cresc.", "decresc.", "dim." */
|
|
21
|
+
Dynamics = 0,
|
|
22
|
+
/** "accel.", "rit.", "a tempo" */
|
|
23
|
+
Tempo = 1
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** @public */
|
|
27
|
+
export declare enum ArcPos {
|
|
28
|
+
Auto = 0,
|
|
29
|
+
Above = 1,
|
|
30
|
+
Middle = 2,
|
|
31
|
+
Below = 3,
|
|
32
|
+
StemTip = 4
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** @public */
|
|
36
|
+
export declare enum Arpeggio {
|
|
37
|
+
Up = 0,
|
|
38
|
+
Down = 1
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** @public */
|
|
42
|
+
declare namespace Audio_2 {
|
|
43
|
+
enum Instrument {
|
|
44
|
+
Synth = 0,
|
|
45
|
+
ClassicalGuitar = 1
|
|
46
|
+
}
|
|
47
|
+
const InstrumentList: Instrument[];
|
|
48
|
+
const DefaultInstrument = Instrument.Synth;
|
|
49
|
+
function validateInstrument(instr: number): Instrument;
|
|
50
|
+
function getInstrumentName(instr: Instrument): string;
|
|
51
|
+
function setInstrument(instr: Instrument): void;
|
|
52
|
+
function playNote(note: Note | string | number, duration?: number, linearVolume?: number): void;
|
|
53
|
+
function stop(): void;
|
|
54
|
+
}
|
|
55
|
+
export { Audio_2 as Audio }
|
|
56
|
+
|
|
57
|
+
/** @public */
|
|
58
|
+
export declare class CellData {
|
|
59
|
+
readonly guitarNote: Readonly<GuitarNote>;
|
|
60
|
+
readonly cellRect: DivRect;
|
|
61
|
+
readonly noteRect: DivRect;
|
|
62
|
+
constructor(guitarNote: Readonly<GuitarNote>, cellRect: DivRect, noteRect: DivRect);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** @public */
|
|
66
|
+
export declare class Chord {
|
|
67
|
+
readonly chordInfo: ChordInfo;
|
|
68
|
+
readonly rootNote: Note;
|
|
69
|
+
readonly name: string;
|
|
70
|
+
readonly notes: Note[];
|
|
71
|
+
readonly omitNotes: boolean[];
|
|
72
|
+
readonly slashBassNote?: Note;
|
|
73
|
+
private constructor();
|
|
74
|
+
static getChords(notes: ReadonlyArray<Note>): ReadonlyArray<Chord>;
|
|
75
|
+
private replaceWith;
|
|
76
|
+
/**
|
|
77
|
+
* @returns Chord name e.g. "C/B"
|
|
78
|
+
*/
|
|
79
|
+
toString(): string;
|
|
80
|
+
/**
|
|
81
|
+
* @returns Degree notation string, e.g. "E - 1(C) - 3(E) - 5(G)"
|
|
82
|
+
*/
|
|
83
|
+
getDegreeNotationString(): string;
|
|
84
|
+
/**
|
|
85
|
+
* @returns Omitted degrees string e.g. "Omits 5(G), 9(D)"
|
|
86
|
+
*/
|
|
87
|
+
getOmittedDegreesString(): string;
|
|
88
|
+
/**
|
|
89
|
+
* @param i - Degree index
|
|
90
|
+
* @returns Degree string for given degree index, e.g. "3"
|
|
91
|
+
*/
|
|
92
|
+
private getDegreeStr;
|
|
93
|
+
/**
|
|
94
|
+
* @param i - Degree index
|
|
95
|
+
* @returns Note string for given degree index, e.g. "E"
|
|
96
|
+
*/
|
|
97
|
+
private getNoteStr;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** @public */
|
|
101
|
+
export declare type ChordInfo = {
|
|
102
|
+
name: string;
|
|
103
|
+
degrees: Degree[];
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
/** @public */
|
|
107
|
+
export declare class CircleOfFifthsComponent extends React_2.Component<CircleOfFifthsComponentProps, {}> {
|
|
108
|
+
constructor(props: CircleOfFifthsComponentProps);
|
|
109
|
+
onScaleChange(scaleType: ScaleType, keyNote: string): void;
|
|
110
|
+
render(): React_2.JSX.Element;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/** @public */
|
|
114
|
+
export declare interface CircleOfFifthsComponentProps {
|
|
115
|
+
style?: React_2.CSSProperties;
|
|
116
|
+
scale: Scale;
|
|
117
|
+
onScaleChange: (scale: Scale) => void;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/** @public */
|
|
121
|
+
export declare type ClickObjectListener = (obj: MusicInterface) => void;
|
|
122
|
+
|
|
123
|
+
/** @public */
|
|
124
|
+
export declare type ClickObjectSelector = (arr: MusicInterface[]) => MusicInterface | undefined;
|
|
125
|
+
|
|
126
|
+
/** @public */
|
|
127
|
+
export declare type ClickPitchListener = (pickedPitch: PickedPitch) => void;
|
|
128
|
+
|
|
129
|
+
/** @public */
|
|
130
|
+
declare function createAndanteByDiabelli(): MDocument;
|
|
131
|
+
|
|
132
|
+
/** @public */
|
|
133
|
+
declare function createFrereJacques(): MDocument;
|
|
134
|
+
|
|
135
|
+
/** @public */
|
|
136
|
+
declare function createGreensleeves(): MDocument;
|
|
137
|
+
|
|
138
|
+
/** @public */
|
|
139
|
+
export declare type CursorPositionChangeListener = (cursorRect: DivRect | undefined) => void;
|
|
140
|
+
|
|
141
|
+
declare namespace DefaultExport {
|
|
142
|
+
export {
|
|
143
|
+
Audio_2 as Audio,
|
|
144
|
+
MusicError,
|
|
145
|
+
MusicInterface,
|
|
146
|
+
MAccidental,
|
|
147
|
+
MArc,
|
|
148
|
+
MArpeggio,
|
|
149
|
+
MBeamGroup,
|
|
150
|
+
MDocument,
|
|
151
|
+
MEnding,
|
|
152
|
+
MFermata,
|
|
153
|
+
MHeader,
|
|
154
|
+
MImage,
|
|
155
|
+
MMeasure,
|
|
156
|
+
MBarLineRight,
|
|
157
|
+
MBarLineLeft,
|
|
158
|
+
MNoteGroup,
|
|
159
|
+
MRest,
|
|
160
|
+
MRhythmColumn,
|
|
161
|
+
MScoreRow,
|
|
162
|
+
MSignature,
|
|
163
|
+
MSpecialText,
|
|
164
|
+
MText,
|
|
165
|
+
MExtensionLine,
|
|
166
|
+
MPlayer,
|
|
167
|
+
MRenderer,
|
|
168
|
+
MPlaybackButtons,
|
|
169
|
+
DivRect,
|
|
170
|
+
StaffKind,
|
|
171
|
+
Stem,
|
|
172
|
+
Arpeggio,
|
|
173
|
+
TieLength,
|
|
174
|
+
ArcPos,
|
|
175
|
+
NoteOptions,
|
|
176
|
+
RestOptions,
|
|
177
|
+
PickedPitch,
|
|
178
|
+
ClickPitchListener,
|
|
179
|
+
ClickObjectSelector,
|
|
180
|
+
ClickObjectListener,
|
|
181
|
+
CursorPositionChangeListener,
|
|
182
|
+
PlayState,
|
|
183
|
+
PlayStateChangeListener,
|
|
184
|
+
Fermata,
|
|
185
|
+
Navigation,
|
|
186
|
+
Annotation,
|
|
187
|
+
Label,
|
|
188
|
+
ChordInfo,
|
|
189
|
+
InvalidChordException,
|
|
190
|
+
Chord,
|
|
191
|
+
validateIntervalQuality,
|
|
192
|
+
IntervalDirection,
|
|
193
|
+
IntervalQuality,
|
|
194
|
+
Interval,
|
|
195
|
+
Accidental,
|
|
196
|
+
NaturalNote,
|
|
197
|
+
ParsedNote,
|
|
198
|
+
Note,
|
|
199
|
+
getScaleFactoryList,
|
|
200
|
+
getScaleFactory,
|
|
201
|
+
validateScaleType,
|
|
202
|
+
getScale,
|
|
203
|
+
getDefaultScale,
|
|
204
|
+
Degree,
|
|
205
|
+
ScaleType,
|
|
206
|
+
Scale,
|
|
207
|
+
ScaleFactory,
|
|
208
|
+
getDefaultKeySignature,
|
|
209
|
+
KeySignature,
|
|
210
|
+
getDefaultTimeSignature,
|
|
211
|
+
TimeSignatureString,
|
|
212
|
+
TimeSignature,
|
|
213
|
+
getDefaultTempo,
|
|
214
|
+
getTempoString,
|
|
215
|
+
alterTempoSpeed,
|
|
216
|
+
Tempo,
|
|
217
|
+
AlterTempo,
|
|
218
|
+
validateNoteLength,
|
|
219
|
+
NoteLength,
|
|
220
|
+
MaxNoteLength,
|
|
221
|
+
MinNoteLength,
|
|
222
|
+
RhythmProps,
|
|
223
|
+
validatePitchNotation,
|
|
224
|
+
validateGuitarNoteLabel,
|
|
225
|
+
SymbolSet,
|
|
226
|
+
PitchNotation,
|
|
227
|
+
PitchNotationList,
|
|
228
|
+
DefaultPitchNotation,
|
|
229
|
+
GuitarNoteLabel,
|
|
230
|
+
DefaultGuitarNoteLabel,
|
|
231
|
+
GuitarNoteLabelList,
|
|
232
|
+
CircleOfFifthsComponentProps,
|
|
233
|
+
CircleOfFifthsComponent,
|
|
234
|
+
UpdateGuitarNoteFunc,
|
|
235
|
+
CellData,
|
|
236
|
+
GuitarComponentProps,
|
|
237
|
+
GuitarComponentState,
|
|
238
|
+
GuitarComponent,
|
|
239
|
+
validateTuningName,
|
|
240
|
+
validateHandedness,
|
|
241
|
+
TuningNameList,
|
|
242
|
+
DefaultTuningName,
|
|
243
|
+
Handedness,
|
|
244
|
+
DefaultHandedness,
|
|
245
|
+
GuitarNote,
|
|
246
|
+
GuitarContext,
|
|
247
|
+
MusicScoreViewProps,
|
|
248
|
+
MusicScoreView,
|
|
249
|
+
PlaybackButtonsLayout,
|
|
250
|
+
PlaybackButtonsProps,
|
|
251
|
+
PlaybackButtonsState,
|
|
252
|
+
PlaybackButtons,
|
|
253
|
+
SamplePieces
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
export default DefaultExport;
|
|
257
|
+
|
|
258
|
+
/** @public */
|
|
259
|
+
export declare const DefaultGuitarNoteLabel = GuitarNoteLabel.Default;
|
|
260
|
+
|
|
261
|
+
/** @public */
|
|
262
|
+
export declare const DefaultHandedness: Handedness;
|
|
263
|
+
|
|
264
|
+
/** @public */
|
|
265
|
+
export declare const DefaultPitchNotation = PitchNotation.Scientific;
|
|
266
|
+
|
|
267
|
+
/** @public */
|
|
268
|
+
export declare const DefaultTuningName: string;
|
|
269
|
+
|
|
270
|
+
/** @public */
|
|
271
|
+
export declare type Degree = 1 | 2 | "b3" | 3 | 4 | "b5" | 5 | "#5" | 6 | "bb7" | "b7" | 7 | "#7" | "b9" | 9 | "#9" | 11 | 13;
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* @public
|
|
275
|
+
*
|
|
276
|
+
* DivRect class, left, top, right, bottom rectangle divided into four sections by centerX, centerY.
|
|
277
|
+
*/
|
|
278
|
+
export declare class DivRect {
|
|
279
|
+
left: number;
|
|
280
|
+
centerX: number;
|
|
281
|
+
right: number;
|
|
282
|
+
top: number;
|
|
283
|
+
centerY: number;
|
|
284
|
+
bottom: number;
|
|
285
|
+
/**
|
|
286
|
+
* Create rectangle with all zero values.
|
|
287
|
+
*/
|
|
288
|
+
constructor();
|
|
289
|
+
/**
|
|
290
|
+
* Create rectangle with left, right, top, bottom.
|
|
291
|
+
* Properties centerX and centerY will be centered in the middle.
|
|
292
|
+
*
|
|
293
|
+
* @param left -
|
|
294
|
+
* @param right -
|
|
295
|
+
* @param top -
|
|
296
|
+
* @param bottom -
|
|
297
|
+
*/
|
|
298
|
+
constructor(left: number, right: number, top: number, bottom: number);
|
|
299
|
+
/**
|
|
300
|
+
* Create rectangle with full arguments.
|
|
301
|
+
*
|
|
302
|
+
* @param left -
|
|
303
|
+
* @param centerX -
|
|
304
|
+
* @param right -
|
|
305
|
+
* @param top -
|
|
306
|
+
* @param centerY -
|
|
307
|
+
* @param bottom -
|
|
308
|
+
*/
|
|
309
|
+
constructor(left: number, centerX: number, right: number, top: number, centerY: number, bottom: number);
|
|
310
|
+
/**
|
|
311
|
+
* Create rect from basic left, top, width and height arguments.
|
|
312
|
+
*
|
|
313
|
+
* @param left -
|
|
314
|
+
* @param top -
|
|
315
|
+
* @param width -
|
|
316
|
+
* @param height -
|
|
317
|
+
* @returns
|
|
318
|
+
*/
|
|
319
|
+
static create(left: number, top: number, width: number, height: number): DivRect;
|
|
320
|
+
/**
|
|
321
|
+
* Create rect from centerX, centerY, width, height arguments.
|
|
322
|
+
*
|
|
323
|
+
* @param centerX - Center x-coordinate.
|
|
324
|
+
* @param centerY - Center y-coordinate.
|
|
325
|
+
* @param width -
|
|
326
|
+
* @param height -
|
|
327
|
+
* @returns
|
|
328
|
+
*/
|
|
329
|
+
static createCentered(centerX: number, centerY: number, width: number, height: number): DivRect;
|
|
330
|
+
/**
|
|
331
|
+
* Create rect from sections.
|
|
332
|
+
*
|
|
333
|
+
* @param leftw - Left section width.
|
|
334
|
+
* @param rightw - Right section width.
|
|
335
|
+
* @param toph - Top section height.
|
|
336
|
+
* @param bottomh - Bottomsection height.
|
|
337
|
+
* @returns
|
|
338
|
+
*/
|
|
339
|
+
static createSections(leftw: number, rightw: number, toph: number, bottomh: number): DivRect;
|
|
340
|
+
/**
|
|
341
|
+
* Width.
|
|
342
|
+
*/
|
|
343
|
+
get width(): number;
|
|
344
|
+
/**
|
|
345
|
+
* Height.
|
|
346
|
+
*/
|
|
347
|
+
get height(): number;
|
|
348
|
+
/**
|
|
349
|
+
* Left section width.
|
|
350
|
+
*/
|
|
351
|
+
get leftw(): number;
|
|
352
|
+
/**
|
|
353
|
+
* Right section width.
|
|
354
|
+
*/
|
|
355
|
+
get rightw(): number;
|
|
356
|
+
/**
|
|
357
|
+
* Top section height.
|
|
358
|
+
*/
|
|
359
|
+
get toph(): number;
|
|
360
|
+
/**
|
|
361
|
+
* Bottom section height.
|
|
362
|
+
*/
|
|
363
|
+
get bottomh(): number;
|
|
364
|
+
/**
|
|
365
|
+
* Does this Rect contain given (x, y)-point?
|
|
366
|
+
*
|
|
367
|
+
* @param x -
|
|
368
|
+
* @param y -
|
|
369
|
+
* @returns
|
|
370
|
+
*/
|
|
371
|
+
contains(x: number, y: number): boolean;
|
|
372
|
+
/**
|
|
373
|
+
* Do a and b rects overlap?
|
|
374
|
+
*
|
|
375
|
+
* @param a -
|
|
376
|
+
* @param b -
|
|
377
|
+
* @returns
|
|
378
|
+
*/
|
|
379
|
+
static overlap(a: DivRect, b: DivRect): boolean;
|
|
380
|
+
/**
|
|
381
|
+
* Do horizontal measures of a and b rects overlap?
|
|
382
|
+
*
|
|
383
|
+
* @param a -
|
|
384
|
+
* @param b -
|
|
385
|
+
* @returns
|
|
386
|
+
*/
|
|
387
|
+
static overlapX(a: DivRect, b: DivRect): boolean;
|
|
388
|
+
/**
|
|
389
|
+
* Check if this Rect equals with given Rect.
|
|
390
|
+
* @param o -
|
|
391
|
+
* @returns
|
|
392
|
+
*/
|
|
393
|
+
equals(o: DivRect): boolean;
|
|
394
|
+
/**
|
|
395
|
+
* Check if frame (ignoring centerX/Y) of this Rect equals with given Rect, ignoring centerX and centerY.
|
|
396
|
+
*
|
|
397
|
+
* @param o -
|
|
398
|
+
* @returns
|
|
399
|
+
*/
|
|
400
|
+
equalsFrame(o: DivRect): boolean;
|
|
401
|
+
/**
|
|
402
|
+
* Created duplicate of this Rect.
|
|
403
|
+
*
|
|
404
|
+
* @returns
|
|
405
|
+
*/
|
|
406
|
+
copy(): DivRect;
|
|
407
|
+
/**
|
|
408
|
+
* Move this rect by (dx, dy). Modifies this Rect.
|
|
409
|
+
*
|
|
410
|
+
* @param dx -
|
|
411
|
+
* @param dy -
|
|
412
|
+
* @returns
|
|
413
|
+
*/
|
|
414
|
+
offsetInPlace(dx: number, dy: number): this;
|
|
415
|
+
/**
|
|
416
|
+
* Move this rect by (dx, dy). Immutable, returns modified copy.
|
|
417
|
+
*
|
|
418
|
+
* @param dx -
|
|
419
|
+
* @param dy -
|
|
420
|
+
* @returns
|
|
421
|
+
*/
|
|
422
|
+
offsetCopy(dx: number, dy: number): DivRect;
|
|
423
|
+
/**
|
|
424
|
+
* Expand this Rect by given Rect. Modifies this Rect.
|
|
425
|
+
*
|
|
426
|
+
* @param rect -
|
|
427
|
+
* @returns
|
|
428
|
+
*/
|
|
429
|
+
expandInPlace(rect: DivRect): this;
|
|
430
|
+
/**
|
|
431
|
+
* Expand this Rect by given Rect. Immutable, returns modified copy.
|
|
432
|
+
*
|
|
433
|
+
* @param rect -
|
|
434
|
+
* @returns
|
|
435
|
+
*/
|
|
436
|
+
expandCopy(rect: DivRect): DivRect;
|
|
437
|
+
/**
|
|
438
|
+
* Clip this Rect by given Rect. Mmodifies this Rect.
|
|
439
|
+
*
|
|
440
|
+
* @param clipRect -
|
|
441
|
+
* @returns
|
|
442
|
+
*/
|
|
443
|
+
clipInPlace(clipRect: DivRect): this;
|
|
444
|
+
/**
|
|
445
|
+
* Clip this Rect by given Rect. Immutable, return modified copy.
|
|
446
|
+
*
|
|
447
|
+
* @param clipRect -
|
|
448
|
+
* @returns
|
|
449
|
+
*/
|
|
450
|
+
clipCopy(clipRect: DivRect): DivRect;
|
|
451
|
+
/**
|
|
452
|
+
* Scale Rect. Anchor pos is (centerX, centerY). Modifies this Rect.
|
|
453
|
+
*
|
|
454
|
+
* @param scaleX -
|
|
455
|
+
* @param scaleY -
|
|
456
|
+
* @returns Copy of scaled Rect.
|
|
457
|
+
*/
|
|
458
|
+
scaleInPlace(scaleX: number, scaleY?: number): this;
|
|
459
|
+
/**
|
|
460
|
+
* Scale Rect. Anchor pos is (centerX, centerY). Immutable, returns modified copy.
|
|
461
|
+
*
|
|
462
|
+
* @param scaleX -
|
|
463
|
+
* @param scaleY -
|
|
464
|
+
* @returns Copy of scaled Rect.
|
|
465
|
+
*/
|
|
466
|
+
scaleCopy(scaleX: number, scaleY?: number): DivRect;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
/** @public */
|
|
470
|
+
export declare enum Fermata {
|
|
471
|
+
AtNote = 0,
|
|
472
|
+
AtMeasureEnd = 1
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
/** @public */
|
|
476
|
+
export declare function getDefaultKeySignature(): KeySignature;
|
|
477
|
+
|
|
478
|
+
/** @public */
|
|
479
|
+
export declare function getDefaultScale(): Scale;
|
|
480
|
+
|
|
481
|
+
/** @public */
|
|
482
|
+
export declare function getDefaultTempo(): Readonly<Tempo>;
|
|
483
|
+
|
|
484
|
+
/** @public */
|
|
485
|
+
export declare function getDefaultTimeSignature(): TimeSignature;
|
|
486
|
+
|
|
487
|
+
/** @public */
|
|
488
|
+
export declare function getScale(keyNote: string, scaleType: ScaleType): Scale;
|
|
489
|
+
|
|
490
|
+
/** @public */
|
|
491
|
+
export declare function getScaleFactory(scaleType: ScaleType): ScaleFactory;
|
|
492
|
+
|
|
493
|
+
/** @public */
|
|
494
|
+
export declare function getScaleFactoryList(filter?: (scaleType: ScaleType) => boolean): ReadonlyArray<ScaleFactory | string>;
|
|
495
|
+
|
|
496
|
+
/** @public */
|
|
497
|
+
export declare function getTempoString(tempo: Tempo): string;
|
|
498
|
+
|
|
499
|
+
/** @public */
|
|
500
|
+
export declare class GuitarComponent extends React_2.Component<GuitarComponentProps, GuitarComponentState> {
|
|
501
|
+
state: GuitarComponentState;
|
|
502
|
+
constructor(props: GuitarComponentProps);
|
|
503
|
+
componentDidUpdate(prevProps: GuitarComponentProps): void;
|
|
504
|
+
getLayoutState(): {
|
|
505
|
+
table: CellData[][];
|
|
506
|
+
width: number;
|
|
507
|
+
height: number;
|
|
508
|
+
};
|
|
509
|
+
onHover(cell?: CellData): void;
|
|
510
|
+
onClick(cell?: CellData): void;
|
|
511
|
+
render(): React_2.JSX.Element;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
/** @public */
|
|
515
|
+
export declare interface GuitarComponentProps {
|
|
516
|
+
style?: React_2.CSSProperties;
|
|
517
|
+
guitarContext: GuitarContext;
|
|
518
|
+
updateGuitarNote?: UpdateGuitarNoteFunc;
|
|
519
|
+
onClickNote?: (guitarNote: GuitarNote) => void;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
/** @public */
|
|
523
|
+
export declare interface GuitarComponentState {
|
|
524
|
+
width: number;
|
|
525
|
+
height: number;
|
|
526
|
+
table: CellData[][];
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
/** @public */
|
|
530
|
+
export declare class GuitarContext {
|
|
531
|
+
readonly tuningName: string;
|
|
532
|
+
readonly scale: Scale;
|
|
533
|
+
readonly handedness: Handedness;
|
|
534
|
+
readonly pitchNotation: PitchNotation;
|
|
535
|
+
readonly guitarNoteLabel: GuitarNoteLabel;
|
|
536
|
+
readonly maxFretId: number;
|
|
537
|
+
private readonly guitarNoteTable;
|
|
538
|
+
private readonly stringTunings;
|
|
539
|
+
constructor(tuningName: string, scale: Scale, handedness: Handedness, pitchNotation: PitchNotation, guitarNoteLabel: GuitarNoteLabel);
|
|
540
|
+
getGuitarNote(stringId: number, fretId: number): Readonly<GuitarNote>;
|
|
541
|
+
getStringTuning(stringId: number): Note;
|
|
542
|
+
getTuningOverview(): string;
|
|
543
|
+
alterTuningName(tuningName: string): GuitarContext;
|
|
544
|
+
alterScale(scale: Scale): GuitarContext;
|
|
545
|
+
alterHandedness(handedness: Handedness): GuitarContext;
|
|
546
|
+
alterPitchNotation(pitchNotation: PitchNotation): GuitarContext;
|
|
547
|
+
alterGuitarNoteLabel(guitarNoteLabel: GuitarNoteLabel): GuitarContext;
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
/** @public */
|
|
551
|
+
export declare class GuitarNote {
|
|
552
|
+
readonly guitarCtx: GuitarContext;
|
|
553
|
+
readonly stringId: number;
|
|
554
|
+
readonly fretId: number;
|
|
555
|
+
readonly noteId: number;
|
|
556
|
+
readonly preferredNote: Note;
|
|
557
|
+
readonly isScaleNote: boolean;
|
|
558
|
+
readonly isScaleRootNote: boolean;
|
|
559
|
+
isVisible: boolean;
|
|
560
|
+
text: string;
|
|
561
|
+
textColor: string;
|
|
562
|
+
fillColor: string | undefined;
|
|
563
|
+
borderColor: string | undefined;
|
|
564
|
+
isBarre: boolean;
|
|
565
|
+
constructor(guitarCtx: GuitarContext, stringId: number, fretId: number, noteId: number);
|
|
566
|
+
show(): void;
|
|
567
|
+
hide(): void;
|
|
568
|
+
setDefaultText(): void;
|
|
569
|
+
setDefaultFillColor(): void;
|
|
570
|
+
setDefaultBorderColor(showBorder?: boolean): void;
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
/** @public */
|
|
574
|
+
export declare enum GuitarNoteLabel {
|
|
575
|
+
Default = "Default",
|
|
576
|
+
OmitOctave = "Omit Octave",
|
|
577
|
+
Interval = "Interval"
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
/** @public */
|
|
581
|
+
export declare const GuitarNoteLabelList: GuitarNoteLabel[];
|
|
582
|
+
|
|
583
|
+
/** @public */
|
|
584
|
+
export declare type Handedness = "rh" | "lh";
|
|
585
|
+
|
|
586
|
+
/** @public */
|
|
587
|
+
export declare class Interval {
|
|
588
|
+
readonly note1: Note;
|
|
589
|
+
readonly note2: Note;
|
|
590
|
+
readonly direction: IntervalDirection;
|
|
591
|
+
readonly semitones: number;
|
|
592
|
+
readonly quantity: number;
|
|
593
|
+
readonly quality: IntervalQuality;
|
|
594
|
+
private constructor();
|
|
595
|
+
static get(note1: Note, note2: Note): Interval | undefined;
|
|
596
|
+
toString(): string;
|
|
597
|
+
toAbbrString(): string;
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
/** @public */
|
|
601
|
+
export declare type IntervalDirection = "Unison" | "Ascending" | "Descending";
|
|
602
|
+
|
|
603
|
+
/** @public */
|
|
604
|
+
export declare type IntervalQuality = "Perfect" | "Major" | "minor" | "Augmented" | "Doubly Augmented" | "diminished" | "doubly diminished";
|
|
605
|
+
|
|
606
|
+
/** @public */
|
|
607
|
+
export declare class InvalidChordException extends MusicError {
|
|
608
|
+
readonly msg: string;
|
|
609
|
+
constructor(msg: string);
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
/** @public */
|
|
613
|
+
export declare class KeySignature {
|
|
614
|
+
private static readonly OrderOfSharps;
|
|
615
|
+
private static readonly OrderOfFlats;
|
|
616
|
+
private readonly accidentalNotes;
|
|
617
|
+
private readonly accidentalNotesByPitch;
|
|
618
|
+
private readonly orderedAccidentalNotes;
|
|
619
|
+
/**
|
|
620
|
+
* @param keyNote - Key note.
|
|
621
|
+
* @param mode - [1..7], 1 = Ionian/Major, 2 = Dorian, ..., 7 = Locrian
|
|
622
|
+
*/
|
|
623
|
+
constructor(keyNote: string, mode: number);
|
|
624
|
+
getType(): "natural" | "flat" | "sharp";
|
|
625
|
+
getAccidental(pitch: number): Accidental;
|
|
626
|
+
getNumAccidentals(): number;
|
|
627
|
+
getOrderedAccidentalNotes(): ReadonlyArray<Note>;
|
|
628
|
+
/**
|
|
629
|
+
*
|
|
630
|
+
* @param degree - number 1..7 or string e.g "b5" or "#4"
|
|
631
|
+
* @returns
|
|
632
|
+
*/
|
|
633
|
+
getScaleNote(degree: number | string): Note;
|
|
634
|
+
equals(o: KeySignature): boolean;
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
/** @public */
|
|
638
|
+
export declare enum Label {
|
|
639
|
+
/** "C", "C#", "Db", "D", etc. */
|
|
640
|
+
Note = 0,
|
|
641
|
+
/** "C", "Am", "G7", etc. */
|
|
642
|
+
Chord = 1
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
/** @public */
|
|
646
|
+
export declare class MAccidental extends MusicInterface {
|
|
647
|
+
private readonly obj;
|
|
648
|
+
static readonly Name = "Accidental";
|
|
649
|
+
getAccidental(): Accidental;
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
/** @public */
|
|
653
|
+
export declare class MArc extends MusicInterface {
|
|
654
|
+
private readonly obj;
|
|
655
|
+
static readonly Name = "Arc";
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
/** @public */
|
|
659
|
+
export declare class MArpeggio extends MusicInterface {
|
|
660
|
+
private readonly obj;
|
|
661
|
+
static readonly Name = "Arpeggio";
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
/** @public */
|
|
665
|
+
export declare const MaxNoteLength = NoteLength.Whole;
|
|
666
|
+
|
|
667
|
+
/** @public */
|
|
668
|
+
export declare class MBarLineLeft extends MusicInterface {
|
|
669
|
+
private readonly obj;
|
|
670
|
+
static readonly Name = "BarLineLeft";
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
/** @public */
|
|
674
|
+
export declare class MBarLineRight extends MusicInterface {
|
|
675
|
+
private readonly obj;
|
|
676
|
+
static readonly Name = "BarLineRight";
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
/** @public */
|
|
680
|
+
export declare class MBeamGroup extends MusicInterface {
|
|
681
|
+
private readonly obj;
|
|
682
|
+
static readonly Name = "BeamGroup";
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
/** @public */
|
|
686
|
+
export declare class MDocument extends MusicInterface {
|
|
687
|
+
static readonly Name = "Document";
|
|
688
|
+
constructor(staffKind: StaffKind, measuresPerRow?: number);
|
|
689
|
+
setHeader(title?: string, composer?: string, arranger?: string): void;
|
|
690
|
+
getTitle(): string | undefined;
|
|
691
|
+
addMeasure(): MMeasure;
|
|
692
|
+
updateCursorRect(cursorRect?: DivRect): void;
|
|
693
|
+
play(playStateChangeListener?: PlayStateChangeListener): MPlayer;
|
|
694
|
+
static createSimpleScaleArpeggio(staffKind: StaffKind, scale: Scale, lowestPitchNote: string, numOctaves: number): MDocument;
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
/** @public */
|
|
698
|
+
export declare class MEnding extends MusicInterface {
|
|
699
|
+
private readonly obj;
|
|
700
|
+
static readonly Name = "Ending";
|
|
701
|
+
getPassages(): ReadonlyArray<number>;
|
|
702
|
+
hasPassage(passage: number): boolean;
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
/** @public */
|
|
706
|
+
export declare class MExtensionLine extends MusicInterface {
|
|
707
|
+
private readonly obj;
|
|
708
|
+
static readonly Name = "ExtensionLine";
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
/** @public */
|
|
712
|
+
export declare class MFermata extends MusicInterface {
|
|
713
|
+
private readonly obj;
|
|
714
|
+
static readonly Name = "Fermata";
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
/** @public */
|
|
718
|
+
export declare class MHeader extends MusicInterface {
|
|
719
|
+
private readonly obj;
|
|
720
|
+
static readonly Name = "Header";
|
|
721
|
+
getTitle(): string | undefined;
|
|
722
|
+
getComposer(): string | undefined;
|
|
723
|
+
getArranger(): string | undefined;
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
/** @public */
|
|
727
|
+
export declare class MImage extends MusicInterface {
|
|
728
|
+
private readonly obj;
|
|
729
|
+
static readonly Name = "Image";
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
/** @public */
|
|
733
|
+
export declare const MinNoteLength = NoteLength.SixtyFourth;
|
|
734
|
+
|
|
735
|
+
/** @public */
|
|
736
|
+
export declare class MMeasure extends MusicInterface {
|
|
737
|
+
private readonly obj;
|
|
738
|
+
static readonly Name = "Measure";
|
|
739
|
+
getMeasureNumber(): number;
|
|
740
|
+
getRhythmColumns(): ReadonlyArray<MRhythmColumn>;
|
|
741
|
+
setKeySignature(keyNote: string, scaleType: ScaleType): MMeasure;
|
|
742
|
+
setKeySignature(keySignature: KeySignature): MMeasure;
|
|
743
|
+
setKeySignature(scale: Scale): MMeasure;
|
|
744
|
+
setTimeSignature(timeSignature: TimeSignature | TimeSignatureString): MMeasure;
|
|
745
|
+
setTempo(beatsPerMinute: number, beatLength?: NoteLength, dotted?: boolean): MMeasure;
|
|
746
|
+
addNote(voiceId: number, note: Note | string, noteLength: NoteLength, options?: NoteOptions): MMeasure;
|
|
747
|
+
addChord(voiceId: number, notes: (Note | string)[], noteLength: NoteLength, options?: NoteOptions): MMeasure;
|
|
748
|
+
addRest(voiceId: number, restLength: NoteLength, options?: RestOptions): MMeasure;
|
|
749
|
+
addFermata(fermata?: Fermata): MMeasure;
|
|
750
|
+
addNavigation(navigation: Navigation): MMeasure;
|
|
751
|
+
addNavigation(navigation: Navigation.EndRepeat, repeatCount: number): MMeasure;
|
|
752
|
+
addNavigation(navigation: Navigation.Ending, ...passages: number[]): MMeasure;
|
|
753
|
+
addLabel(label: Label, text: string): MMeasure;
|
|
754
|
+
addAnnotation(annotation: Annotation, text: string): MMeasure;
|
|
755
|
+
addExtension(extensionLength: NoteLength | number, extensionVisible?: boolean): MMeasure;
|
|
756
|
+
endSong(): MMeasure;
|
|
757
|
+
endSection(): MMeasure;
|
|
758
|
+
endRow(): MMeasure;
|
|
759
|
+
completeRests(voiceId?: number): MMeasure;
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
/** @public */
|
|
763
|
+
export declare class MNoteGroup extends MusicInterface {
|
|
764
|
+
private readonly obj;
|
|
765
|
+
static readonly Name = "NoteGroup";
|
|
766
|
+
getNotes(): ReadonlyArray<Note>;
|
|
767
|
+
getRhythmProps(): RhythmProps;
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
/** @public */
|
|
771
|
+
export declare class MPlaybackButtons {
|
|
772
|
+
private playButton?;
|
|
773
|
+
private stopButton?;
|
|
774
|
+
private playStopButton?;
|
|
775
|
+
private pauseButton?;
|
|
776
|
+
private onPlay;
|
|
777
|
+
private onStop;
|
|
778
|
+
private onPlayStop;
|
|
779
|
+
private onPause;
|
|
780
|
+
private playLabel;
|
|
781
|
+
private stopLabel;
|
|
782
|
+
private pauseLabel;
|
|
783
|
+
private playState;
|
|
784
|
+
private player?;
|
|
785
|
+
constructor();
|
|
786
|
+
setDocument(doc: MDocument | undefined): this;
|
|
787
|
+
detachDocument(): void;
|
|
788
|
+
private updateButtons;
|
|
789
|
+
setPlayButton(btn: HTMLButtonElement | string, btnLabel?: string): this;
|
|
790
|
+
setStopButton(btn: HTMLButtonElement | string, btnLabel?: string): this;
|
|
791
|
+
setPlayStopButton(btn: HTMLButtonElement | string, playLabel?: string, stopLabel?: string): this;
|
|
792
|
+
setPauseButton(btn: HTMLButtonElement | string, btnLabel?: string): this;
|
|
793
|
+
private static savedOnClickListeners;
|
|
794
|
+
private static removeOnClickListeners;
|
|
795
|
+
private static addOnClickListener;
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
/** @public */
|
|
799
|
+
export declare class MPlayer {
|
|
800
|
+
private static currentlyPlaying;
|
|
801
|
+
private readonly player;
|
|
802
|
+
constructor(doc: MDocument, playStateChangeListener?: PlayStateChangeListener);
|
|
803
|
+
static stopAll(): void;
|
|
804
|
+
play(): this;
|
|
805
|
+
pause(): this;
|
|
806
|
+
stop(): this;
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
/** @public */
|
|
810
|
+
export declare class MRenderer {
|
|
811
|
+
private readonly renderer;
|
|
812
|
+
constructor();
|
|
813
|
+
setDocument(doc?: MDocument): this;
|
|
814
|
+
setCanvas(canvas: HTMLCanvasElement | string): this;
|
|
815
|
+
setClickPitchListener(fn: ClickPitchListener): void;
|
|
816
|
+
setClickObjectSelector(fn?: ClickObjectSelector): void;
|
|
817
|
+
setClickObjectListener(fn?: ClickObjectListener): void;
|
|
818
|
+
draw(): void;
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
/** @public */
|
|
822
|
+
export declare class MRest extends MusicInterface {
|
|
823
|
+
private readonly obj;
|
|
824
|
+
static readonly Name = "Rest";
|
|
825
|
+
getRhythmProps(): RhythmProps;
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
/** @public */
|
|
829
|
+
export declare class MRhythmColumn extends MusicInterface {
|
|
830
|
+
private readonly obj;
|
|
831
|
+
static readonly Name = "RhythmColumn";
|
|
832
|
+
getRhythmSymbol(voiceId: number): MNoteGroup | MRest | undefined;
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
/** @public */
|
|
836
|
+
export declare class MScoreRow extends MusicInterface {
|
|
837
|
+
private readonly obj;
|
|
838
|
+
static readonly Name = "ScoreRow";
|
|
839
|
+
getMeasures(): ReadonlyArray<MMeasure>;
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
/** @public */
|
|
843
|
+
export declare class MSignature extends MusicInterface {
|
|
844
|
+
private readonly obj;
|
|
845
|
+
static readonly Name = "Signature";
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
/** @public */
|
|
849
|
+
export declare class MSpecialText extends MusicInterface {
|
|
850
|
+
private readonly obj;
|
|
851
|
+
static readonly Name = "SpecialText";
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
/** @public */
|
|
855
|
+
export declare class MText extends MusicInterface {
|
|
856
|
+
private readonly obj;
|
|
857
|
+
static readonly Name = "Text";
|
|
858
|
+
getText(): string;
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
/** @public */
|
|
862
|
+
export declare class MusicError extends Error {
|
|
863
|
+
constructor(msg: string);
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
/** @public */
|
|
867
|
+
export declare abstract class MusicInterface {
|
|
868
|
+
readonly name: string;
|
|
869
|
+
constructor(name: string);
|
|
870
|
+
getParent(): MusicInterface | undefined;
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
/**
|
|
874
|
+
* @public
|
|
875
|
+
*
|
|
876
|
+
* Usage:
|
|
877
|
+
*
|
|
878
|
+
* import * as Score from "\@tspro/web-music-score";
|
|
879
|
+
*
|
|
880
|
+
* \<Score.MusicScoreView doc=\{doc\} /\>
|
|
881
|
+
*/
|
|
882
|
+
export declare class MusicScoreView extends React_2.Component<MusicScoreViewProps, {}> {
|
|
883
|
+
renderer: MRenderer;
|
|
884
|
+
constructor(props: MusicScoreViewProps);
|
|
885
|
+
componentDidUpdate(prevProps: Readonly<MusicScoreViewProps>, prevState: Readonly<{}>): void;
|
|
886
|
+
render(): React_2.JSX.Element;
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
/** @public */
|
|
890
|
+
export declare interface MusicScoreViewProps {
|
|
891
|
+
doc: MDocument;
|
|
892
|
+
onClickPitch?: ClickPitchListener;
|
|
893
|
+
onSelectObject?: ClickObjectSelector;
|
|
894
|
+
onClickObject?: ClickObjectListener;
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
/** @public */
|
|
898
|
+
export declare type NaturalNote = "C" | "D" | "E" | "F" | "G" | "A" | "B";
|
|
899
|
+
|
|
900
|
+
/** @public */
|
|
901
|
+
export declare enum Navigation {
|
|
902
|
+
/** Repeat back to beginning and play to the "Fine" marking. */
|
|
903
|
+
DC_al_Fine = 0,
|
|
904
|
+
/** Repeat back to beginning and play to the "to Coda 𝄌", then jump to the "𝄌 Coda". */
|
|
905
|
+
DC_al_Coda = 1,
|
|
906
|
+
/** Repeat back to Segno sign (𝄋) and play to the "Fine" marking. */
|
|
907
|
+
DS_al_Fine = 2,
|
|
908
|
+
/** Repeat back to Segno sign (𝄋) and play to the "to Coda 𝄌", then jump to the "𝄌 Coda". */
|
|
909
|
+
DS_al_Coda = 3,
|
|
910
|
+
/** "𝄌 Coda" section. */
|
|
911
|
+
Coda = 4,
|
|
912
|
+
/** From "toCoda 𝄌" jump to the "𝄌 Coda" section. */
|
|
913
|
+
toCoda = 5,
|
|
914
|
+
/** Jump here from D.S. al Fine or D.S. al Coda. */
|
|
915
|
+
Segno = 6,
|
|
916
|
+
/** Stop playing after D.C. al Fine or D.S. al Fine. */
|
|
917
|
+
Fine = 7,
|
|
918
|
+
/** Start of repeat section. */
|
|
919
|
+
StartRepeat = 8,
|
|
920
|
+
/** End of repeat section. Jump to start of repeat section. */
|
|
921
|
+
EndRepeat = 9,
|
|
922
|
+
/** Jump to ending with correct passage number. */
|
|
923
|
+
Ending = 10
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
/** @public */
|
|
927
|
+
export declare class Note {
|
|
928
|
+
private static noteByNameCache;
|
|
929
|
+
private static noteByIdCache;
|
|
930
|
+
readonly pitch: number;
|
|
931
|
+
readonly accidental: Accidental;
|
|
932
|
+
constructor(pitch: number, accidental: number);
|
|
933
|
+
static getNote(noteName: string): Note;
|
|
934
|
+
static getNoteById(noteId: number, scale?: Scale): Note;
|
|
935
|
+
get pitchMod7(): number;
|
|
936
|
+
get octave(): number;
|
|
937
|
+
get noteId(): number;
|
|
938
|
+
get naturalNote(): NaturalNote;
|
|
939
|
+
getPitchInOctave(octave: number): number;
|
|
940
|
+
equals(note: Note): boolean;
|
|
941
|
+
format(pitchNotation: PitchNotation, symbolSet: SymbolSet): string;
|
|
942
|
+
formatOmitOctave(symbolSet: SymbolSet): string;
|
|
943
|
+
static replaceAccidentalSymbols(str: string, symbolSet: SymbolSet): string;
|
|
944
|
+
static isValidNoteName(noteName: string): boolean;
|
|
945
|
+
static parseNote(noteName: string): Readonly<ParsedNote> | undefined;
|
|
946
|
+
static getScientificNoteName(noteName: string, symbolSet: SymbolSet): string;
|
|
947
|
+
static getAccidentalSymbol(accidental: Accidental, symbolsSet: SymbolSet): string | undefined;
|
|
948
|
+
static getAccidental(accidentalSymbol: string): NonNullable<Accidental | undefined>;
|
|
949
|
+
static getNaturelNotePitch(naturalNote: string, octave?: number): number;
|
|
950
|
+
static getNaturalNote(pitch: number): NaturalNote;
|
|
951
|
+
static validatePitch(pitch: number): number;
|
|
952
|
+
static validateNoteId(noteId: number): number;
|
|
953
|
+
static validateNaturalNote(note: string): NaturalNote;
|
|
954
|
+
static validateOctave(octave: number): number;
|
|
955
|
+
static validateAccidental(acc: number): Accidental;
|
|
956
|
+
/**
|
|
957
|
+
* Sort notes by pitch in ascending order.
|
|
958
|
+
* @param notes - Array of notes.
|
|
959
|
+
* @returns Sorted array of notes.
|
|
960
|
+
*/
|
|
961
|
+
static sort(notes: ReadonlyArray<Note>): Note[];
|
|
962
|
+
/**
|
|
963
|
+
* Remove duplicate notes.
|
|
964
|
+
* @param notes - Array of notes.
|
|
965
|
+
* @returns Sorted set of notes.
|
|
966
|
+
*/
|
|
967
|
+
static removeDuplicates(notes: ReadonlyArray<Note>): Note[];
|
|
968
|
+
static compareFunc(a: Note, b: Note): 1 | -1 | 0;
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
/** @public */
|
|
972
|
+
export declare enum NoteLength {
|
|
973
|
+
Whole = 192,// * 3 because triplets are multiplied by 2 / 3, integer result
|
|
974
|
+
Half = 96,
|
|
975
|
+
Quarter = 48,
|
|
976
|
+
Eighth = 24,
|
|
977
|
+
Sixteenth = 12,
|
|
978
|
+
ThirtySecond = 6,
|
|
979
|
+
SixtyFourth = 3
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
/** @public */
|
|
983
|
+
export declare type NoteOptions = {
|
|
984
|
+
dotted?: boolean;
|
|
985
|
+
stem?: Stem;
|
|
986
|
+
color?: string;
|
|
987
|
+
arpeggio?: Arpeggio;
|
|
988
|
+
staccato?: boolean;
|
|
989
|
+
diamond?: boolean;
|
|
990
|
+
tieSpan?: number | TieLength;
|
|
991
|
+
tiePos?: ArcPos;
|
|
992
|
+
slurSpan?: number;
|
|
993
|
+
slurPos?: ArcPos;
|
|
994
|
+
triplet?: boolean;
|
|
995
|
+
};
|
|
996
|
+
|
|
997
|
+
/** @public */
|
|
998
|
+
export declare type ParsedNote = {
|
|
999
|
+
naturalNote: NaturalNote;
|
|
1000
|
+
accidental: Accidental;
|
|
1001
|
+
octave?: number;
|
|
1002
|
+
};
|
|
1003
|
+
|
|
1004
|
+
/** @public */
|
|
1005
|
+
export declare type PickedPitch = {
|
|
1006
|
+
pitch: number;
|
|
1007
|
+
measure: MMeasure;
|
|
1008
|
+
};
|
|
1009
|
+
|
|
1010
|
+
/** @public */
|
|
1011
|
+
export declare enum PitchNotation {
|
|
1012
|
+
Scientific = "Scientific",
|
|
1013
|
+
Helmholtz = "Helmholtz"
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
/** @public */
|
|
1017
|
+
export declare const PitchNotationList: PitchNotation[];
|
|
1018
|
+
|
|
1019
|
+
/**
|
|
1020
|
+
* @public
|
|
1021
|
+
*
|
|
1022
|
+
* Usage:
|
|
1023
|
+
*
|
|
1024
|
+
* import * as Score from "\@tspro/web-music-score";
|
|
1025
|
+
*
|
|
1026
|
+
* \<Score.PlaybackButtons doc=\{doc\} /\>
|
|
1027
|
+
*
|
|
1028
|
+
* To set custom play, pause and stop labels:
|
|
1029
|
+
*
|
|
1030
|
+
* \<Score.PlaybackButtons doc=\{doc\} playLabel="⏵" pauseLabel="⏸" stopLabel="⏹" /\>
|
|
1031
|
+
*
|
|
1032
|
+
* To use different button layout.
|
|
1033
|
+
*
|
|
1034
|
+
* \<Score.PlaybackButtons doc=\{doc\} buttonLayout=\{Score.PlaybackButtonsLayout.PlayStopSingle\} /\>
|
|
1035
|
+
*
|
|
1036
|
+
*/
|
|
1037
|
+
export declare class PlaybackButtons extends React_2.Component<PlaybackButtonsProps, PlaybackButtonsState> {
|
|
1038
|
+
state: PlaybackButtonsState;
|
|
1039
|
+
constructor(props: PlaybackButtonsProps);
|
|
1040
|
+
componentDidUpdate(prevProps: Readonly<PlaybackButtonsProps>): void;
|
|
1041
|
+
render(): React_2.JSX.Element;
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
/** @public */
|
|
1045
|
+
export declare enum PlaybackButtonsLayout {
|
|
1046
|
+
PlayStopSingle = 0,
|
|
1047
|
+
PlayStop = 1,
|
|
1048
|
+
PlayPauseStop = 2
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
/** @public */
|
|
1052
|
+
export declare interface PlaybackButtonsProps {
|
|
1053
|
+
doc: MDocument;
|
|
1054
|
+
buttonLayout?: PlaybackButtonsLayout;
|
|
1055
|
+
playLabel?: string;
|
|
1056
|
+
pauseLabel?: string;
|
|
1057
|
+
stopLabel?: string;
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1060
|
+
/** @public */
|
|
1061
|
+
export declare interface PlaybackButtonsState {
|
|
1062
|
+
controller: MPlaybackButtons;
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1065
|
+
/** @public */
|
|
1066
|
+
export declare enum PlayState {
|
|
1067
|
+
Playing = 0,
|
|
1068
|
+
Paused = 1,
|
|
1069
|
+
Stopped = 2
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
/** @public */
|
|
1073
|
+
export declare type PlayStateChangeListener = (playState: PlayState) => void;
|
|
1074
|
+
|
|
1075
|
+
/** @public */
|
|
1076
|
+
export declare type RestOptions = {
|
|
1077
|
+
dotted?: boolean;
|
|
1078
|
+
pitch?: string | Note;
|
|
1079
|
+
color?: string;
|
|
1080
|
+
hide?: boolean;
|
|
1081
|
+
triplet?: boolean;
|
|
1082
|
+
};
|
|
1083
|
+
|
|
1084
|
+
/** @public */
|
|
1085
|
+
export declare class RhythmProps {
|
|
1086
|
+
readonly noteLength: NoteLength;
|
|
1087
|
+
readonly dotted: boolean;
|
|
1088
|
+
readonly triplet: boolean;
|
|
1089
|
+
readonly ticks: number;
|
|
1090
|
+
readonly flagCount: number;
|
|
1091
|
+
constructor(noteLength: NoteLength, dotted?: boolean, triplet?: boolean);
|
|
1092
|
+
static createFromNoteSize(noteSize: number): RhythmProps;
|
|
1093
|
+
canDot(): boolean;
|
|
1094
|
+
hasStem(): boolean;
|
|
1095
|
+
toString(): string;
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
export declare namespace SamplePieces {
|
|
1099
|
+
export {
|
|
1100
|
+
createFrereJacques,
|
|
1101
|
+
createGreensleeves,
|
|
1102
|
+
createAndanteByDiabelli
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
/** @public */
|
|
1107
|
+
export declare class Scale {
|
|
1108
|
+
readonly keyNote: string;
|
|
1109
|
+
readonly scaleType: ScaleType;
|
|
1110
|
+
private readonly keySignature;
|
|
1111
|
+
private readonly scaleDegrees;
|
|
1112
|
+
private readonly accidentalNotes;
|
|
1113
|
+
constructor(keyNote: string, scaleType: ScaleType);
|
|
1114
|
+
equals(o: Scale): boolean;
|
|
1115
|
+
static parseDegree(degree: number | string): {
|
|
1116
|
+
deg: number;
|
|
1117
|
+
acc: number;
|
|
1118
|
+
};
|
|
1119
|
+
getScaleName(symbolSet?: SymbolSet): string;
|
|
1120
|
+
getScaleNotes(lowestPitchNote: string, numOctaves: number): Note[];
|
|
1121
|
+
getScaleOverview(): string;
|
|
1122
|
+
getScaleSteps(): number[];
|
|
1123
|
+
getScaleStringSteps(): string[];
|
|
1124
|
+
getKeySignature(): KeySignature;
|
|
1125
|
+
getAccidental(pitch: number): Accidental;
|
|
1126
|
+
isScaleNote(note: Note): boolean;
|
|
1127
|
+
isScaleRootNote(note: Note): boolean;
|
|
1128
|
+
getIntervalFromRootNote(note: Note): Interval;
|
|
1129
|
+
getPreferredNote(noteId: number): Note;
|
|
1130
|
+
private preferredChromaticNoteCache;
|
|
1131
|
+
private getPreferredChromaticNote;
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
/** @public */
|
|
1135
|
+
export declare class ScaleFactory {
|
|
1136
|
+
readonly type: ScaleType;
|
|
1137
|
+
private keyNoteList;
|
|
1138
|
+
private scaleMap;
|
|
1139
|
+
constructor(type: ScaleType);
|
|
1140
|
+
getKeyNoteList(): ReadonlyArray<string>;
|
|
1141
|
+
getDefaultKeyNote(): string;
|
|
1142
|
+
getType(): ScaleType;
|
|
1143
|
+
getScale(keyNote: string): Scale;
|
|
1144
|
+
hasScale(keyNote: string): boolean;
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1147
|
+
/** @public */
|
|
1148
|
+
export declare enum ScaleType {
|
|
1149
|
+
Major = "Major",
|
|
1150
|
+
NaturalMinor = "Natural Minor",
|
|
1151
|
+
HarmonicMinor = "Harmonic Minor",
|
|
1152
|
+
Ionian = "Ionian",
|
|
1153
|
+
Dorian = "Dorian",
|
|
1154
|
+
Phrygian = "Phrygian",
|
|
1155
|
+
Lydian = "Lydian",
|
|
1156
|
+
Mixolydian = "Mixolydian",
|
|
1157
|
+
Aeolian = "Aeolian",
|
|
1158
|
+
Locrian = "Locrian",
|
|
1159
|
+
MajorPentatonic = "Major Pentatonic",
|
|
1160
|
+
MinorPentatonic = "Minor Pentatonic",
|
|
1161
|
+
MajorHexatonicBlues = "Major Hexatonic Blues",
|
|
1162
|
+
MinorHexatonicBlues = "Minor Hexatonic Blues",
|
|
1163
|
+
HeptatonicBlues = "Heptatonic Blues"
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1166
|
+
/** @public */
|
|
1167
|
+
export declare enum StaffKind {
|
|
1168
|
+
/** Treble staff has treble (G-) clef. */
|
|
1169
|
+
Treble = 0,
|
|
1170
|
+
/** TrebleForGuitar has treble clef but is one octave lower. */
|
|
1171
|
+
TrebleForGuitar = 1,
|
|
1172
|
+
/** Bass staff has bass (F-) clef. */
|
|
1173
|
+
Bass = 2,
|
|
1174
|
+
/** Grand staff has both treble and bass clefs. */
|
|
1175
|
+
Grand = 3
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1178
|
+
/** @public */
|
|
1179
|
+
export declare enum Stem {
|
|
1180
|
+
Auto = 0,
|
|
1181
|
+
Up = 1,
|
|
1182
|
+
Down = 2
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1185
|
+
/** @public */
|
|
1186
|
+
export declare enum SymbolSet {
|
|
1187
|
+
Ascii = 0,
|
|
1188
|
+
Unicode = 1
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1191
|
+
/** @public */
|
|
1192
|
+
export declare type Tempo = {
|
|
1193
|
+
beatsPerMinute: number;
|
|
1194
|
+
options: {
|
|
1195
|
+
beatLength: NoteLength;
|
|
1196
|
+
dotted: boolean;
|
|
1197
|
+
};
|
|
1198
|
+
};
|
|
1199
|
+
|
|
1200
|
+
/** @public */
|
|
1201
|
+
export declare enum TieLength {
|
|
1202
|
+
Short = "Short",
|
|
1203
|
+
ToMeasureEnd = "ToMeasureEnd"
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
/** @public */
|
|
1207
|
+
export declare class TimeSignature {
|
|
1208
|
+
readonly beatCount: number;
|
|
1209
|
+
readonly beatSize: number;
|
|
1210
|
+
/** Lengths in ticks */
|
|
1211
|
+
readonly beatLength: NoteLength;
|
|
1212
|
+
readonly measureTicks: number;
|
|
1213
|
+
readonly beamGroupCount: number;
|
|
1214
|
+
readonly beamGroupLength: number;
|
|
1215
|
+
/**
|
|
1216
|
+
* @param str - For example "4/4".
|
|
1217
|
+
*/
|
|
1218
|
+
constructor(str: TimeSignatureString);
|
|
1219
|
+
/**
|
|
1220
|
+
* @param beatCount - Measure beat count.
|
|
1221
|
+
* @param beatSize - Size value: whole-note=1, half-note=2, quarter-note=4, etc.
|
|
1222
|
+
*/
|
|
1223
|
+
constructor(beatCount: number, beatSize: number);
|
|
1224
|
+
is(beatCount: number, beatSize: number): boolean;
|
|
1225
|
+
toString(): string;
|
|
1226
|
+
}
|
|
1227
|
+
|
|
1228
|
+
/** @public */
|
|
1229
|
+
export declare type TimeSignatureString = "2/4" | "3/4" | "4/4" | "6/8" | "9/8";
|
|
1230
|
+
|
|
1231
|
+
/** @public */
|
|
1232
|
+
export declare const TuningNameList: ReadonlyArray<string>;
|
|
1233
|
+
|
|
1234
|
+
/** @public */
|
|
1235
|
+
export declare type UpdateGuitarNoteFunc = (guitarNote: GuitarNote) => void;
|
|
1236
|
+
|
|
1237
|
+
/** @public */
|
|
1238
|
+
export declare function validateGuitarNoteLabel(kind: string): GuitarNoteLabel;
|
|
1239
|
+
|
|
1240
|
+
/** @public */
|
|
1241
|
+
export declare function validateHandedness(handedness: string): Handedness;
|
|
1242
|
+
|
|
1243
|
+
/** @public */
|
|
1244
|
+
export declare function validateIntervalQuality(q: string): IntervalQuality;
|
|
1245
|
+
|
|
1246
|
+
/** @public */
|
|
1247
|
+
export declare function validateNoteLength(noteLength: unknown): NoteLength;
|
|
1248
|
+
|
|
1249
|
+
/** @public */
|
|
1250
|
+
export declare function validatePitchNotation(pn: string): PitchNotation;
|
|
1251
|
+
|
|
1252
|
+
/** @public */
|
|
1253
|
+
export declare function validateScaleType(scaleTypeStr: string): ScaleType;
|
|
1254
|
+
|
|
1255
|
+
/** @public */
|
|
1256
|
+
export declare function validateTuningName(tuningName: string): string;
|
|
1257
|
+
|
|
1258
|
+
export { }
|