@scorelabs/core 1.0.9 → 1.0.11

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.
@@ -1,13 +1,10 @@
1
- import { Pitch } from './Pitch';
2
- import { Accidental, DURATION_VALUES, Duration, } from './types';
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';
3
+ // TODO: replace dotCountOrIsDotted with dotCount: number and use it everywhere. Do not worry about legacy stuff.
6
4
  export class Note {
7
5
  duration;
8
6
  pitch;
9
7
  isRest;
10
- isDotted;
11
8
  accidental;
12
9
  beamGroup;
13
10
  articulations;
@@ -39,12 +36,11 @@ export class Note {
39
36
  hammerOn;
40
37
  pullOff;
41
38
  constructor(duration, pitch, // undefined for rests
42
- isRest = false, isDotted = false, accidental, beamGroup, // Group ID for beamed notes
39
+ isRest = false, dotCountOrIsDotted = 0, accidental, beamGroup, // Group ID for beamed notes
43
40
  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) {
44
41
  this.duration = duration;
45
42
  this.pitch = pitch;
46
43
  this.isRest = isRest;
47
- this.isDotted = isDotted;
48
44
  this.accidental = accidental;
49
45
  this.beamGroup = beamGroup;
50
46
  this.articulations = articulations;
@@ -75,16 +71,22 @@ export class Note {
75
71
  this.palmMute = palmMute;
76
72
  this.hammerOn = hammerOn;
77
73
  this.pullOff = pullOff;
74
+ this.dotCount =
75
+ typeof dotCountOrIsDotted === 'number' ? dotCountOrIsDotted : dotCountOrIsDotted ? 1 : 0;
76
+ }
77
+ dotCount;
78
+ get isDotted() {
79
+ return this.dotCount > 0;
78
80
  }
79
81
  /**
80
82
  * Get all lyrics as standardized objects
81
83
  */
82
84
  get allLyrics() {
83
85
  if (this.lyrics) {
84
- return this.lyrics.map((l) => (typeof l === 'string' ? { text: l } : l));
86
+ return this.lyrics;
85
87
  }
86
88
  if (this.lyric) {
87
- return [{ text: this.lyric }];
89
+ return [this.lyric];
88
90
  }
89
91
  return [];
90
92
  }
@@ -100,8 +102,7 @@ export class Note {
100
102
  getDurationValue() {
101
103
  if (this.isGrace)
102
104
  return 0;
103
- const base = DURATION_VALUES[this.duration];
104
- let val = this.isDotted ? base * 1.5 : base;
105
+ let val = calculateDurationValue(this.duration, this.dotCount);
105
106
  if (this.tuplet) {
106
107
  val = val * (this.tuplet.normal / this.tuplet.actual);
107
108
  }
@@ -120,10 +121,10 @@ export class Note {
120
121
  this.duration === Duration.TwoHundredFiftySixth));
121
122
  }
122
123
  withGrace(isGrace) {
123
- return new Note(this.duration, this.pitch, this.isRest, this.isDotted, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, isGrace, 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);
124
+ 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.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);
124
125
  }
125
126
  withChord(chord) {
126
- return new Note(this.duration, this.pitch, this.isRest, this.isDotted, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, 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);
127
+ 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.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);
127
128
  }
128
129
  transpose(semitones) {
129
130
  if (this.isRest || !this.pitch) {
@@ -133,7 +134,7 @@ export class Note {
133
134
  const chromaticIdx = newPitch.midiNumber % 12;
134
135
  const hasSharp = [1, 3, 6, 8, 10].includes(chromaticIdx);
135
136
  const newAccidental = hasSharp ? Accidental.Sharp : undefined;
136
- return new Note(this.duration, newPitch, this.isRest, this.isDotted, newAccidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, 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);
137
+ 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.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);
137
138
  }
138
139
  transposeOctave(octaves) {
139
140
  if (!this.pitch || this.isRest)
@@ -166,97 +167,97 @@ export class Note {
166
167
  return this.withPitch(newPitch).withAccidental(newAccidental);
167
168
  }
168
169
  withPitch(pitch) {
169
- return new Note(this.duration, pitch, false, this.isDotted, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, 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);
170
+ 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.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);
170
171
  }
171
172
  withArticulation(articulation) {
172
- return new Note(this.duration, this.pitch, this.isRest, this.isDotted, this.accidental, this.beamGroup, articulation ? [articulation] : [], this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, 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);
173
+ 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.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);
173
174
  }
174
175
  withArticulations(articulations) {
175
- return new Note(this.duration, this.pitch, this.isRest, this.isDotted, this.accidental, this.beamGroup, articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, 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);
176
+ 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.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);
176
177
  }
