@scorelabs/core 1.0.7 → 1.0.9
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/dist/importers/MusicXMLParser.d.ts +2 -2
- package/dist/importers/MusicXMLParser.js +75 -17
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/models/Instrument.d.ts +8 -19
- package/dist/models/Instrument.js +77 -23
- package/dist/models/Measure.d.ts +2 -0
- package/dist/models/Measure.js +6 -0
- package/dist/models/NoteSet.d.ts +40 -38
- package/dist/models/NoteSet.js +5 -2
- package/dist/models/Pitch.js +4 -0
- package/dist/models/PreMeasure.d.ts +24 -0
- package/dist/models/PreMeasure.js +30 -0
- package/dist/models/Score.d.ts +16 -1
- package/dist/models/Score.js +190 -5
- package/dist/models/index.d.ts +1 -0
- package/dist/models/index.js +1 -0
- package/dist/models/types.d.ts +2 -213
- package/dist/models/types.js +2 -213
- package/dist/types/Accidental.d.ts +7 -0
- package/dist/types/Accidental.js +8 -0
- package/dist/types/Arpeggio.d.ts +5 -0
- package/dist/types/Arpeggio.js +6 -0
- package/dist/types/Articulation.d.ts +10 -0
- package/dist/types/Articulation.js +11 -0
- package/dist/types/BarlineStyle.d.ts +9 -0
- package/dist/types/BarlineStyle.js +10 -0
- package/dist/types/Bowing.d.ts +4 -0
- package/dist/types/Bowing.js +5 -0
- package/dist/types/Clef.d.ts +10 -0
- package/dist/types/Clef.js +11 -0
- package/dist/types/Duration.d.ts +20 -0
- package/dist/types/Duration.js +60 -0
- package/dist/types/Dynamic.d.ts +12 -0
- package/dist/types/Dynamic.js +13 -0
- package/dist/types/Fretboard.d.ts +19 -0
- package/dist/types/Fretboard.js +1 -0
- package/dist/types/Genre.d.ts +27 -0
- package/dist/types/Genre.js +28 -0
- package/dist/types/Glissando.d.ts +8 -0
- package/dist/types/Glissando.js +5 -0
- package/dist/types/Hairpin.d.ts +10 -0
- package/dist/types/Hairpin.js +11 -0
- package/dist/types/InstrumentPreset.d.ts +11 -0
- package/dist/types/InstrumentPreset.js +12 -0
- package/dist/types/InstrumentType.d.ts +8 -0
- package/dist/types/InstrumentType.js +9 -0
- package/dist/types/KeySignature.d.ts +3 -0
- package/dist/types/KeySignature.js +1 -0
- package/dist/types/Lyric.d.ts +11 -0
- package/dist/types/Lyric.js +7 -0
- package/dist/types/NoteheadShape.d.ts +8 -0
- package/dist/types/NoteheadShape.js +9 -0
- package/dist/types/Ornament.d.ts +8 -0
- package/dist/types/Ornament.js +9 -0
- package/dist/types/Ottava.d.ts +10 -0
- package/dist/types/Ottava.js +7 -0
- package/dist/types/Pedal.d.ts +4 -0
- package/dist/types/Pedal.js +1 -0
- package/dist/types/Repeat.d.ts +8 -0
- package/dist/types/Repeat.js +1 -0
- package/dist/types/Slur.d.ts +4 -0
- package/dist/types/Slur.js +1 -0
- package/dist/types/StemDirection.d.ts +4 -0
- package/dist/types/StemDirection.js +5 -0
- package/dist/types/Tempo.d.ts +8 -0
- package/dist/types/Tempo.js +1 -0
- package/dist/types/TimeSignature.d.ts +6 -0
- package/dist/types/TimeSignature.js +3 -0
- package/dist/types/Tuplet.d.ts +5 -0
- package/dist/types/Tuplet.js +1 -0
- package/dist/types/index.d.ts +26 -0
- package/dist/types/index.js +26 -0
- package/package.json +1 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export var Accidental;
|
|
2
|
+
(function (Accidental) {
|
|
3
|
+
Accidental["Sharp"] = "sharp";
|
|
4
|
+
Accidental["Flat"] = "flat";
|
|
5
|
+
Accidental["Natural"] = "natural";
|
|
6
|
+
Accidental["DoubleSharp"] = "double-sharp";
|
|
7
|
+
Accidental["DoubleFlat"] = "double-flat";
|
|
8
|
+
})(Accidental || (Accidental = {}));
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export var Articulation;
|
|
2
|
+
(function (Articulation) {
|
|
3
|
+
Articulation["Staccato"] = "staccato";
|
|
4
|
+
Articulation["Accent"] = "accent";
|
|
5
|
+
Articulation["Tenuto"] = "tenuto";
|
|
6
|
+
Articulation["Marcato"] = "marcato";
|
|
7
|
+
Articulation["Fermata"] = "fermata";
|
|
8
|
+
Articulation["Staccatissimo"] = "staccatissimo";
|
|
9
|
+
Articulation["Caesura"] = "caesura";
|
|
10
|
+
Articulation["BreathMark"] = "breath-mark";
|
|
11
|
+
})(Articulation || (Articulation = {}));
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export var BarlineStyle;
|
|
2
|
+
(function (BarlineStyle) {
|
|
3
|
+
BarlineStyle["Regular"] = "regular";
|
|
4
|
+
BarlineStyle["Double"] = "light-light";
|
|
5
|
+
BarlineStyle["Final"] = "light-heavy";
|
|
6
|
+
BarlineStyle["Dotted"] = "dotted";
|
|
7
|
+
BarlineStyle["Dashed"] = "dashed";
|
|
8
|
+
BarlineStyle["Heavy"] = "heavy";
|
|
9
|
+
BarlineStyle["None"] = "none";
|
|
10
|
+
})(BarlineStyle || (BarlineStyle = {}));
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export var Clef;
|
|
2
|
+
(function (Clef) {
|
|
3
|
+
Clef["Treble"] = "treble";
|
|
4
|
+
Clef["Bass"] = "bass";
|
|
5
|
+
Clef["Alto"] = "alto";
|
|
6
|
+
Clef["Tenor"] = "tenor";
|
|
7
|
+
Clef["Percussion"] = "percussion";
|
|
8
|
+
Clef["Tab"] = "tab";
|
|
9
|
+
Clef["Treble8vaBassa"] = "treble8vabassa";
|
|
10
|
+
Clef["Bass8vaBassa"] = "bass8vabassa";
|
|
11
|
+
})(Clef || (Clef = {}));
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare enum Duration {
|
|
2
|
+
Whole = "whole",
|
|
3
|
+
Half = "half",
|
|
4
|
+
Quarter = "quarter",
|
|
5
|
+
Eighth = "eighth",
|
|
6
|
+
Sixteenth = "sixteenth",
|
|
7
|
+
ThirtySecond = "thirty-second",
|
|
8
|
+
SixtyFourth = "sixty-fourth",
|
|
9
|
+
OneHundredTwentyEighth = "one-hundred-twenty-eighth",
|
|
10
|
+
TwoHundredFiftySixth = "two-hundred-fifty-sixth"
|
|
11
|
+
}
|
|
12
|
+
export declare const DURATION_VALUES: Record<Duration, number>;
|
|
13
|
+
/**
|
|
14
|
+
* Decomposes a duration value (quarter = 1) into a list of duration/dot pairs.
|
|
15
|
+
*/
|
|
16
|
+
export declare function decomposeDuration(value: number): {
|
|
17
|
+
duration: Duration;
|
|
18
|
+
isDotted: boolean;
|
|
19
|
+
val: number;
|
|
20
|
+
}[];
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export var Duration;
|
|
2
|
+
(function (Duration) {
|
|
3
|
+
Duration["Whole"] = "whole";
|
|
4
|
+
Duration["Half"] = "half";
|
|
5
|
+
Duration["Quarter"] = "quarter";
|
|
6
|
+
Duration["Eighth"] = "eighth";
|
|
7
|
+
Duration["Sixteenth"] = "sixteenth";
|
|
8
|
+
Duration["ThirtySecond"] = "thirty-second";
|
|
9
|
+
Duration["SixtyFourth"] = "sixty-fourth";
|
|
10
|
+
Duration["OneHundredTwentyEighth"] = "one-hundred-twenty-eighth";
|
|
11
|
+
Duration["TwoHundredFiftySixth"] = "two-hundred-fifty-sixth";
|
|
12
|
+
})(Duration || (Duration = {}));
|
|
13
|
+
// Duration values in terms of quarter note = 1
|
|
14
|
+
export const DURATION_VALUES = {
|
|
15
|
+
[Duration.Whole]: 4,
|
|
16
|
+
[Duration.Half]: 2,
|
|
17
|
+
[Duration.Quarter]: 1,
|
|
18
|
+
[Duration.Eighth]: 0.5,
|
|
19
|
+
[Duration.Sixteenth]: 0.25,
|
|
20
|
+
[Duration.ThirtySecond]: 0.125,
|
|
21
|
+
[Duration.SixtyFourth]: 0.0625,
|
|
22
|
+
[Duration.OneHundredTwentyEighth]: 0.03125,
|
|
23
|
+
[Duration.TwoHundredFiftySixth]: 0.015625,
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Decomposes a duration value (quarter = 1) into a list of duration/dot pairs.
|
|
27
|
+
*/
|
|
28
|
+
export function decomposeDuration(value) {
|
|
29
|
+
const result = [];
|
|
30
|
+
let remaining = value;
|
|
31
|
+
const options = [
|
|
32
|
+
{ val: 4, dur: Duration.Whole, dot: false },
|
|
33
|
+
{ val: 3, dur: Duration.Half, dot: true },
|
|
34
|
+
{ val: 2, dur: Duration.Half, dot: false },
|
|
35
|
+
{ val: 1.5, dur: Duration.Quarter, dot: true },
|
|
36
|
+
{ val: 1, dur: Duration.Quarter, dot: false },
|
|
37
|
+
{ val: 0.75, dur: Duration.Eighth, dot: true },
|
|
38
|
+
{ val: 0.5, dur: Duration.Eighth, dot: false },
|
|
39
|
+
{ val: 0.375, dur: Duration.Sixteenth, dot: true },
|
|
40
|
+
{ val: 0.25, dur: Duration.Sixteenth, dot: false },
|
|
41
|
+
{ val: 0.1875, dur: Duration.ThirtySecond, dot: true },
|
|
42
|
+
{ val: 0.125, dur: Duration.ThirtySecond, dot: false },
|
|
43
|
+
{ val: 0.09375, dur: Duration.SixtyFourth, dot: true },
|
|
44
|
+
{ val: 0.0625, dur: Duration.SixtyFourth, dot: false },
|
|
45
|
+
];
|
|
46
|
+
// Protect against infinite loop with max iterations
|
|
47
|
+
let loops = 0;
|
|
48
|
+
while (remaining > 0.001 && loops < 100) {
|
|
49
|
+
const match = options.find((o) => o.val <= remaining + 0.001);
|
|
50
|
+
if (match) {
|
|
51
|
+
result.push({ duration: match.dur, isDotted: match.dot, val: match.val });
|
|
52
|
+
remaining -= match.val;
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
loops++;
|
|
58
|
+
}
|
|
59
|
+
return result;
|
|
60
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export var Dynamic;
|
|
2
|
+
(function (Dynamic) {
|
|
3
|
+
Dynamic["PPP"] = "ppp";
|
|
4
|
+
Dynamic["PP"] = "pp";
|
|
5
|
+
Dynamic["P"] = "p";
|
|
6
|
+
Dynamic["MP"] = "mp";
|
|
7
|
+
Dynamic["MF"] = "mf";
|
|
8
|
+
Dynamic["F"] = "f";
|
|
9
|
+
Dynamic["FF"] = "ff";
|
|
10
|
+
Dynamic["FFF"] = "fff";
|
|
11
|
+
Dynamic["SFZ"] = "sfz";
|
|
12
|
+
Dynamic["FP"] = "fp";
|
|
13
|
+
})(Dynamic || (Dynamic = {}));
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface FretboardDot {
|
|
2
|
+
string: number;
|
|
3
|
+
fret: number;
|
|
4
|
+
label?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface FretboardBarre {
|
|
7
|
+
fret: number;
|
|
8
|
+
startString: number;
|
|
9
|
+
endString: number;
|
|
10
|
+
}
|
|
11
|
+
export interface FretboardDiagram {
|
|
12
|
+
strings: number;
|
|
13
|
+
frets: number;
|
|
14
|
+
startingFret?: number;
|
|
15
|
+
dots: FretboardDot[];
|
|
16
|
+
barres?: FretboardBarre[];
|
|
17
|
+
openStrings?: number[];
|
|
18
|
+
mutedStrings?: number[];
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare enum Genre {
|
|
2
|
+
Blues = "Blues",
|
|
3
|
+
Children = "Children",
|
|
4
|
+
Christian = "Christian",
|
|
5
|
+
Christmas = "Christmas",
|
|
6
|
+
Classical = "Classical",
|
|
7
|
+
ContestFestival = "Contest/Festival",
|
|
8
|
+
Country = "Country",
|
|
9
|
+
Educational = "Educational",
|
|
10
|
+
FilmTV = "Film/TV",
|
|
11
|
+
Folk = "Folk",
|
|
12
|
+
Games = "Games",
|
|
13
|
+
Gospel = "Gospel",
|
|
14
|
+
Holiday = "Holiday",
|
|
15
|
+
Jazz = "Jazz",
|
|
16
|
+
Latin = "Latin",
|
|
17
|
+
Musicals = "Musicals",
|
|
18
|
+
Pop = "Pop",
|
|
19
|
+
RBHipHop = "R&B/Hip-Hop",
|
|
20
|
+
Rock = "Rock",
|
|
21
|
+
Standards = "Standards",
|
|
22
|
+
Traditional = "Traditional",
|
|
23
|
+
Wedding = "Wedding",
|
|
24
|
+
World = "World",
|
|
25
|
+
Worship = "Worship",
|
|
26
|
+
Unknown = "unknown"
|
|
27
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export var Genre;
|
|
2
|
+
(function (Genre) {
|
|
3
|
+
Genre["Blues"] = "Blues";
|
|
4
|
+
Genre["Children"] = "Children";
|
|
5
|
+
Genre["Christian"] = "Christian";
|
|
6
|
+
Genre["Christmas"] = "Christmas";
|
|
7
|
+
Genre["Classical"] = "Classical";
|
|
8
|
+
Genre["ContestFestival"] = "Contest/Festival";
|
|
9
|
+
Genre["Country"] = "Country";
|
|
10
|
+
Genre["Educational"] = "Educational";
|
|
11
|
+
Genre["FilmTV"] = "Film/TV";
|
|
12
|
+
Genre["Folk"] = "Folk";
|
|
13
|
+
Genre["Games"] = "Games";
|
|
14
|
+
Genre["Gospel"] = "Gospel";
|
|
15
|
+
Genre["Holiday"] = "Holiday";
|
|
16
|
+
Genre["Jazz"] = "Jazz";
|
|
17
|
+
Genre["Latin"] = "Latin";
|
|
18
|
+
Genre["Musicals"] = "Musicals";
|
|
19
|
+
Genre["Pop"] = "Pop";
|
|
20
|
+
Genre["RBHipHop"] = "R&B/Hip-Hop";
|
|
21
|
+
Genre["Rock"] = "Rock";
|
|
22
|
+
Genre["Standards"] = "Standards";
|
|
23
|
+
Genre["Traditional"] = "Traditional";
|
|
24
|
+
Genre["Wedding"] = "Wedding";
|
|
25
|
+
Genre["World"] = "World";
|
|
26
|
+
Genre["Worship"] = "Worship";
|
|
27
|
+
Genre["Unknown"] = "unknown";
|
|
28
|
+
})(Genre || (Genre = {}));
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare enum HairpinType {
|
|
2
|
+
Crescendo = "crescendo",
|
|
3
|
+
Decrescendo = "decrescendo"
|
|
4
|
+
}
|
|
5
|
+
export interface Hairpin {
|
|
6
|
+
type: HairpinType;
|
|
7
|
+
placement: 'start' | 'stop';
|
|
8
|
+
}
|
|
9
|
+
export declare function isCrescendo(hairpin: Hairpin): boolean;
|
|
10
|
+
export declare function isDecrescendo(hairpin: Hairpin): boolean;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export var HairpinType;
|
|
2
|
+
(function (HairpinType) {
|
|
3
|
+
HairpinType["Crescendo"] = "crescendo";
|
|
4
|
+
HairpinType["Decrescendo"] = "decrescendo";
|
|
5
|
+
})(HairpinType || (HairpinType = {}));
|
|
6
|
+
export function isCrescendo(hairpin) {
|
|
7
|
+
return hairpin.type === HairpinType.Crescendo;
|
|
8
|
+
}
|
|
9
|
+
export function isDecrescendo(hairpin) {
|
|
10
|
+
return hairpin.type === HairpinType.Decrescendo;
|
|
11
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export var InstrumentPreset;
|
|
2
|
+
(function (InstrumentPreset) {
|
|
3
|
+
InstrumentPreset["Piano"] = "piano";
|
|
4
|
+
InstrumentPreset["Violin"] = "violin";
|
|
5
|
+
InstrumentPreset["Cello"] = "cello";
|
|
6
|
+
InstrumentPreset["Guitar"] = "guitar";
|
|
7
|
+
InstrumentPreset["ElectricGuitar"] = "electric-guitar";
|
|
8
|
+
InstrumentPreset["Bass"] = "bass";
|
|
9
|
+
InstrumentPreset["Flute"] = "flute";
|
|
10
|
+
InstrumentPreset["Trumpet"] = "trumpet";
|
|
11
|
+
InstrumentPreset["Drums"] = "drums";
|
|
12
|
+
})(InstrumentPreset || (InstrumentPreset = {}));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export var InstrumentType;
|
|
2
|
+
(function (InstrumentType) {
|
|
3
|
+
InstrumentType["String"] = "string";
|
|
4
|
+
InstrumentType["Brass"] = "brass";
|
|
5
|
+
InstrumentType["Woodwind"] = "woodwind";
|
|
6
|
+
InstrumentType["Percussion"] = "percussion";
|
|
7
|
+
InstrumentType["Keyboard"] = "keyboard";
|
|
8
|
+
InstrumentType["Synth"] = "synth";
|
|
9
|
+
})(InstrumentType || (InstrumentType = {}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export var NoteheadShape;
|
|
2
|
+
(function (NoteheadShape) {
|
|
3
|
+
NoteheadShape["Normal"] = "normal";
|
|
4
|
+
NoteheadShape["Cross"] = "cross";
|
|
5
|
+
NoteheadShape["Diamond"] = "diamond";
|
|
6
|
+
NoteheadShape["Slash"] = "slash";
|
|
7
|
+
NoteheadShape["Triangle"] = "triangle";
|
|
8
|
+
NoteheadShape["Square"] = "square";
|
|
9
|
+
})(NoteheadShape || (NoteheadShape = {}));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export var Ornament;
|
|
2
|
+
(function (Ornament) {
|
|
3
|
+
Ornament["Trill"] = "trill";
|
|
4
|
+
Ornament["Mordent"] = "mordent";
|
|
5
|
+
Ornament["InvertedMordent"] = "inverted-mordent";
|
|
6
|
+
Ornament["Turn"] = "turn";
|
|
7
|
+
Ornament["InvertedTurn"] = "inverted-turn";
|
|
8
|
+
Ornament["Tremolo"] = "tremolo";
|
|
9
|
+
})(Ornament || (Ornament = {}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export * from './InstrumentPreset.js';
|
|
2
|
+
export * from './InstrumentType.js';
|
|
3
|
+
export * from './StemDirection.js';
|
|
4
|
+
export * from './Clef.js';
|
|
5
|
+
export * from './Duration.js';
|
|
6
|
+
export * from './Accidental.js';
|
|
7
|
+
export * from './Articulation.js';
|
|
8
|
+
export * from './Dynamic.js';
|
|
9
|
+
export * from './Genre.js';
|
|
10
|
+
export * from './BarlineStyle.js';
|
|
11
|
+
export * from './Lyric.js';
|
|
12
|
+
export * from './Bowing.js';
|
|
13
|
+
export * from './NoteheadShape.js';
|
|
14
|
+
export * from './Ornament.js';
|
|
15
|
+
export * from './Fretboard.js';
|
|
16
|
+
export * from './TimeSignature.js';
|
|
17
|
+
export * from './KeySignature.js';
|
|
18
|
+
export * from './Tempo.js';
|
|
19
|
+
export * from './Hairpin.js';
|
|
20
|
+
export * from './Ottava.js';
|
|
21
|
+
export * from './Arpeggio.js';
|
|
22
|
+
export * from './Glissando.js';
|
|
23
|
+
export * from './Pedal.js';
|
|
24
|
+
export * from './Slur.js';
|
|
25
|
+
export * from './Tuplet.js';
|
|
26
|
+
export * from './Repeat.js';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export * from './InstrumentPreset.js';
|
|
2
|
+
export * from './InstrumentType.js';
|
|
3
|
+
export * from './StemDirection.js';
|
|
4
|
+
export * from './Clef.js';
|
|
5
|
+
export * from './Duration.js';
|
|
6
|
+
export * from './Accidental.js';
|
|
7
|
+
export * from './Articulation.js';
|
|
8
|
+
export * from './Dynamic.js';
|
|
9
|
+
export * from './Genre.js';
|
|
10
|
+
export * from './BarlineStyle.js';
|
|
11
|
+
export * from './Lyric.js';
|
|
12
|
+
export * from './Bowing.js';
|
|
13
|
+
export * from './NoteheadShape.js';
|
|
14
|
+
export * from './Ornament.js';
|
|
15
|
+
export * from './Fretboard.js';
|
|
16
|
+
export * from './TimeSignature.js';
|
|
17
|
+
export * from './KeySignature.js';
|
|
18
|
+
export * from './Tempo.js';
|
|
19
|
+
export * from './Hairpin.js';
|
|
20
|
+
export * from './Ottava.js';
|
|
21
|
+
export * from './Arpeggio.js';
|
|
22
|
+
export * from './Glissando.js';
|
|
23
|
+
export * from './Pedal.js';
|
|
24
|
+
export * from './Slur.js';
|
|
25
|
+
export * from './Tuplet.js';
|
|
26
|
+
export * from './Repeat.js';
|