musicxml-io 0.2.7 → 0.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +137 -23
- package/dist/{index-CVGy8DJi.d.ts → index-B-GcfEfL.d.ts} +1 -1
- package/dist/{index-D4hW6ANJ.d.mts → index-BvwdY5YQ.d.mts} +1 -1
- package/dist/index.d.mts +188 -7
- package/dist/index.d.ts +188 -7
- package/dist/index.js +187 -31
- package/dist/index.mjs +160 -31
- package/dist/operations/index.d.mts +2 -2
- package/dist/operations/index.d.ts +2 -2
- package/dist/query/index.d.mts +358 -2
- package/dist/query/index.d.ts +358 -2
- package/dist/query/index.js +1508 -2
- package/dist/query/index.mjs +1444 -1
- package/dist/{types-CSI8kV28.d.mts → types-Bpq2o5JS.d.mts} +1 -1
- package/dist/{types-CSI8kV28.d.ts → types-Bpq2o5JS.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/accessors/index.d.mts +0 -360
- package/dist/accessors/index.d.ts +0 -360
- package/dist/accessors/index.js +0 -1537
- package/dist/accessors/index.mjs +0 -1448
package/dist/query/index.d.mts
CHANGED
|
@@ -1,5 +1,361 @@
|
|
|
1
|
-
import { S as Score,
|
|
1
|
+
import { M as Measure, N as NoteEntry, V as VoiceGroup, q as StaffGroup, r as NoteWithPosition, s as Chord, S as Score, t as NoteIteratorItem, h as MeasureEntry, x as VoiceToStaffMap, f as Part, C as Clef, G as StaffRange, H as PositionQueryOptions, I as VerticalSlice, J as VoiceLine, E as EntryWithContext, y as NoteWithContext, O as AdjacentNotes, z as DirectionWithContext, a as DirectionEntry, Q as DirectionKind, R as DynamicWithContext, U as TempoWithContext, W as PedalWithContext, X as WedgeWithContext, Y as OctaveShiftWithContext, Z as TiedNoteGroup, _ as SlurSpan, $ as TupletGroup, a0 as BeamGroup, a1 as NotationType, a2 as HarmonyWithContext, ae as HarmonyEntry, a3 as LyricWithContext, a4 as AssembledLyrics, a6 as RepeatInfo, a5 as BarlineWithContext, a7 as EndingInfo, a8 as KeyChangeInfo, a9 as TimeChangeInfo, aa as ClefChangeInfo, ab as StructuralChanges, g as MeasureAttributes, P as Pitch } from '../types-Bpq2o5JS.mjs';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Filter options for voice/staff selection
|
|
5
|
+
*/
|
|
6
|
+
interface VoiceFilter {
|
|
7
|
+
voice?: number;
|
|
8
|
+
staff?: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Get all notes for a specific voice (and optionally staff)
|
|
12
|
+
*/
|
|
13
|
+
declare function getNotesForVoice(measure: Measure, filter: VoiceFilter): NoteEntry[];
|
|
14
|
+
/**
|
|
15
|
+
* Get all notes for a specific staff (regardless of voice)
|
|
16
|
+
*/
|
|
17
|
+
declare function getNotesForStaff(measure: Measure, filter: {
|
|
18
|
+
staff: number;
|
|
19
|
+
}): NoteEntry[];
|
|
20
|
+
/**
|
|
21
|
+
* Group notes by voice (and staff)
|
|
22
|
+
*/
|
|
23
|
+
declare function groupByVoice(measure: Measure): VoiceGroup[];
|
|
24
|
+
/**
|
|
25
|
+
* Group notes by staff
|
|
26
|
+
*/
|
|
27
|
+
declare function groupByStaff(measure: Measure): StaffGroup[];
|
|
28
|
+
/**
|
|
29
|
+
* Calculate absolute position of a note within a measure
|
|
30
|
+
* Position is in divisions from the start of the measure
|
|
31
|
+
*/
|
|
32
|
+
declare function getAbsolutePosition(note: NoteEntry, measure: Measure): number;
|
|
33
|
+
/**
|
|
34
|
+
* Add absolute position to all notes in a measure
|
|
35
|
+
*/
|
|
36
|
+
declare function withAbsolutePositions(measure: Measure): NoteWithPosition[];
|
|
37
|
+
/**
|
|
38
|
+
* Get chords (groups of simultaneously sounding notes)
|
|
39
|
+
*/
|
|
40
|
+
declare function getChords(measure: Measure, filter?: VoiceFilter): Chord[];
|
|
41
|
+
/**
|
|
42
|
+
* Iterate over all notes in a score
|
|
43
|
+
*/
|
|
44
|
+
declare function iterateNotes(score: Score): Generator<NoteIteratorItem>;
|
|
45
|
+
/**
|
|
46
|
+
* Get all notes from a score as an array
|
|
47
|
+
*/
|
|
48
|
+
declare function getAllNotes(score: Score): NoteIteratorItem[];
|
|
49
|
+
/**
|
|
50
|
+
* Get unique voices used in a measure
|
|
51
|
+
*/
|
|
52
|
+
declare function getVoices(measure: Measure): number[];
|
|
53
|
+
/**
|
|
54
|
+
* Get unique staves used in a measure
|
|
55
|
+
*/
|
|
56
|
+
declare function getStaves(measure: Measure): number[];
|
|
57
|
+
/**
|
|
58
|
+
* Check if a measure contains any notes
|
|
59
|
+
*/
|
|
60
|
+
declare function hasNotes(measure: Measure): boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Check if a measure is a rest (no pitched notes)
|
|
63
|
+
*/
|
|
64
|
+
declare function isRestMeasure(measure: Measure): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Options for normalized position calculation
|
|
67
|
+
*/
|
|
68
|
+
interface NormalizedPositionOptions {
|
|
69
|
+
baseDivisions: number;
|
|
70
|
+
currentDivisions?: number;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Get a normalized position of a note using a common base divisions
|
|
74
|
+
* This is useful when comparing positions across measures with different divisions
|
|
75
|
+
*/
|
|
76
|
+
declare function getNormalizedPosition(note: NoteEntry, measure: Measure, options: NormalizedPositionOptions): number;
|
|
77
|
+
/**
|
|
78
|
+
* Get normalized duration of a note using a common base divisions
|
|
79
|
+
*/
|
|
80
|
+
declare function getNormalizedDuration(note: NoteEntry, options: NormalizedPositionOptions): number;
|
|
81
|
+
/**
|
|
82
|
+
* Get all entries for a specific staff (including notes, directions, etc.)
|
|
83
|
+
*/
|
|
84
|
+
declare function getEntriesForStaff(measure: Measure, staff: number): MeasureEntry[];
|
|
85
|
+
/**
|
|
86
|
+
* Build a Voice to Staff mapping from a measure
|
|
87
|
+
* Uses explicitly specified staff values to infer staff for voices
|
|
88
|
+
*/
|
|
89
|
+
declare function buildVoiceToStaffMap(measure: Measure): VoiceToStaffMap;
|
|
90
|
+
/**
|
|
91
|
+
* Build a Voice to Staff mapping from all measures in a part
|
|
92
|
+
*/
|
|
93
|
+
declare function buildVoiceToStaffMapForPart(part: Part): VoiceToStaffMap;
|
|
94
|
+
/**
|
|
95
|
+
* Infer staff number for an entry using voice-to-staff mapping
|
|
96
|
+
* Returns 1 as default if unable to infer (per MusicXML spec)
|
|
97
|
+
*/
|
|
98
|
+
declare function inferStaff(entry: NoteEntry, voiceToStaffMap: VoiceToStaffMap): number;
|
|
99
|
+
/**
|
|
100
|
+
* Get effective staff for an entry (explicit or inferred)
|
|
101
|
+
*/
|
|
102
|
+
declare function getEffectiveStaff(entry: NoteEntry, measure: Measure): number;
|
|
103
|
+
/**
|
|
104
|
+
* Get the clef for a specific staff at a given measure
|
|
105
|
+
* Searches backwards from the specified measure to find the most recent clef
|
|
106
|
+
*/
|
|
107
|
+
declare function getClefForStaff(score: Score, options: {
|
|
108
|
+
partIndex: number;
|
|
109
|
+
measureIndex: number;
|
|
110
|
+
staff: number;
|
|
111
|
+
}): Clef | undefined;
|
|
112
|
+
/**
|
|
113
|
+
* Get all voices used within a specific staff
|
|
114
|
+
*/
|
|
115
|
+
declare function getVoicesForStaff(measure: Measure, staff: number): number[];
|
|
116
|
+
/**
|
|
117
|
+
* Get the range of staff numbers used in a part
|
|
118
|
+
*/
|
|
119
|
+
declare function getStaffRange(score: Score, partIndex: number): StaffRange;
|
|
120
|
+
/**
|
|
121
|
+
* Get all entries at a specific position in a measure
|
|
122
|
+
*/
|
|
123
|
+
declare function getEntriesAtPosition(measure: Measure, position: number, options?: PositionQueryOptions): MeasureEntry[];
|
|
124
|
+
/**
|
|
125
|
+
* Get all notes at a specific position in a measure
|
|
126
|
+
*/
|
|
127
|
+
declare function getNotesAtPosition(measure: Measure, position: number, options?: PositionQueryOptions): NoteEntry[];
|
|
128
|
+
/**
|
|
129
|
+
* Get all entries within a position range
|
|
130
|
+
*/
|
|
131
|
+
declare function getEntriesInRange(measure: Measure, range: {
|
|
132
|
+
start: number;
|
|
133
|
+
end: number;
|
|
134
|
+
}, options?: PositionQueryOptions): MeasureEntry[];
|
|
135
|
+
/**
|
|
136
|
+
* Get all notes within a position range
|
|
137
|
+
*/
|
|
138
|
+
declare function getNotesInRange(measure: Measure, range: {
|
|
139
|
+
start: number;
|
|
140
|
+
end: number;
|
|
141
|
+
}, options?: PositionQueryOptions): NoteEntry[];
|
|
142
|
+
/**
|
|
143
|
+
* Get a vertical slice of all notes at a specific position across all parts
|
|
144
|
+
*/
|
|
145
|
+
declare function getVerticalSlice(score: Score, options: {
|
|
146
|
+
measureIndex: number;
|
|
147
|
+
position: number;
|
|
148
|
+
}): VerticalSlice;
|
|
149
|
+
/**
|
|
150
|
+
* Get a continuous voice line across all measures
|
|
151
|
+
*/
|
|
152
|
+
declare function getVoiceLine(score: Score, options: {
|
|
153
|
+
partIndex: number;
|
|
154
|
+
voice: number;
|
|
155
|
+
staff?: number;
|
|
156
|
+
}): VoiceLine;
|
|
157
|
+
/**
|
|
158
|
+
* Get a voice line within a measure range
|
|
159
|
+
*/
|
|
160
|
+
declare function getVoiceLineInRange(score: Score, options: {
|
|
161
|
+
partIndex: number;
|
|
162
|
+
voice: number;
|
|
163
|
+
startMeasure: number;
|
|
164
|
+
endMeasure: number;
|
|
165
|
+
staff?: number;
|
|
166
|
+
}): VoiceLine;
|
|
167
|
+
/**
|
|
168
|
+
* Iterate over all entries in a score (not just notes)
|
|
169
|
+
*/
|
|
170
|
+
declare function iterateEntries(score: Score): Generator<EntryWithContext>;
|
|
171
|
+
/**
|
|
172
|
+
* Get the next note in the same voice
|
|
173
|
+
*/
|
|
174
|
+
declare function getNextNote(score: Score, context: NoteWithContext): NoteWithContext | null;
|
|
175
|
+
/**
|
|
176
|
+
* Get the previous note in the same voice
|
|
177
|
+
*/
|
|
178
|
+
declare function getPrevNote(score: Score, context: NoteWithContext): NoteWithContext | null;
|
|
179
|
+
/**
|
|
180
|
+
* Get both previous and next notes
|
|
181
|
+
*/
|
|
182
|
+
declare function getAdjacentNotes(score: Score, context: NoteWithContext): AdjacentNotes;
|
|
183
|
+
/**
|
|
184
|
+
* Get all directions from a score or specific part/measure
|
|
185
|
+
*/
|
|
186
|
+
declare function getDirections(score: Score, options?: {
|
|
187
|
+
partIndex?: number;
|
|
188
|
+
measureIndex?: number;
|
|
189
|
+
}): DirectionWithContext[];
|
|
190
|
+
/**
|
|
191
|
+
* Get directions at a specific position in a measure
|
|
192
|
+
*/
|
|
193
|
+
declare function getDirectionsAtPosition(measure: Measure, position: number): DirectionEntry[];
|
|
194
|
+
/**
|
|
195
|
+
* Find directions by type (kind)
|
|
196
|
+
*/
|
|
197
|
+
declare function findDirectionsByType(score: Score, kind: DirectionKind): DirectionWithContext[];
|
|
198
|
+
/**
|
|
199
|
+
* Get all dynamics markings from a score
|
|
200
|
+
*/
|
|
201
|
+
declare function getDynamics(score: Score, options?: {
|
|
202
|
+
partIndex?: number;
|
|
203
|
+
}): DynamicWithContext[];
|
|
204
|
+
/**
|
|
205
|
+
* Get all tempo markings from a score
|
|
206
|
+
*/
|
|
207
|
+
declare function getTempoMarkings(score: Score): TempoWithContext[];
|
|
208
|
+
/**
|
|
209
|
+
* Get all pedal markings from a score
|
|
210
|
+
*/
|
|
211
|
+
declare function getPedalMarkings(score: Score, options?: {
|
|
212
|
+
partIndex?: number;
|
|
213
|
+
}): PedalWithContext[];
|
|
214
|
+
/**
|
|
215
|
+
* Get all wedges (crescendo/diminuendo) from a score
|
|
216
|
+
*/
|
|
217
|
+
declare function getWedges(score: Score, options?: {
|
|
218
|
+
partIndex?: number;
|
|
219
|
+
}): WedgeWithContext[];
|
|
220
|
+
/**
|
|
221
|
+
* Get all octave shifts from a score
|
|
222
|
+
*/
|
|
223
|
+
declare function getOctaveShifts(score: Score, options?: {
|
|
224
|
+
partIndex?: number;
|
|
225
|
+
}): OctaveShiftWithContext[];
|
|
226
|
+
/**
|
|
227
|
+
* Get all groups of tied notes in a score
|
|
228
|
+
* Each group represents notes connected by ties
|
|
229
|
+
*/
|
|
230
|
+
declare function getTiedNoteGroups(score: Score, options?: {
|
|
231
|
+
partIndex?: number;
|
|
232
|
+
}): TiedNoteGroup[];
|
|
233
|
+
/**
|
|
234
|
+
* Get all slur spans in a score
|
|
235
|
+
* Each span represents a slur from start to stop
|
|
236
|
+
*/
|
|
237
|
+
declare function getSlurSpans(score: Score, options?: {
|
|
238
|
+
partIndex?: number;
|
|
239
|
+
}): SlurSpan[];
|
|
240
|
+
/**
|
|
241
|
+
* Get all tuplet groups in a score
|
|
242
|
+
*/
|
|
243
|
+
declare function getTupletGroups(score: Score, options?: {
|
|
244
|
+
partIndex?: number;
|
|
245
|
+
}): TupletGroup[];
|
|
246
|
+
/**
|
|
247
|
+
* Get all beam groups in a measure
|
|
248
|
+
* Returns groups of notes connected by beams
|
|
249
|
+
*/
|
|
250
|
+
declare function getBeamGroups(measure: Measure): BeamGroup[];
|
|
251
|
+
/**
|
|
252
|
+
* Find all notes with a specific notation type
|
|
253
|
+
*/
|
|
254
|
+
declare function findNotesWithNotation(score: Score, notationType: NotationType, options?: {
|
|
255
|
+
partIndex?: number;
|
|
256
|
+
}): NoteWithContext[];
|
|
257
|
+
/**
|
|
258
|
+
* Get all harmonies from a score
|
|
259
|
+
*/
|
|
260
|
+
declare function getHarmonies(score: Score, options?: {
|
|
261
|
+
partIndex?: number;
|
|
262
|
+
}): HarmonyWithContext[];
|
|
263
|
+
/**
|
|
264
|
+
* Get harmony at a specific position in a measure
|
|
265
|
+
*/
|
|
266
|
+
declare function getHarmonyAtPosition(measure: Measure, position: number): HarmonyEntry | undefined;
|
|
267
|
+
/**
|
|
268
|
+
* Get chord progression (all harmonies in order)
|
|
269
|
+
* Returns a simplified representation of the chord progression
|
|
270
|
+
*/
|
|
271
|
+
declare function getChordProgression(score: Score, options?: {
|
|
272
|
+
partIndex?: number;
|
|
273
|
+
}): {
|
|
274
|
+
root: string;
|
|
275
|
+
kind: string;
|
|
276
|
+
bass?: string;
|
|
277
|
+
measureIndex: number;
|
|
278
|
+
position: number;
|
|
279
|
+
}[];
|
|
280
|
+
/**
|
|
281
|
+
* Get all lyrics from a score
|
|
282
|
+
*/
|
|
283
|
+
declare function getLyrics(score: Score, options?: {
|
|
284
|
+
partIndex?: number;
|
|
285
|
+
verse?: number;
|
|
286
|
+
}): LyricWithContext[];
|
|
287
|
+
/**
|
|
288
|
+
* Get assembled lyric text for a specific verse
|
|
289
|
+
* Joins syllables with proper hyphenation
|
|
290
|
+
*/
|
|
291
|
+
declare function getLyricText(score: Score, options?: {
|
|
292
|
+
partIndex?: number;
|
|
293
|
+
verse?: number;
|
|
294
|
+
}): AssembledLyrics[];
|
|
295
|
+
/**
|
|
296
|
+
* Get the number of verses in a score
|
|
297
|
+
*/
|
|
298
|
+
declare function getVerseCount(score: Score, options?: {
|
|
299
|
+
partIndex?: number;
|
|
300
|
+
}): number;
|
|
301
|
+
/**
|
|
302
|
+
* Get repeat structure from a score
|
|
303
|
+
* Returns forward and backward repeat markers
|
|
304
|
+
*/
|
|
305
|
+
declare function getRepeatStructure(score: Score, options?: {
|
|
306
|
+
partIndex?: number;
|
|
307
|
+
}): RepeatInfo[];
|
|
308
|
+
/**
|
|
309
|
+
* Find barlines matching criteria
|
|
310
|
+
*/
|
|
311
|
+
declare function findBarlines(score: Score, options?: {
|
|
312
|
+
partIndex?: number;
|
|
313
|
+
style?: string;
|
|
314
|
+
repeat?: boolean;
|
|
315
|
+
}): BarlineWithContext[];
|
|
316
|
+
/**
|
|
317
|
+
* Get all endings (volta brackets) from a score
|
|
318
|
+
*/
|
|
319
|
+
declare function getEndings(score: Score, options?: {
|
|
320
|
+
partIndex?: number;
|
|
321
|
+
}): EndingInfo[];
|
|
322
|
+
/**
|
|
323
|
+
* Get all key signature changes in a score
|
|
324
|
+
*/
|
|
325
|
+
declare function getKeyChanges(score: Score, options?: {
|
|
326
|
+
partIndex?: number;
|
|
327
|
+
}): KeyChangeInfo[];
|
|
328
|
+
/**
|
|
329
|
+
* Get all time signature changes in a score
|
|
330
|
+
*/
|
|
331
|
+
declare function getTimeChanges(score: Score, options?: {
|
|
332
|
+
partIndex?: number;
|
|
333
|
+
}): TimeChangeInfo[];
|
|
334
|
+
/**
|
|
335
|
+
* Get all clef changes in a score
|
|
336
|
+
*/
|
|
337
|
+
declare function getClefChanges(score: Score, options?: {
|
|
338
|
+
partIndex?: number;
|
|
339
|
+
staff?: number;
|
|
340
|
+
}): ClefChangeInfo[];
|
|
341
|
+
/**
|
|
342
|
+
* Get all structural changes in a score (key, time, clef)
|
|
343
|
+
*/
|
|
344
|
+
declare function getStructuralChanges(score: Score, options?: {
|
|
345
|
+
partIndex?: number;
|
|
346
|
+
}): StructuralChanges;
|
|
347
|
+
/**
|
|
348
|
+
* Get a part by index
|
|
349
|
+
*/
|
|
350
|
+
declare function getPartByIndex(score: Score, index: number): Part | undefined;
|
|
351
|
+
/**
|
|
352
|
+
* Get the number of parts in a score
|
|
353
|
+
*/
|
|
354
|
+
declare function getPartCount(score: Score): number;
|
|
355
|
+
/**
|
|
356
|
+
* Get all part IDs from a score
|
|
357
|
+
*/
|
|
358
|
+
declare function getPartIds(score: Score): string[];
|
|
3
359
|
/**
|
|
4
360
|
* Get a specific measure from the score
|
|
5
361
|
*/
|
|
@@ -100,4 +456,4 @@ declare function countNotes(score: Score): number;
|
|
|
100
456
|
*/
|
|
101
457
|
declare function scoresEqual(a: Score, b: Score): boolean;
|
|
102
458
|
|
|
103
|
-
export { type FindNotesFilter, type PitchRange, type RoundtripMetrics, countNotes, findNotes, getAttributesAtMeasure, getDivisions, getDuration, getMeasure, getMeasureByIndex, getMeasureCount, getPartById, getPartIndex, getStaveCount, hasMultipleStaves, measureRoundtrip, scoresEqual };
|
|
459
|
+
export { type FindNotesFilter, type NormalizedPositionOptions, type PitchRange, type RoundtripMetrics, type VoiceFilter, buildVoiceToStaffMap, buildVoiceToStaffMapForPart, countNotes, findBarlines, findDirectionsByType, findNotes, findNotesWithNotation, getAbsolutePosition, getAdjacentNotes, getAllNotes, getAttributesAtMeasure, getBeamGroups, getChordProgression, getChords, getClefChanges, getClefForStaff, getDirections, getDirectionsAtPosition, getDivisions, getDuration, getDynamics, getEffectiveStaff, getEndings, getEntriesAtPosition, getEntriesForStaff, getEntriesInRange, getHarmonies, getHarmonyAtPosition, getKeyChanges, getLyricText, getLyrics, getMeasure, getMeasureByIndex, getMeasureCount, getNextNote, getNormalizedDuration, getNormalizedPosition, getNotesAtPosition, getNotesForStaff, getNotesForVoice, getNotesInRange, getOctaveShifts, getPartById, getPartByIndex, getPartCount, getPartIds, getPartIndex, getPedalMarkings, getPrevNote, getRepeatStructure, getSlurSpans, getStaffRange, getStaveCount, getStaves, getStructuralChanges, getTempoMarkings, getTiedNoteGroups, getTimeChanges, getTupletGroups, getVerseCount, getVerticalSlice, getVoiceLine, getVoiceLineInRange, getVoices, getVoicesForStaff, getWedges, groupByStaff, groupByVoice, hasMultipleStaves, hasNotes, inferStaff, isRestMeasure, iterateEntries, iterateNotes, measureRoundtrip, scoresEqual, withAbsolutePositions };
|