177
178
  withDynamic(dynamic) {
178
- return new Note(this.duration, this.pitch, this.isRest, this.isDotted, this.accidental, this.beamGroup, this.articulations, dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, 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);
179
+ 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.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);
179
180
  }
180
181
  withTie(tie) {
181
- return new Note(this.duration, this.pitch, this.isRest, this.isDotted, this.accidental, this.beamGroup, this.articulations, this.dynamic, tie, this.slur, this.tuplet, this.hairpin, this.isGrace, 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);
182
+ 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.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);
182
183
  }
183
184
  withSlur(slur) {
184
- return new Note(this.duration, this.pitch, this.isRest, this.isDotted, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, slur, this.tuplet, this.hairpin, this.isGrace, 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);
185
+ 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.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);
185
186
  }
186
187
  withTuplet(tuplet) {
187
- return new Note(this.duration, this.pitch, this.isRest, this.isDotted, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, tuplet, this.hairpin, this.isGrace, 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);
188
+ 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.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);
188
189
  }
189
190
  withLyric(lyric) {
190
- return new Note(this.duration, this.pitch, this.isRest, this.isDotted, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, 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);
191
+ 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, 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);
191
192
  }
192
193
  withLyrics(lyrics) {
193
- return new Note(this.duration, this.pitch, this.isRest, this.isDotted, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, 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);
194
+ 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.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);
194
195
  }
195
196
  withHairpin(hairpin) {
196
- return new Note(this.duration, this.pitch, this.isRest, this.isDotted, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, hairpin, this.isGrace, 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);
197
+ 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.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);
197
198
  }
198
199
  withAccidental(accidental) {
199
- return new Note(this.duration, this.pitch, this.isRest, this.isDotted, accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, 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);
200
+ 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.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);
200
201
  }
201
- withDuration(duration, isDotted = false) {
202
- return new Note(duration, this.pitch, this.isRest, isDotted, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, 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);
202
+ withDuration(duration, dotCountOrIsDotted = 0) {
203
+ return new Note(duration, this.pitch, this.isRest, dotCountOrIsDotted, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, 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);
203
204
  }
204
205
  withRest(isRest) {
205
- return new Note(this.duration, this.pitch, isRest, this.isDotted, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, 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);
206
+ 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.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);
206
207
  }
207
208
  withFretboardDiagram(diagram) {
208
- return new Note(this.duration, this.pitch, this.isRest, this.isDotted, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, 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);
209
+ 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.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);
209
210
  }
210
211
  withBeamGroup(beamGroup) {
211
- return new Note(this.duration, this.pitch, this.isRest, this.isDotted, this.accidental, beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, 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);
212
+ 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.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);
212
213
  }
213
214
  withGlissando(glissando) {
214
- return new Note(this.duration, this.pitch, this.isRest, this.isDotted, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, 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);
215
+ 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.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);
215
216
  }
216
217
  withArpeggio(arpeggio) {
217
- return new Note(this.duration, this.pitch, this.isRest, this.isDotted, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, 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);
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.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);
218
219
  }
219
220
  withOttava(ottava) {
220
- return new Note(this.duration, this.pitch, this.isRest, this.isDotted, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, 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);
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.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);
221
222
  }
