@scorelabs/core 1.0.10 → 1.0.13
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/constants.d.ts +4 -0
- package/dist/constants.js +10 -0
- package/dist/importers/MusicXMLParser.d.ts +4 -1
- package/dist/importers/MusicXMLParser.js +564 -75
- package/dist/importers/index.d.ts +1 -1
- package/dist/importers/index.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/models/Measure.d.ts +25 -5
- package/dist/models/Measure.js +173 -35
- package/dist/models/Note.d.ts +38 -9
- package/dist/models/Note.js +104 -47
- package/dist/models/NoteSet.d.ts +14 -4
- package/dist/models/NoteSet.js +38 -4
- package/dist/models/Part.d.ts +6 -6
- package/dist/models/Part.js +4 -4
- package/dist/models/Pitch.d.ts +1 -1
- package/dist/models/Pitch.js +1 -1
- package/dist/models/PreMeasure.d.ts +1 -1
- package/dist/models/Score.d.ts +13 -9
- package/dist/models/Score.js +164 -126
- package/dist/models/Staff.d.ts +5 -5
- package/dist/models/Staff.js +4 -4
- package/dist/models/index.d.ts +10 -10
- package/dist/models/index.js +10 -10
- package/dist/types/AccidentalDisplay.d.ts +6 -0
- package/dist/types/AccidentalDisplay.js +1 -0
- package/dist/types/Arpeggio.d.ts +2 -1
- package/dist/types/Arpeggio.js +1 -0
- package/dist/types/Articulation.d.ts +3 -1
- package/dist/types/Articulation.js +2 -0
- package/dist/types/Beam.d.ts +4 -0
- package/dist/types/Beam.js +1 -0
- package/dist/types/Duration.d.ts +5 -1
- package/dist/types/Duration.js +27 -14
- package/dist/types/Grace.d.ts +7 -0
- package/dist/types/Grace.js +1 -0
- package/dist/types/Hairpin.d.ts +2 -1
- package/dist/types/Language.d.ts +6 -0
- package/dist/types/Language.js +7 -0
- package/dist/types/Lyric.d.ts +2 -0
- package/dist/types/Ornament.d.ts +23 -1
- package/dist/types/Ornament.js +9 -0
- package/dist/types/Pedal.d.ts +3 -2
- package/dist/types/Placement.d.ts +7 -0
- package/dist/types/Placement.js +1 -0
- package/dist/types/Repeat.d.ts +1 -0
- package/dist/types/RestDisplay.d.ts +6 -0
- package/dist/types/RestDisplay.js +1 -0
- package/dist/types/Slur.d.ts +1 -0
- package/dist/types/Technical.d.ts +20 -0
- package/dist/types/Technical.js +5 -0
- package/dist/types/Tempo.d.ts +1 -1
- package/dist/types/Tie.d.ts +4 -0
- package/dist/types/Tie.js +1 -0
- package/dist/types/Tuplet.d.ts +6 -0
- package/dist/types/User.d.ts +13 -7
- package/dist/types/User.js +9 -7
- package/dist/types/index.d.ts +8 -0
- package/dist/types/index.js +8 -0
- package/package.json +2 -1
package/dist/models/Note.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import { Pitch } from './Pitch';
|
|
2
|
-
import { Accidental,
|
|
3
|
-
/**
|
|
4
|
-
* Represents a single note or rest in a measure.
|
|
5
|
-
*/
|
|
1
|
+
import { Pitch } from './Pitch.js';
|
|
2
|
+
import { Accidental, Duration, calculateDurationValue, } from './types.js';
|
|
6
3
|
export class Note {
|
|
7
4
|
duration;
|
|
8
5
|
pitch;
|
|
9
6
|
isRest;
|
|
10
|
-
|
|
7
|
+
dotCount;
|
|
11
8
|
accidental;
|
|
12
9
|
beamGroup;
|
|
13
10
|
articulations;
|
|
@@ -17,6 +14,7 @@ export class Note {
|
|
|
17
14
|
tuplet;
|
|
18
15
|
hairpin;
|
|
19
16
|
isGrace;
|
|
17
|
+
isCue;
|
|
20
18
|
lyric;
|
|
21
19
|
chord;
|
|
22
20
|
glissando;
|
|
@@ -38,13 +36,24 @@ export class Note {
|
|
|
38
36
|
palmMute;
|
|
39
37
|
hammerOn;
|
|
40
38
|
pullOff;
|
|
39
|
+
tieSpans;
|
|
40
|
+
slurs;
|
|
41
|
+
beamLevels;
|
|
42
|
+
grace;
|
|
43
|
+
accidentalDisplay;
|
|
44
|
+
restDisplay;
|
|
45
|
+
ornamentDetails;
|
|
46
|
+
harmonic;
|
|
47
|
+
bend;
|
|
48
|
+
vibrato;
|
|
49
|
+
placement;
|
|
41
50
|
constructor(duration, pitch, // undefined for rests
|
|
42
|
-
isRest = false,
|
|
43
|
-
articulations = [], dynamic, tie, slur, tuplet, hairpin, isGrace = false, lyric, chord, glissando, arpeggio, ottava, pedal, ornament, fret, string, fretboardDiagram, lyrics, staffText, color, notehead, bowing, fingering, stemDirection, isStringCircled, palmMute, hammerOn, pullOff) {
|
|
51
|
+
isRest = false, dotCount = 0, accidental, beamGroup, // Group ID for beamed notes
|
|
52
|
+
articulations = [], dynamic, tie, slur, tuplet, hairpin, isGrace = false, isCue = false, lyric, chord, glissando, arpeggio, ottava, pedal, ornament, fret, string, fretboardDiagram, lyrics, staffText, color, notehead, bowing, fingering, stemDirection, isStringCircled, palmMute, hammerOn, pullOff, tieSpans = tie ? [{ placement: 'start', number: 1 }] : [], slurs = slur ? [slur] : [], beamLevels, grace, accidentalDisplay, restDisplay, ornamentDetails, harmonic, bend, vibrato, placement) {
|
|
44
53
|
this.duration = duration;
|
|
45
54
|
this.pitch = pitch;
|
|
46
55
|
this.isRest = isRest;
|
|
47
|
-
this.
|
|
56
|
+
this.dotCount = dotCount;
|
|
48
57
|
this.accidental = accidental;
|
|
49
58
|
this.beamGroup = beamGroup;
|
|
50
59
|
this.articulations = articulations;
|
|
@@ -54,6 +63,7 @@ export class Note {
|
|
|
54
63
|
this.tuplet = tuplet;
|
|
55
64
|
this.hairpin = hairpin;
|
|
56
65
|
this.isGrace = isGrace;
|
|
66
|
+
this.isCue = isCue;
|
|
57
67
|
this.lyric = lyric;
|
|
58
68
|
this.chord = chord;
|
|
59
69
|
this.glissando = glissando;
|
|
@@ -75,6 +85,20 @@ export class Note {
|
|
|
75
85
|
this.palmMute = palmMute;
|
|
76
86
|
this.hammerOn = hammerOn;
|
|
77
87
|
this.pullOff = pullOff;
|
|
88
|
+
this.tieSpans = tieSpans;
|
|
89
|
+
this.slurs = slurs;
|
|
90
|
+
this.beamLevels = beamLevels;
|
|
91
|
+
this.grace = grace;
|
|
92
|
+
this.accidentalDisplay = accidentalDisplay;
|
|
93
|
+
this.restDisplay = restDisplay;
|
|
94
|
+
this.ornamentDetails = ornamentDetails;
|
|
95
|
+
this.harmonic = harmonic;
|
|
96
|
+
this.bend = bend;
|
|
97
|
+
this.vibrato = vibrato;
|
|
98
|
+
this.placement = placement;
|
|
99
|
+
}
|
|
100
|
+
get isDotted() {
|
|
101
|
+
return this.dotCount > 0;
|
|
78
102
|
}
|
|
79
103
|
/**
|
|
80
104
|
* Get all lyrics as standardized objects
|
|
@@ -100,8 +124,7 @@ export class Note {
|
|
|
100
124
|
getDurationValue() {
|
|
101
125
|
if (this.isGrace)
|
|
102
126
|
return 0;
|
|
103
|
-
|
|
104
|
-
let val = this.isDotted ? base * 1.5 : base;
|
|
127
|
+
let val = calculateDurationValue(this.duration, this.dotCount);
|
|
105
128
|
if (this.tuplet) {
|
|
106
129
|
val = val * (this.tuplet.normal / this.tuplet.actual);
|
|
107
130
|
}
|
|
@@ -120,10 +143,13 @@ export class Note {
|
|
|
120
143
|
this.duration === Duration.TwoHundredFiftySixth));
|
|
121
144
|
}
|
|
122
145
|
withGrace(isGrace) {
|
|
123
|
-
return new Note(this.duration, this.pitch, this.isRest, this.
|
|
146
|
+
return new Note(this.duration, this.pitch, this.isRest, this.dotCount, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, isGrace, this.isCue, this.lyric, this.chord, this.glissando, this.arpeggio, this.ottava, this.pedal, this.ornament, this.fret, this.string, this.fretboardDiagram, this.lyrics, this.staffText, this.color, this.notehead, this.bowing, this.fingering, this.stemDirection, this.isStringCircled, this.palmMute, this.hammerOn, this.pullOff, this.tieSpans, this.slurs, this.beamLevels, this.grace, this.accidentalDisplay, this.restDisplay, this.ornamentDetails, this.harmonic, this.bend, this.vibrato);
|
|
147
|
+
}
|
|
148
|
+
withCue(isCue) {
|
|
149
|
+
return new Note(this.duration, this.pitch, this.isRest, this.dotCount, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, isCue, this.lyric, this.chord, this.glissando, this.arpeggio, this.ottava, this.pedal, this.ornament, this.fret, this.string, this.fretboardDiagram, this.lyrics, this.staffText, this.color, this.notehead, this.bowing, this.fingering, this.stemDirection, this.isStringCircled, this.palmMute, this.hammerOn, this.pullOff, this.tieSpans, this.slurs, this.beamLevels, this.grace, this.accidentalDisplay, this.restDisplay, this.ornamentDetails, this.harmonic, this.bend, this.vibrato);
|
|
124
150
|
}
|
|
125
151
|
withChord(chord) {
|
|
126
|
-
return new Note(this.duration, this.pitch, this.isRest, this.
|
|
152
|
+
return new Note(this.duration, this.pitch, this.isRest, this.dotCount, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, this.isCue, this.lyric, chord, this.glissando, this.arpeggio, this.ottava, this.pedal, this.ornament, this.fret, this.string, this.fretboardDiagram, this.lyrics, this.staffText, this.color, this.notehead, this.bowing, this.fingering, this.stemDirection, this.isStringCircled, this.palmMute, this.hammerOn, this.pullOff, this.tieSpans, this.slurs, this.beamLevels, this.grace, this.accidentalDisplay, this.restDisplay, this.ornamentDetails, this.harmonic, this.bend, this.vibrato);
|
|
127
153
|
}
|
|
128
154
|
transpose(semitones) {
|
|
129
155
|
if (this.isRest || !this.pitch) {
|
|
@@ -133,7 +159,7 @@ export class Note {
|
|
|
133
159
|
const chromaticIdx = newPitch.midiNumber % 12;
|
|
134
160
|
const hasSharp = [1, 3, 6, 8, 10].includes(chromaticIdx);
|
|
135
161
|
const newAccidental = hasSharp ? Accidental.Sharp : undefined;
|
|
136
|
-
return new Note(this.duration, newPitch, this.isRest, this.
|
|
162
|
+
return new Note(this.duration, newPitch, this.isRest, this.dotCount, newAccidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, this.isCue, this.lyric, this.chord, this.glissando, this.arpeggio, this.ottava, this.pedal, this.ornament, this.fret, this.string, this.fretboardDiagram, this.lyrics, this.staffText, this.color, this.notehead, this.bowing, this.fingering, this.stemDirection, this.isStringCircled, this.palmMute, this.hammerOn, this.pullOff, this.tieSpans, this.slurs, this.beamLevels, this.grace, this.accidentalDisplay, this.restDisplay, this.ornamentDetails, this.harmonic, this.bend, this.vibrato);
|
|
137
163
|
}
|
|
138
164
|
transposeOctave(octaves) {
|
|
139
165
|
if (!this.pitch || this.isRest)
|
|
@@ -166,97 +192,115 @@ export class Note {
|
|
|
166
192
|
return this.withPitch(newPitch).withAccidental(newAccidental);
|
|
167
193
|
}
|
|
168
194
|
withPitch(pitch) {
|
|
169
|
-
return new Note(this.duration, pitch, false, this.
|
|
195
|
+
return new Note(this.duration, pitch, false, this.dotCount, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, this.isCue, this.lyric, this.chord, this.glissando, this.arpeggio, this.ottava, this.pedal, this.ornament, this.fret, this.string, this.fretboardDiagram, this.lyrics, this.staffText, this.color, this.notehead, this.bowing, this.fingering, this.stemDirection, this.isStringCircled, this.palmMute, this.hammerOn, this.pullOff, this.tieSpans, this.slurs, this.beamLevels, this.grace, this.accidentalDisplay, this.restDisplay, this.ornamentDetails, this.harmonic, this.bend, this.vibrato);
|
|
170
196
|
}
|
|
171
197
|
withArticulation(articulation) {
|
|
172
|
-
return new Note(this.duration, this.pitch, this.isRest, this.
|
|
198
|
+
return new Note(this.duration, this.pitch, this.isRest, this.dotCount, this.accidental, this.beamGroup, articulation ? [articulation] : [], this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, this.isCue, this.lyric, this.chord, this.glissando, this.arpeggio, this.ottava, this.pedal, this.ornament, this.fret, this.string, this.fretboardDiagram, this.lyrics, this.staffText, this.color, this.notehead, this.bowing, this.fingering, this.stemDirection, this.isStringCircled, this.palmMute, this.hammerOn, this.pullOff, this.tieSpans, this.slurs, this.beamLevels, this.grace, this.accidentalDisplay, this.restDisplay, this.ornamentDetails, this.harmonic, this.bend, this.vibrato);
|
|
173
199
|
}
|
|
174
200
|
withArticulations(articulations) {
|
|
175
|
-
return new Note(this.duration, this.pitch, this.isRest, this.
|
|
201
|
+
return new Note(this.duration, this.pitch, this.isRest, this.dotCount, this.accidental, this.beamGroup, articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, this.isCue, this.lyric, this.chord, this.glissando, this.arpeggio, this.ottava, this.pedal, this.ornament, this.fret, this.string, this.fretboardDiagram, this.lyrics, this.staffText, this.color, this.notehead, this.bowing, this.fingering, this.stemDirection, this.isStringCircled, this.palmMute, this.hammerOn, this.pullOff, this.tieSpans, this.slurs, this.beamLevels, this.grace, this.accidentalDisplay, this.restDisplay, this.ornamentDetails, this.harmonic, this.bend, this.vibrato);
|
|
176
202
|
}
|
|
177
203
|
withDynamic(dynamic) {
|
|
178
|
-
return new Note(this.duration, this.pitch, this.isRest, this.
|
|
204
|
+
return new Note(this.duration, this.pitch, this.isRest, this.dotCount, this.accidental, this.beamGroup, this.articulations, dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, this.isCue, this.lyric, this.chord, this.glissando, this.arpeggio, this.ottava, this.pedal, this.ornament, this.fret, this.string, this.fretboardDiagram, this.lyrics, this.staffText, this.color, this.notehead, this.bowing, this.fingering, this.stemDirection, this.isStringCircled, this.palmMute, this.hammerOn, this.pullOff, this.tieSpans, this.slurs, this.beamLevels, this.grace, this.accidentalDisplay, this.restDisplay, this.ornamentDetails, this.harmonic, this.bend, this.vibrato);
|
|
179
205
|
}
|
|
180
206
|
withTie(tie) {
|
|
181
|
-
|
|
207
|
+
const tieSpans = tie ? [{ placement: 'start', number: 1 }] : [];
|
|
208
|
+
return new Note(this.duration, this.pitch, this.isRest, this.dotCount, this.accidental, this.beamGroup, this.articulations, this.dynamic, tie, this.slur, this.tuplet, this.hairpin, this.isGrace, this.isCue, this.lyric, this.chord, this.glissando, this.arpeggio, this.ottava, this.pedal, this.ornament, this.fret, this.string, this.fretboardDiagram, this.lyrics, this.staffText, this.color, this.notehead, this.bowing, this.fingering, this.stemDirection, this.isStringCircled, this.palmMute, this.hammerOn, this.pullOff, tieSpans, this.slurs, this.beamLevels, this.grace, this.accidentalDisplay, this.restDisplay, this.ornamentDetails, this.harmonic, this.bend, this.vibrato);
|
|
182
209
|
}
|
|
183
210
|
withSlur(slur) {
|
|
184
|
-
|
|
211
|
+
const slurs = slur ? [slur] : [];
|
|
212
|
+
return new Note(this.duration, this.pitch, this.isRest, this.dotCount, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, slur, this.tuplet, this.hairpin, this.isGrace, this.isCue, this.lyric, this.chord, this.glissando, this.arpeggio, this.ottava, this.pedal, this.ornament, this.fret, this.string, this.fretboardDiagram, this.lyrics, this.staffText, this.color, this.notehead, this.bowing, this.fingering, this.stemDirection, this.isStringCircled, this.palmMute, this.hammerOn, this.pullOff, this.tieSpans, slurs);
|
|
185
213
|
}
|
|
186
214
|
withTuplet(tuplet) {
|
|
187
|
-
return new Note(this.duration, this.pitch, this.isRest, this.
|
|
215
|
+
return new Note(this.duration, this.pitch, this.isRest, this.dotCount, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, tuplet, this.hairpin, this.isGrace, this.isCue, this.lyric, this.chord, this.glissando, this.arpeggio, this.ottava, this.pedal, this.ornament, this.fret, this.string, this.fretboardDiagram, this.lyrics, this.staffText, this.color, this.notehead, this.bowing, this.fingering, this.stemDirection, this.isStringCircled, this.palmMute, this.hammerOn, this.pullOff, this.tieSpans, this.slurs, this.beamLevels, this.grace, this.accidentalDisplay, this.restDisplay, this.ornamentDetails, this.harmonic, this.bend, this.vibrato);
|
|
188
216
|
}
|
|
189
217
|
withLyric(lyric) {
|
|
190
|
-
return new Note(this.duration, this.pitch, this.isRest, this.
|
|
218
|
+
return new Note(this.duration, this.pitch, this.isRest, this.dotCount, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, this.isCue, lyric, this.chord, this.glissando, this.arpeggio, this.ottava, this.pedal, this.ornament, this.fret, this.string, this.fretboardDiagram, this.lyrics, this.staffText, this.color, this.notehead, this.bowing, this.fingering, this.stemDirection, this.isStringCircled, this.palmMute, this.hammerOn, this.pullOff, this.tieSpans, this.slurs, this.beamLevels, this.grace, this.accidentalDisplay, this.restDisplay, this.ornamentDetails, this.harmonic, this.bend, this.vibrato);
|
|
191
219
|
}
|
|
192
220
|
withLyrics(lyrics) {
|
|
193
|
-
return new Note(this.duration, this.pitch, this.isRest, this.
|
|
221
|
+
return new Note(this.duration, this.pitch, this.isRest, this.dotCount, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, this.isCue, this.lyric, this.chord, this.glissando, this.arpeggio, this.ottava, this.pedal, this.ornament, this.fret, this.string, this.fretboardDiagram, lyrics, this.staffText, this.color, this.notehead, this.bowing, this.fingering, this.stemDirection, this.isStringCircled, this.palmMute, this.hammerOn, this.pullOff, this.tieSpans, this.slurs, this.beamLevels, this.grace, this.accidentalDisplay, this.restDisplay, this.ornamentDetails, this.harmonic, this.bend, this.vibrato);
|
|
194
222
|
}
|
|
195
223
|
withHairpin(hairpin) {
|
|
196
|
-
return new Note(this.duration, this.pitch, this.isRest, this.
|
|
224
|
+
return new Note(this.duration, this.pitch, this.isRest, this.dotCount, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, hairpin, this.isGrace, this.isCue, this.lyric, this.chord, this.glissando, this.arpeggio, this.ottava, this.pedal, this.ornament, this.fret, this.string, this.fretboardDiagram, this.lyrics, this.staffText, this.color, this.notehead, this.bowing, this.fingering, this.stemDirection, this.isStringCircled, this.palmMute, this.hammerOn, this.pullOff, this.tieSpans, this.slurs, this.beamLevels, this.grace, this.accidentalDisplay, this.restDisplay, this.ornamentDetails, this.harmonic, this.bend, this.vibrato);
|
|
197
225
|
}
|
|
198
226
|
withAccidental(accidental) {
|
|
199
|
-
return new Note(this.duration, this.pitch, this.isRest, this.
|
|
227
|
+
return new Note(this.duration, this.pitch, this.isRest, this.dotCount, accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, this.isCue, this.lyric, this.chord, this.glissando, this.arpeggio, this.ottava, this.pedal, this.ornament, this.fret, this.string, this.fretboardDiagram, this.lyrics, this.staffText, this.color, this.notehead, this.bowing, this.fingering, this.stemDirection, this.isStringCircled, this.palmMute, this.hammerOn, this.pullOff, this.tieSpans, this.slurs, this.beamLevels, this.grace, this.accidentalDisplay, this.restDisplay, this.ornamentDetails, this.harmonic, this.bend, this.vibrato);
|
|
228
|
+
}
|
|
229
|
+
withAccidentalDisplay(accidentalDisplay) {
|
|
230
|
+
return new Note(this.duration, this.pitch, this.isRest, this.dotCount, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, this.isCue, this.lyric, this.chord, this.glissando, this.arpeggio, this.ottava, this.pedal, this.ornament, this.fret, this.string, this.fretboardDiagram, this.lyrics, this.staffText, this.color, this.notehead, this.bowing, this.fingering, this.stemDirection, this.isStringCircled, this.palmMute, this.hammerOn, this.pullOff, this.tieSpans, this.slurs, this.beamLevels, this.grace, accidentalDisplay, this.restDisplay, this.ornamentDetails, this.harmonic, this.bend, this.vibrato);
|
|
200
231
|
}
|
|
201
|
-
withDuration(duration,
|
|
202
|
-
return new Note(duration, this.pitch, this.isRest,
|
|
232
|
+
withDuration(duration, dotCount = 0) {
|
|
233
|
+
return new Note(duration, this.pitch, this.isRest, dotCount, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, this.isCue, this.lyric, this.chord, this.glissando, this.arpeggio, this.ottava, this.pedal, this.ornament, this.fret, this.string, this.fretboardDiagram, this.lyrics, this.staffText, this.color, this.notehead, this.bowing, this.fingering, this.stemDirection, this.isStringCircled, this.palmMute, this.hammerOn, this.pullOff, this.tieSpans, this.slurs, this.beamLevels, this.grace, this.accidentalDisplay, this.restDisplay, this.ornamentDetails, this.harmonic, this.bend, this.vibrato);
|
|
203
234
|
}
|
|
204
235
|
withRest(isRest) {
|
|
205
|
-
return new Note(this.duration, this.pitch, isRest, this.
|
|
236
|
+
return new Note(this.duration, this.pitch, isRest, this.dotCount, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, this.isCue, this.lyric, this.chord, this.glissando, this.arpeggio, this.ottava, this.pedal, this.ornament, this.fret, this.string, this.fretboardDiagram, this.lyrics, this.staffText, this.color, this.notehead, this.bowing, this.fingering, this.stemDirection, this.isStringCircled, this.palmMute, this.hammerOn, this.pullOff, this.tieSpans, this.slurs, this.beamLevels, this.grace, this.accidentalDisplay, this.restDisplay, this.ornamentDetails, this.harmonic, this.bend, this.vibrato);
|
|
206
237
|
}
|
|
207
238
|
withFretboardDiagram(diagram) {
|
|
208
|
-
return new Note(this.duration, this.pitch, this.isRest, this.
|
|
239
|
+
return new Note(this.duration, this.pitch, this.isRest, this.dotCount, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, this.isCue, this.lyric, this.chord, this.glissando, this.arpeggio, this.ottava, this.pedal, this.ornament, this.fret, this.string, diagram, this.lyrics, this.staffText, this.color, this.notehead, this.bowing, this.fingering, this.stemDirection, this.isStringCircled, this.palmMute, this.hammerOn, this.pullOff, this.tieSpans, this.slurs, this.beamLevels, this.grace, this.accidentalDisplay, this.restDisplay, this.ornamentDetails, this.harmonic, this.bend, this.vibrato);
|
|
209
240
|
}
|
|
210
241
|
withBeamGroup(beamGroup) {
|
|
211
|
-
|
|
242
|
+
const preservedBeamLevels = beamGroup === this.beamGroup ? this.beamLevels : undefined;
|
|
243
|
+
return new Note(this.duration, this.pitch, this.isRest, this.dotCount, this.accidental, beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, this.isCue, this.lyric, this.chord, this.glissando, this.arpeggio, this.ottava, this.pedal, this.ornament, this.fret, this.string, this.fretboardDiagram, this.lyrics, this.staffText, this.color, this.notehead, this.bowing, this.fingering, this.stemDirection, this.isStringCircled, this.palmMute, this.hammerOn, this.pullOff, this.tieSpans, this.slurs, preservedBeamLevels, this.grace, this.accidentalDisplay, this.restDisplay, this.ornamentDetails, this.harmonic, this.bend, this.vibrato);
|
|
212
244
|
}
|
|
213
245
|
withGlissando(glissando) {
|
|
214
|
-
return new Note(this.duration, this.pitch, this.isRest, this.
|
|
246
|
+
return new Note(this.duration, this.pitch, this.isRest, this.dotCount, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, this.isCue, this.lyric, this.chord, glissando, this.arpeggio, this.ottava, this.pedal, this.ornament, this.fret, this.string, this.fretboardDiagram, this.lyrics, this.staffText, this.color, this.notehead, this.bowing, this.fingering, this.stemDirection, this.isStringCircled, this.palmMute, this.hammerOn, this.pullOff, this.tieSpans, this.slurs, this.beamLevels, this.grace, this.accidentalDisplay, this.restDisplay, this.ornamentDetails, this.harmonic, this.bend, this.vibrato);
|
|
215
247
|
}
|
|
216
248
|
withArpeggio(arpeggio) {
|
|
217
|
-
return new Note(this.duration, this.pitch, this.isRest, this.
|
|
249
|
+
return new Note(this.duration, this.pitch, this.isRest, this.dotCount, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, this.isCue, this.lyric, this.chord, this.glissando, arpeggio, this.ottava, this.pedal, this.ornament, this.fret, this.string, this.fretboardDiagram, this.lyrics, this.staffText, this.color, this.notehead, this.bowing, this.fingering, this.stemDirection, this.isStringCircled, this.palmMute, this.hammerOn, this.pullOff, this.tieSpans, this.slurs, this.beamLevels, this.grace, this.accidentalDisplay, this.restDisplay, this.ornamentDetails, this.harmonic, this.bend, this.vibrato);
|
|
218
250
|
}
|
|
219
251
|
withOttava(ottava) {
|
|
220
|
-
return new Note(this.duration, this.pitch, this.isRest, this.
|
|
252
|
+
return new Note(this.duration, this.pitch, this.isRest, this.dotCount, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, this.isCue, this.lyric, this.chord, this.glissando, this.arpeggio, ottava, this.pedal, this.ornament, this.fret, this.string, this.fretboardDiagram, this.lyrics, this.staffText, this.color, this.notehead, this.bowing, this.fingering, this.stemDirection, this.isStringCircled, this.palmMute, this.hammerOn, this.pullOff, this.tieSpans, this.slurs, this.beamLevels, this.grace, this.accidentalDisplay, this.restDisplay, this.ornamentDetails, this.harmonic, this.bend, this.vibrato);
|
|
221
253
|
}
|
|
222
254
|
withPedal(pedal) {
|
|
223
|
-
return new Note(this.duration, this.pitch, this.isRest, this.
|
|
255
|
+
return new Note(this.duration, this.pitch, this.isRest, this.dotCount, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, this.isCue, this.lyric, this.chord, this.glissando, this.arpeggio, this.ottava, pedal, this.ornament, this.fret, this.string, this.fretboardDiagram, this.lyrics, this.staffText, this.color, this.notehead, this.bowing, this.fingering, this.stemDirection, this.isStringCircled, this.palmMute, this.hammerOn, this.pullOff, this.tieSpans, this.slurs, this.beamLevels, this.grace, this.accidentalDisplay, this.restDisplay, this.ornamentDetails, this.harmonic, this.bend, this.vibrato);
|
|
224
256
|
}
|
|
225
257
|
withOrnament(ornament) {
|
|
226
|
-
return new Note(this.duration, this.pitch, this.isRest, this.
|
|
258
|
+
return new Note(this.duration, this.pitch, this.isRest, this.dotCount, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, this.isCue, this.lyric, this.chord, this.glissando, this.arpeggio, this.ottava, this.pedal, ornament, this.fret, this.string, this.fretboardDiagram, this.lyrics, this.staffText, this.color, this.notehead, this.bowing, this.fingering, this.stemDirection, this.isStringCircled, this.palmMute, this.hammerOn, this.pullOff, this.tieSpans, this.slurs, this.beamLevels, this.grace, this.accidentalDisplay, this.restDisplay, ornament ? this.ornamentDetails : undefined, this.harmonic, this.bend, this.vibrato);
|
|
259
|
+
}
|
|
260
|
+
withOrnamentDetails(ornamentDetails) {
|
|
261
|
+
return new Note(this.duration, this.pitch, this.isRest, this.dotCount, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, this.isCue, this.lyric, this.chord, this.glissando, this.arpeggio, this.ottava, this.pedal, this.ornament, this.fret, this.string, this.fretboardDiagram, this.lyrics, this.staffText, this.color, this.notehead, this.bowing, this.fingering, this.stemDirection, this.isStringCircled, this.palmMute, this.hammerOn, this.pullOff, this.tieSpans, this.slurs, this.beamLevels, this.grace, this.accidentalDisplay, this.restDisplay, ornamentDetails, this.harmonic, this.bend, this.vibrato);
|
|
227
262
|
}
|
|
228
263
|
withTab(fret, string) {
|
|
229
|
-
return new Note(this.duration, this.pitch, this.isRest, this.
|
|
264
|
+
return new Note(this.duration, this.pitch, this.isRest, this.dotCount, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, this.isCue, this.lyric, this.chord, this.glissando, this.arpeggio, this.ottava, this.pedal, this.ornament, fret, string, this.fretboardDiagram, this.lyrics, this.staffText, this.color, this.notehead, this.bowing, this.fingering, this.stemDirection, this.isStringCircled, this.palmMute, this.hammerOn, this.pullOff, this.tieSpans, this.slurs, this.beamLevels, this.grace, this.accidentalDisplay, this.restDisplay, this.ornamentDetails, this.harmonic, this.bend, this.vibrato);
|
|
230
265
|
}
|
|
231
266
|
withStaffText(text) {
|
|
232
|
-
return new Note(this.duration, this.pitch, this.isRest, this.
|
|
267
|
+
return new Note(this.duration, this.pitch, this.isRest, this.dotCount, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, this.isCue, this.lyric, this.chord, this.glissando, this.arpeggio, this.ottava, this.pedal, this.ornament, this.fret, this.string, this.fretboardDiagram, this.lyrics, text, this.color, this.notehead, this.bowing, this.fingering, this.stemDirection, this.isStringCircled, this.palmMute, this.hammerOn, this.pullOff, this.tieSpans, this.slurs, this.beamLevels, this.grace, this.accidentalDisplay, this.restDisplay, this.ornamentDetails, this.harmonic, this.bend, this.vibrato);
|
|
233
268
|
}
|
|
234
269
|
withColor(color) {
|
|
235
|
-
return new Note(this.duration, this.pitch, this.isRest, this.
|
|
270
|
+
return new Note(this.duration, this.pitch, this.isRest, this.dotCount, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, this.isCue, this.lyric, this.chord, this.glissando, this.arpeggio, this.ottava, this.pedal, this.ornament, this.fret, this.string, this.fretboardDiagram, this.lyrics, this.staffText, color, this.notehead, this.bowing, this.fingering, this.stemDirection, this.isStringCircled, this.palmMute, this.hammerOn, this.pullOff, this.tieSpans, this.slurs, this.beamLevels, this.grace, this.accidentalDisplay, this.restDisplay, this.ornamentDetails, this.harmonic, this.bend, this.vibrato);
|
|
236
271
|
}
|
|
237
272
|
withNotehead(notehead) {
|
|
238
|
-
return new Note(this.duration, this.pitch, this.isRest, this.
|
|
273
|
+
return new Note(this.duration, this.pitch, this.isRest, this.dotCount, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, this.isCue, this.lyric, this.chord, this.glissando, this.arpeggio, this.ottava, this.pedal, this.ornament, this.fret, this.string, this.fretboardDiagram, this.lyrics, this.staffText, this.color, notehead, this.bowing, this.fingering, this.stemDirection, this.isStringCircled, this.palmMute, this.hammerOn, this.pullOff, this.tieSpans, this.slurs, this.beamLevels, this.grace, this.accidentalDisplay, this.restDisplay, this.ornamentDetails, this.harmonic, this.bend, this.vibrato);
|
|
239
274
|
}
|
|
240
275
|
withBowing(bowing) {
|
|
241
|
-
return new Note(this.duration, this.pitch, this.isRest, this.
|
|
276
|
+
return new Note(this.duration, this.pitch, this.isRest, this.dotCount, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, this.isCue, this.lyric, this.chord, this.glissando, this.arpeggio, this.ottava, this.pedal, this.ornament, this.fret, this.string, this.fretboardDiagram, this.lyrics, this.staffText, this.color, this.notehead, bowing, this.fingering, this.stemDirection, this.isStringCircled, this.palmMute, this.hammerOn, this.pullOff, this.tieSpans, this.slurs, this.beamLevels, this.grace, this.accidentalDisplay, this.restDisplay, this.ornamentDetails, this.harmonic, this.bend, this.vibrato);
|
|
242
277
|
}
|
|
243
278
|
withFingering(fingering) {
|
|
244
|
-
return new Note(this.duration, this.pitch, this.isRest, this.
|
|
279
|
+
return new Note(this.duration, this.pitch, this.isRest, this.dotCount, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, this.isCue, this.lyric, this.chord, this.glissando, this.arpeggio, this.ottava, this.pedal, this.ornament, this.fret, this.string, this.fretboardDiagram, this.lyrics, this.staffText, this.color, this.notehead, this.bowing, fingering, this.stemDirection, this.isStringCircled, this.palmMute, this.hammerOn, this.pullOff, this.tieSpans, this.slurs, this.beamLevels, this.grace, this.accidentalDisplay, this.restDisplay, this.ornamentDetails, this.harmonic, this.bend, this.vibrato);
|
|
245
280
|
}
|
|
246
281
|
withStemDirection(stemDirection) {
|
|
247
|
-
return new Note(this.duration, this.pitch, this.isRest, this.
|
|
282
|
+
return new Note(this.duration, this.pitch, this.isRest, this.dotCount, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, this.isCue, this.lyric, this.chord, this.glissando, this.arpeggio, this.ottava, this.pedal, this.ornament, this.fret, this.string, this.fretboardDiagram, this.lyrics, this.staffText, this.color, this.notehead, this.bowing, this.fingering, stemDirection, this.isStringCircled, this.palmMute, this.hammerOn, this.pullOff, this.tieSpans, this.slurs, this.beamLevels, this.grace, this.accidentalDisplay, this.restDisplay, this.ornamentDetails, this.harmonic, this.bend, this.vibrato);
|
|
248
283
|
}
|
|
249
284
|
withStringCircled(isStringCircled) {
|
|
250
|
-
return new Note(this.duration, this.pitch, this.isRest, this.
|
|
285
|
+
return new Note(this.duration, this.pitch, this.isRest, this.dotCount, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, this.isCue, this.lyric, this.chord, this.glissando, this.arpeggio, this.ottava, this.pedal, this.ornament, this.fret, this.string, this.fretboardDiagram, this.lyrics, this.staffText, this.color, this.notehead, this.bowing, this.fingering, this.stemDirection, isStringCircled, this.palmMute, this.hammerOn, this.pullOff, this.tieSpans, this.slurs, this.beamLevels, this.grace, this.accidentalDisplay, this.restDisplay, this.ornamentDetails, this.harmonic, this.bend, this.vibrato);
|
|
251
286
|
}
|
|
252
287
|
withPalmMute(palmMute) {
|
|
253
|
-
return new Note(this.duration, this.pitch, this.isRest, this.
|
|
288
|
+
return new Note(this.duration, this.pitch, this.isRest, this.dotCount, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, this.isCue, this.lyric, this.chord, this.glissando, this.arpeggio, this.ottava, this.pedal, this.ornament, this.fret, this.string, this.fretboardDiagram, this.lyrics, this.staffText, this.color, this.notehead, this.bowing, this.fingering, this.stemDirection, this.isStringCircled, palmMute, this.hammerOn, this.pullOff, this.tieSpans, this.slurs, this.beamLevels, this.grace, this.accidentalDisplay, this.restDisplay, this.ornamentDetails, this.harmonic, this.bend, this.vibrato);
|
|
254
289
|
}
|
|
255
290
|
withHammerOn(hammerOn) {
|
|
256
|
-
return new Note(this.duration, this.pitch, this.isRest, this.
|
|
291
|
+
return new Note(this.duration, this.pitch, this.isRest, this.dotCount, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, this.isCue, this.lyric, this.chord, this.glissando, this.arpeggio, this.ottava, this.pedal, this.ornament, this.fret, this.string, this.fretboardDiagram, this.lyrics, this.staffText, this.color, this.notehead, this.bowing, this.fingering, this.stemDirection, this.isStringCircled, this.palmMute, hammerOn, this.pullOff, this.tieSpans, this.slurs, this.beamLevels, this.grace, this.accidentalDisplay, this.restDisplay, this.ornamentDetails, this.harmonic, this.bend, this.vibrato);
|
|
257
292
|
}
|
|
258
293
|
withPullOff(pullOff) {
|
|
259
|
-
return new Note(this.duration, this.pitch, this.isRest, this.
|
|
294
|
+
return new Note(this.duration, this.pitch, this.isRest, this.dotCount, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, this.isCue, this.lyric, this.chord, this.glissando, this.arpeggio, this.ottava, this.pedal, this.ornament, this.fret, this.string, this.fretboardDiagram, this.lyrics, this.staffText, this.color, this.notehead, this.bowing, this.fingering, this.stemDirection, this.isStringCircled, this.palmMute, this.hammerOn, pullOff, this.tieSpans, this.slurs, this.beamLevels, this.grace, this.accidentalDisplay, this.restDisplay, this.ornamentDetails, this.harmonic, this.bend, this.vibrato);
|
|
295
|
+
}
|
|
296
|
+
withHarmonic(harmonic) {
|
|
297
|
+
return new Note(this.duration, this.pitch, this.isRest, this.dotCount, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, this.isCue, this.lyric, this.chord, this.glissando, this.arpeggio, this.ottava, this.pedal, this.ornament, this.fret, this.string, this.fretboardDiagram, this.lyrics, this.staffText, this.color, this.notehead, this.bowing, this.fingering, this.stemDirection, this.isStringCircled, this.palmMute, this.hammerOn, this.pullOff, this.tieSpans, this.slurs, this.beamLevels, this.grace, this.accidentalDisplay, this.restDisplay, this.ornamentDetails, harmonic, this.bend, this.vibrato);
|
|
298
|
+
}
|
|
299
|
+
withBend(bend) {
|
|
300
|
+
return new Note(this.duration, this.pitch, this.isRest, this.dotCount, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, this.isCue, this.lyric, this.chord, this.glissando, this.arpeggio, this.ottava, this.pedal, this.ornament, this.fret, this.string, this.fretboardDiagram, this.lyrics, this.staffText, this.color, this.notehead, this.bowing, this.fingering, this.stemDirection, this.isStringCircled, this.palmMute, this.hammerOn, this.pullOff, this.tieSpans, this.slurs, this.beamLevels, this.grace, this.accidentalDisplay, this.restDisplay, this.ornamentDetails, this.harmonic, bend, this.vibrato);
|
|
301
|
+
}
|
|
302
|
+
withVibrato(vibrato) {
|
|
303
|
+
return new Note(this.duration, this.pitch, this.isRest, this.dotCount, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, this.isCue, this.lyric, this.chord, this.glissando, this.arpeggio, this.ottava, this.pedal, this.ornament, this.fret, this.string, this.fretboardDiagram, this.lyrics, this.staffText, this.color, this.notehead, this.bowing, this.fingering, this.stemDirection, this.isStringCircled, this.palmMute, this.hammerOn, this.pullOff, this.tieSpans, this.slurs, this.beamLevels, this.grace, this.accidentalDisplay, this.restDisplay, this.ornamentDetails, this.harmonic, this.bend, vibrato);
|
|
260
304
|
}
|
|
261
305
|
toJSON() {
|
|
262
306
|
return {
|
|
@@ -273,15 +317,20 @@ export class Note {
|
|
|
273
317
|
: undefined,
|
|
274
318
|
isRest: this.isRest || undefined,
|
|
275
319
|
isDotted: this.isDotted || undefined,
|
|
320
|
+
dotCount: this.dotCount || undefined,
|
|
276
321
|
accidental: this.accidental,
|
|
277
322
|
beamGroup: this.beamGroup,
|
|
323
|
+
beamLevels: this.beamLevels,
|
|
278
324
|
articulations: this.articulations.length > 0 ? this.articulations : undefined,
|
|
279
325
|
dynamic: this.dynamic,
|
|
280
326
|
tie: this.tie,
|
|
281
327
|
slur: this.slur,
|
|
328
|
+
tieSpans: this.tieSpans.length > 0 ? this.tieSpans : undefined,
|
|
329
|
+
slurs: this.slurs.length > 0 ? this.slurs : undefined,
|
|
282
330
|
tuplet: this.tuplet,
|
|
283
331
|
hairpin: this.hairpin,
|
|
284
332
|
isGrace: this.isGrace || undefined,
|
|
333
|
+
isCue: this.isCue || undefined,
|
|
285
334
|
lyric: this.lyric,
|
|
286
335
|
chord: this.chord,
|
|
287
336
|
glissando: this.glissando,
|
|
@@ -303,6 +352,14 @@ export class Note {
|
|
|
303
352
|
palmMute: this.palmMute,
|
|
304
353
|
hammerOn: this.hammerOn,
|
|
305
354
|
pullOff: this.pullOff,
|
|
355
|
+
grace: this.grace,
|
|
356
|
+
accidentalDisplay: this.accidentalDisplay,
|
|
357
|
+
restDisplay: this.restDisplay,
|
|
358
|
+
ornamentDetails: this.ornamentDetails,
|
|
359
|
+
harmonic: this.harmonic,
|
|
360
|
+
bend: this.bend,
|
|
361
|
+
vibrato: this.vibrato,
|
|
362
|
+
placement: this.placement,
|
|
306
363
|
// Legacy field (optional)
|
|
307
364
|
articulation: this.articulations.length > 0 ? this.articulations[0] : undefined,
|
|
308
365
|
};
|
|
@@ -319,6 +376,6 @@ export class Note {
|
|
|
319
376
|
else if (data.articulation) {
|
|
320
377
|
articulations = [data.articulation];
|
|
321
378
|
}
|
|
322
|
-
return new Note(data.duration, pitch, data.isRest ?? false, data.isDotted
|
|
379
|
+
return new Note(data.duration, pitch, data.isRest ?? false, data.dotCount !== undefined ? data.dotCount : data.isDotted ? 1 : 0, data.accidental, data.beamGroup, articulations, data.dynamic, data.tie, data.slur, data.tuplet, data.hairpin, data.isGrace ?? false, data.isCue ?? false, data.lyric, data.chord, data.glissando, data.arpeggio, data.ottava, data.pedal, data.ornament, data.fret, data.string, data.fretboardDiagram, data.lyrics, data.staffText, data.color, data.notehead, data.bowing, data.fingering, data.stemDirection, data.isStringCircled, data.palmMute, data.hammerOn, data.pullOff, data.tieSpans || [], data.slurs || (data.slur ? [data.slur] : []), data.beamLevels, data.grace, data.accidentalDisplay, data.restDisplay, data.ornamentDetails, data.harmonic, data.bend, data.vibrato, data.placement);
|
|
323
380
|
}
|
|
324
381
|
}
|
package/dist/models/NoteSet.d.ts
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
import { Note, NoteJSON } from './Note';
|
|
2
|
-
import { Pitch } from './Pitch';
|
|
3
|
-
import { Accidental, Arpeggio, Articulation, Bowing, Duration, Dynamic, FretboardDiagram, Glissando, Hairpin, Lyric, NoteheadShape, Ornament, Ottava, Pedal, Slur, StemDirection, Tuplet } from './types';
|
|
1
|
+
import { Note, NoteJSON } from './Note.js';
|
|
2
|
+
import { Pitch } from './Pitch.js';
|
|
3
|
+
import { Accidental, AccidentalDisplay, Arpeggio, Articulation, BeamLevels, Bowing, Duration, Dynamic, FretboardDiagram, Glissando, GraceNote, Hairpin, Lyric, NoteheadShape, Ornament, Ottava, Pedal, RestDisplay, Slur, StemDirection, TieSpan, Tuplet } from './types.js';
|
|
4
4
|
export declare class NoteSet {
|
|
5
5
|
readonly notes: Note[];
|
|
6
6
|
constructor(notes: Note[]);
|
|
7
7
|
get duration(): Duration;
|
|
8
8
|
get isDotted(): boolean;
|
|
9
|
+
get dotCount(): number;
|
|
9
10
|
get isRest(): boolean;
|
|
10
11
|
get beamGroup(): number | undefined;
|
|
12
|
+
get beamLevels(): BeamLevels | undefined;
|
|
11
13
|
get tuplet(): Tuplet | undefined;
|
|
12
14
|
getDurationValue(): number;
|
|
13
15
|
isBeamable(): boolean;
|
|
14
|
-
withDuration(duration: Duration,
|
|
16
|
+
withDuration(duration: Duration, dotCount?: number): NoteSet;
|
|
15
17
|
withBeamGroup(group?: number): NoteSet;
|
|
16
18
|
withNotes(notes: Note[]): NoteSet;
|
|
17
19
|
withLyrics(lyrics: Lyric[]): NoteSet;
|
|
@@ -20,6 +22,8 @@ export declare class NoteSet {
|
|
|
20
22
|
withAccidental(accidental?: Accidental): NoteSet;
|
|
21
23
|
withRest(isRest: boolean): NoteSet;
|
|
22
24
|
withGrace(isGrace: boolean): NoteSet;
|
|
25
|
+
withCue(isCue: boolean): NoteSet;
|
|
26
|
+
withAccidentalDisplay(accidentalDisplay?: AccidentalDisplay): NoteSet;
|
|
23
27
|
toggleEnharmonic(): NoteSet;
|
|
24
28
|
transpose(semitones: number): NoteSet;
|
|
25
29
|
transposeOctave(octaves: number): NoteSet;
|
|
@@ -50,8 +54,14 @@ export declare class NoteSet {
|
|
|
50
54
|
withFretboardDiagram(diagram?: FretboardDiagram): NoteSet;
|
|
51
55
|
get pitch(): Pitch | undefined;
|
|
52
56
|
get accidental(): Accidental | undefined;
|
|
57
|
+
get accidentalDisplay(): AccidentalDisplay | undefined;
|
|
53
58
|
get tie(): boolean | undefined;
|
|
54
59
|
get slur(): Slur | undefined;
|
|
60
|
+
get tieSpans(): TieSpan[];
|
|
61
|
+
get slurs(): Slur[];
|
|
62
|
+
get grace(): GraceNote | undefined;
|
|
63
|
+
get isCue(): boolean;
|
|
64
|
+
get restDisplay(): RestDisplay | undefined;
|
|
55
65
|
get articulations(): Articulation[] | undefined;
|
|
56
66
|
get articulation(): Articulation | undefined;
|
|
57
67
|
get ornament(): Ornament | undefined;
|
package/dist/models/NoteSet.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Note } from './Note';
|
|
2
|
-
import { Duration, } from './types';
|
|
1
|
+
import { Note } from './Note.js';
|
|
2
|
+
import { Duration, } from './types.js';
|
|
3
3
|
export class NoteSet {
|
|
4
4
|
notes;
|
|
5
5
|
constructor(notes) {
|
|
@@ -14,12 +14,18 @@ export class NoteSet {
|
|
|
14
14
|
get isDotted() {
|
|
15
15
|
return this.notes[0].isDotted;
|
|
16
16
|
}
|
|
17
|
+
get dotCount() {
|
|
18
|
+
return this.notes[0].dotCount;
|
|
19
|
+
}
|
|
17
20
|
get isRest() {
|
|
18
21
|
return this.notes[0].isRest;
|
|
19
22
|
}
|
|
20
23
|
get beamGroup() {
|
|
21
24
|
return this.notes[0].beamGroup;
|
|
22
25
|
}
|
|
26
|
+
get beamLevels() {
|
|
27
|
+
return this.notes[0].beamLevels;
|
|
28
|
+
}
|
|
23
29
|
get tuplet() {
|
|
24
30
|
return this.notes[0].tuplet;
|
|
25
31
|
}
|
|
@@ -29,8 +35,8 @@ export class NoteSet {
|
|
|
29
35
|
isBeamable() {
|
|
30
36
|
return this.notes[0].isBeamable();
|
|
31
37
|
}
|
|
32
|
-
withDuration(duration,
|
|
33
|
-
return new NoteSet(this.notes.map((n) => n.withDuration(duration,
|
|
38
|
+
withDuration(duration, dotCount = 0) {
|
|
39
|
+
return new NoteSet(this.notes.map((n) => n.withDuration(duration, dotCount)));
|
|
34
40
|
}
|
|
35
41
|
withBeamGroup(group) {
|
|
36
42
|
return new NoteSet(this.notes.map((n) => n.withBeamGroup(group)));
|
|
@@ -78,6 +84,16 @@ export class NoteSet {
|
|
|
78
84
|
withGrace(isGrace) {
|
|
79
85
|
return new NoteSet(this.notes.map((n) => n.withGrace(isGrace)));
|
|
80
86
|
}
|
|
87
|
+
withCue(isCue) {
|
|
88
|
+
return new NoteSet(this.notes.map((n) => n.withCue(isCue)));
|
|
89
|
+
}
|
|
90
|
+
withAccidentalDisplay(accidentalDisplay) {
|
|
91
|
+
const newNotes = [...this.notes];
|
|
92
|
+
if (newNotes.length > 0) {
|
|
93
|
+
newNotes[0] = newNotes[0].withAccidentalDisplay(accidentalDisplay);
|
|
94
|
+
}
|
|
95
|
+
return new NoteSet(newNotes);
|
|
96
|
+
}
|
|
81
97
|
toggleEnharmonic() {
|
|
82
98
|
const newNotes = [...this.notes];
|
|
83
99
|
if (newNotes.length > 0) {
|
|
@@ -172,12 +188,30 @@ export class NoteSet {
|
|
|
172
188
|
get accidental() {
|
|
173
189
|
return this.notes[0].accidental;
|
|
174
190
|
}
|
|
191
|
+
get accidentalDisplay() {
|
|
192
|
+
return this.notes[0].accidentalDisplay;
|
|
193
|
+
}
|
|
175
194
|
get tie() {
|
|
176
195
|
return this.notes[0].tie;
|
|
177
196
|
}
|
|
178
197
|
get slur() {
|
|
179
198
|
return this.notes[0].slur;
|
|
180
199
|
}
|
|
200
|
+
get tieSpans() {
|
|
201
|
+
return this.notes[0].tieSpans || [];
|
|
202
|
+
}
|
|
203
|
+
get slurs() {
|
|
204
|
+
return this.notes[0].slurs || (this.notes[0].slur ? [this.notes[0].slur] : []);
|
|
205
|
+
}
|
|
206
|
+
get grace() {
|
|
207
|
+
return this.notes[0].grace;
|
|
208
|
+
}
|
|
209
|
+
get isCue() {
|
|
210
|
+
return !!this.notes[0].isCue;
|
|
211
|
+
}
|
|
212
|
+
get restDisplay() {
|
|
213
|
+
return this.notes[0].restDisplay;
|
|
214
|
+
}
|
|
181
215
|
get articulations() {
|
|
182
216
|
return this.notes[0].articulations;
|
|
183
217
|
}
|
package/dist/models/Part.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Instrument } from './Instrument';
|
|
2
|
-
import { Measure } from './Measure';
|
|
3
|
-
import { Note } from './Note';
|
|
4
|
-
import { Staff, StaffJSON } from './Staff';
|
|
5
|
-
import { Duration } from './types';
|
|
1
|
+
import { Instrument } from './Instrument.js';
|
|
2
|
+
import { Measure } from './Measure.js';
|
|
3
|
+
import { Note } from './Note.js';
|
|
4
|
+
import { Staff, StaffJSON } from './Staff.js';
|
|
5
|
+
import { Duration } from './types.js';
|
|
6
6
|
/**
|
|
7
7
|
* Represents a musical part (instrument/voice) which can have multiple staves.
|
|
8
8
|
*/
|
|
@@ -19,7 +19,7 @@ export declare class Part {
|
|
|
19
19
|
replaceNote(staffIndex: number, measureIndex: number, noteIndex: number, newNote: Note, voiceIndex?: number): Part;
|
|
20
20
|
replaceMeasure(staffIndex: number, measureIndex: number, newMeasure: Measure): Part;
|
|
21
21
|
deleteNote(staffIndex: number, measureIndex: number, noteIndex: number, voiceIndex?: number): Part;
|
|
22
|
-
changeNoteDuration(staffIndex: number, measureIndex: number, noteIndex: number, newDuration: Duration,
|
|
22
|
+
changeNoteDuration(staffIndex: number, measureIndex: number, noteIndex: number, newDuration: Duration, dotCount?: number, voiceIndex?: number): Part;
|
|
23
23
|
toJSON(): PartJSON;
|
|
24
24
|
withInstrument(instrument: Instrument): Part;
|
|
25
25
|
replaceStaff(staffIndex: number, newStaff: Staff): Part;
|
package/dist/models/Part.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PRESET_INSTRUMENTS } from './Instrument';
|
|
2
|
-
import { Staff } from './Staff';
|
|
1
|
+
import { PRESET_INSTRUMENTS } from './Instrument.js';
|
|
2
|
+
import { Staff } from './Staff.js';
|
|
3
3
|
/**
|
|
4
4
|
* Represents a musical part (instrument/voice) which can have multiple staves.
|
|
5
5
|
*/
|
|
@@ -49,11 +49,11 @@ export class Part {
|
|
|
49
49
|
newStaves[staffIndex] = newStaves[staffIndex].deleteNote(measureIndex, noteIndex, voiceIndex);
|
|
50
50
|
return new Part(this.name, newStaves, this.abbreviation, this.instrument);
|
|
51
51
|
}
|
|
52
|
-
changeNoteDuration(staffIndex, measureIndex, noteIndex, newDuration,
|
|
52
|
+
changeNoteDuration(staffIndex, measureIndex, noteIndex, newDuration, dotCount = 0, voiceIndex = 0) {
|
|
53
53
|
if (staffIndex < 0 || staffIndex >= this.staves.length)
|
|
54
54
|
return this;
|
|
55
55
|
const newStaves = [...this.staves];
|
|
56
|
-
newStaves[staffIndex] = newStaves[staffIndex].changeNoteDuration(measureIndex, noteIndex, newDuration,
|
|
56
|
+
newStaves[staffIndex] = newStaves[staffIndex].changeNoteDuration(measureIndex, noteIndex, newDuration, dotCount, voiceIndex);
|
|
57
57
|
return new Part(this.name, newStaves, this.abbreviation, this.instrument);
|
|
58
58
|
}
|
|
59
59
|
toJSON() {
|
package/dist/models/Pitch.d.ts
CHANGED
package/dist/models/Pitch.js
CHANGED