222
223
  withPedal(pedal) {
223
- return new Note(this.duration, this.pitch, this.isRest, this.isDotted, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, 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);
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, this.hairpin, this.isGrace, 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);
224
225
  }
225
226
  withOrnament(ornament) {
226
- return new Note(this.duration, this.pitch, this.isRest, this.isDotted, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, 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);
227
+ 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.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);
227
228
  }
228
229
  withTab(fret, string) {
229
- return new Note(this.duration, this.pitch, this.isRest, this.isDotted, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, 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);
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.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);
230
231
  }
231
232
  withStaffText(text) {
232
- return new Note(this.duration, this.pitch, this.isRest, this.isDotted, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, 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);
233
+ 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.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);
233
234
  }
234
235
  withColor(color) {
235
- return new Note(this.duration, this.pitch, this.isRest, this.isDotted, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, 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);
236
+ 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.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);
236
237
  }
237
238
  withNotehead(notehead) {
238
- return new Note(this.duration, this.pitch, this.isRest, this.isDotted, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, 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);
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.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);
239
240
  }
240
241
  withBowing(bowing) {
241
- return new Note(this.duration, this.pitch, this.isRest, this.isDotted, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, 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);
242
+ 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.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);
242
243
  }
243
244
  withFingering(fingering) {
244
- return new Note(this.duration, this.pitch, this.isRest, this.isDotted, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, 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);
245
+ 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.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);
245
246
  }
246
247
  withStemDirection(stemDirection) {
247
- return new Note(this.duration, this.pitch, this.isRest, this.isDotted, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, 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);
248
+ 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.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);
248
249
  }
249
250
  withStringCircled(isStringCircled) {
250
- return new Note(this.duration, this.pitch, this.isRest, this.isDotted, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, 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);
251
+ 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.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);
251
252
  }
252
253
  withPalmMute(palmMute) {
253
- return new Note(this.duration, this.pitch, this.isRest, this.isDotted, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, 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);
254
+ 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.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);
254
255
  }
255
256
  withHammerOn(hammerOn) {
256
- return new Note(this.duration, this.pitch, this.isRest, this.isDotted, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, 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);
257
+ 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.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);
257
258
  }
258
259
  withPullOff(pullOff) {
259
- return new Note(this.duration, this.pitch, this.isRest, this.isDotted, this.accidental, this.beamGroup, this.articulations, this.dynamic, this.tie, this.slur, this.tuplet, this.hairpin, this.isGrace, 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);
260
+ 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.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);
260
261
  }
261
262
  toJSON() {
262
263
  return {
@@ -273,6 +274,7 @@ export class Note {
273
274
  : undefined,
274
275
  isRest: this.isRest || undefined,
275
276
  isDotted: this.isDotted || undefined,
277
+ dotCount: this.dotCount || undefined,
276
278
  accidental: this.accidental,
277
279
  beamGroup: this.beamGroup,
278
280
  articulations: this.articulations.length > 0 ? this.articulations : undefined,
@@ -319,6 +321,6 @@ export class Note {
319
321
  else if (data.articulation) {
320
322
  articulations = [data.articulation];
321
323
  }
322
- return new Note(data.duration, pitch, data.isRest ?? false, data.isDotted ?? false, data.accidental, data.beamGroup, articulations, data.dynamic, data.tie, data.slur, data.tuplet, data.hairpin, data.isGrace ?? 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);
324
+ 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.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);
323
325
  }
324
326
  }
@@ -1,20 +1,21 @@
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, Arpeggio, Articulation, Bowing, Duration, Dynamic, FretboardDiagram, Glissando, Hairpin, Lyric, NoteheadShape, Ornament, Ottava, Pedal, Slur, StemDirection, 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;
11
12
  get tuplet(): Tuplet | undefined;
12
13
  getDurationValue(): number;
13
14
  isBeamable(): boolean;
14
- withDuration(duration: Duration, isDotted?: boolean): NoteSet;
15
+ withDuration(duration: Duration, dotCountOrIsDotted?: number | boolean): NoteSet;
15
16
  withBeamGroup(group?: number): NoteSet;
16
17
  withNotes(notes: Note[]): NoteSet;
17
- withLyrics(lyrics: (string | Lyric)[]): NoteSet;
18
+ withLyrics(lyrics: Lyric[]): NoteSet;
18
19
  withTuplet(tuplet?: Tuplet): NoteSet;
19
20
  withPitch(pitch: Pitch): NoteSet;
20
21
  withAccidental(accidental?: Accidental): NoteSet;
@@ -45,14 +46,14 @@ export declare class NoteSet {
45
46
  withPalmMute(type?: 'start' | 'stop'): NoteSet;
46
47
  withStringCircled(isStringCircled?: boolean): NoteSet;
47
48
  withStemDirection(dir?: StemDirection): NoteSet;
48
- withLyric(lyric?: string): NoteSet;
49
+ withLyric(lyric?: Lyric): NoteSet;
49
50
  withStaffText(text?: string): NoteSet;
50
51
  withFretboardDiagram(diagram?: FretboardDiagram): NoteSet;
51
52
  get pitch(): Pitch | undefined;
52
53
  get accidental(): Accidental | undefined;
53
54
  get tie(): boolean | undefined;
54
55
  get slur(): Slur | undefined;
55
- get articulations(): Articulation[];
56
+ get articulations(): Articulation[] | undefined;
56
57
  get articulation(): Articulation | undefined;
57
58
  get ornament(): Ornament | undefined;
58
59
  get dynamic(): Dynamic | undefined;
@@ -68,14 +69,14 @@ export declare class NoteSet {
68
69
  get bowing(): Bowing | undefined;
69
70
  get fingering(): number | undefined;
70
71
  get allLyrics(): Lyric[];
71
- get lyrics(): (string | Lyric)[] | undefined;
72
- get lyric(): string | undefined;
72
+ get lyrics(): Lyric[] | undefined;
73
+ get lyric(): Lyric | undefined;
73
74
  get chord(): string | undefined;
74
75
  get fretboardDiagram(): FretboardDiagram | undefined;
75
76
  get staffText(): string | undefined;
76
- get hammerOn(): "start" | "stop" | undefined;
77
- get pullOff(): "start" | "stop" | undefined;
78
- get palmMute(): "start" | "stop" | undefined;
77
+ get hammerOn(): 'start' | 'stop' | undefined;
78
+ get pullOff(): 'start' | 'stop' | undefined;
79
+ get palmMute(): 'start' | 'stop' | undefined;
79
80
  get isStringCircled(): boolean | undefined;
80
81
  get stemDirection(): StemDirection | undefined;
81
82
  toJSON(): NoteSetJSON;
@@ -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,6 +14,9 @@ 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
  }
@@ -29,8 +32,8 @@ export class NoteSet {
29
32
  isBeamable() {
30
33
  return this.notes[0].isBeamable();
31
34
  }
32
- withDuration(duration, isDotted = false) {
33
- return new NoteSet(this.notes.map((n) => n.withDuration(duration, isDotted)));
35
+ withDuration(duration, dotCountOrIsDotted = 0) {
36
+ return new NoteSet(this.notes.map((n) => n.withDuration(duration, dotCountOrIsDotted)));
34
37
  }
35
38
  withBeamGroup(group) {
36
39
  return new NoteSet(this.notes.map((n) => n.withBeamGroup(group)));
@@ -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
  */
@@ -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
  */
@@ -1,4 +1,4 @@
1
- import { Clef } from './types';
1
+ import { Clef } from './types.js';
2
2
  /**
3
3
  * Pitch representation using MIDI numbers and explicit spelling (step, alter, octave).
4
4
  */
@@ -1,4 +1,4 @@
1
- import { Clef } from './types';
1
+ import { Clef } from './types.js';
2
2
  /**
3
3
  * Pitch representation using MIDI numbers and explicit spelling (step, alter, octave).
4
4
  */
@@ -1,4 +1,4 @@
1
- import { Clef, KeySignature, TimeSignature } from './types';
1
+ import { Clef, KeySignature, TimeSignature } from './types.js';
2
2
  export interface PreMeasureJSON {
3
3
  clef?: string;
4
4
  keySignature?: KeySignature;
@@ -1,8 +1,8 @@
1
- import { Measure } from './Measure';
2
- import { NoteSet } from './NoteSet';
3
- import { Part, PartJSON } from './Part';
4
- import { Staff } from './Staff';
5
- import { Clef, Duration, Genre, KeySignature, TimeSignature } from './types';
1
+ import { Measure } from './Measure.js';
2
+ import { NoteSet } from './NoteSet.js';
3
+ import { Part, PartJSON } from './Part.js';
4
+ import { Staff } from './Staff.js';
5
+ import { Clef, Duration, Genre, KeySignature, TimeSignature } from './types.js';
6
6
  /**
7
7
  * Represents a complete musical score.
8
8
  */
@@ -19,13 +19,15 @@ export declare class Score {
19
19
  readonly lyricist: string;
20
20
  readonly swing: boolean;
21
21
  readonly subtitle: string;
22
- readonly genre: Genre | string;
22
+ readonly genre: Genre;
23
23
  readonly tempoText: string;
24
- constructor(title: string, composer: string, timeSignature: TimeSignature, keySignature: KeySignature, parts: Part[], bpm?: number, tempoDuration?: Duration, tempoIsDotted?: boolean, copyright?: string, lyricist?: string, swing?: boolean, subtitle?: string, genre?: Genre | string, tempoText?: string);
24
+ readonly tempoDotCount: number;
25
+ constructor(title: string, composer: string, timeSignature: TimeSignature, keySignature: KeySignature, parts: Part[], bpm?: number, tempoDuration?: Duration, tempoIsDotted?: boolean, copyright?: string, lyricist?: string, swing?: boolean, subtitle?: string, genre?: Genre, tempoText?: string, tempoDotCount?: number);
25
26
  withTitle(title: string): Score;
26
27
  withComposer(composer: string): Score;
27
28
  withSubtitle(subtitle: string): Score;
28
- withGenre(genre: Genre | string): Score;
29
+ withGenre(genre: Genre): Score;
30
+ withBpm(bpm: number): Score;
29
31
  getMeasureCount(): number;
30
32
  getTimeSignatureAt(measureIndex: number): TimeSignature;
31
33
  getKeySignatureAt(measureIndex: number): KeySignature;
@@ -56,6 +58,7 @@ export declare class Score {
56
58
  replaceMeasure(partIndex: number, staffIndex: number, measureIndex: number, newMeasure: Measure, autoBeam?: boolean): Score;
57
59
  deleteNote(partIndex: number, staffIndex: number, measureIndex: number, noteIndex: number, voiceIndex?: number): Score;
58
60
  changeNoteDuration(partIndex: number, staffIndex: number, measureIndex: number, noteIndex: number, newDuration: Duration, isDotted?: boolean, voiceIndex?: number): Score;
61
+ moveNoteToVoice(partIndex: number, staffIndex: number, measureIndex: number, noteIndex: number, fromVoiceIndex: number, toVoiceIndex: number): Score;
59
62
  pasteNotes(partIndex: number, staffIndex: number, measureIndex: number, noteIndex: number, notesToPaste: NoteSet[]): Score;
60
63
  withTempo(bpm: number, duration: Duration, isDotted: boolean): Score;
61
64
  withTempoText(text: string): Score;
@@ -81,10 +84,11 @@ export interface ScoreJSON {
81
84
  bpm?: number;
82
85
  tempoDuration?: Duration;
83
86
  tempoIsDotted?: boolean;
87
+ tempoDotCount?: number;
84
88
  copyright?: string;
85
89
  lyricist?: string;
86
90
  swing?: boolean;
87
91
  subtitle?: string;
88
- genre?: Genre | string;
92
+ genre?: Genre;
89
93
  tempoText?: string;
90
94
  }