musicxml-io 0.8.0 → 0.8.2

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.
@@ -0,0 +1,171 @@
1
+ import { S as Score, g as Pitch, M as Measure } from './types-B_6pqTfs.mjs';
2
+ export { A as Accidental, i as AccidentalInfo, O as AdjacentNotes, a4 as AssembledLyrics, B as BackupEntry, p as Barline, a5 as BarlineWithContext, a0 as BeamGroup, j as BeamInfo, s as Chord, C as Clef, aa as ClefChangeInfo, w as Credit, v as Defaults, D as DirectionEntry, Q as DirectionKind, l as DirectionType, z as DirectionWithContext, R as DynamicWithContext, m as DynamicsValue, a7 as EndingInfo, E as EntryWithContext, F as ForwardEntry, a2 as HarmonyWithContext, a8 as KeyChangeInfo, K as KeySignature, L as Lyric, a3 as LyricWithContext, e as MeasureAttributes, f as MeasureEntry, k as Notation, a1 as NotationType, N as NoteEntry, t as NoteIteratorItem, h as NoteType, y as NoteWithContext, r as NoteWithPosition, Y as OctaveShiftWithContext, d as Part, b as PartGroup, P as PartInfo, c as PartListEntry, W as PedalWithContext, H as PositionQueryOptions, u as Print, a6 as RepeatInfo, a as ScoreMetadata, _ as SlurSpan, q as StaffGroup, G as StaffRange, ab as StructuralChanges, U as TempoWithContext, T as TieInfo, Z as TiedNoteGroup, a9 as TimeChangeInfo, n as TimeSignature, o as Transpose, $ as TupletGroup, I as VerticalSlice, V as VoiceGroup, J as VoiceLine, x as VoiceToStaffMap, X as WedgeWithContext } from './types-B_6pqTfs.mjs';
3
+ import { cK as ValidateOptions, cG as ValidationResult } from './index-BGUfI7Li.mjs';
4
+ export { b8 as AddArticulationOptions, bh as AddBeamOptions, c6 as AddBowingOptions, cf as AddBreathMarkOptions, ci as AddCaesuraOptions, aU as AddChordOptions, c0 as AddChordSymbolOptions, bQ as AddCodaOptions, ba as AddDynamicsOptions, bK as AddEndingOptions, bx as AddFermataOptions, c3 as AddFingeringOptions, bS as AddGraceNoteOptions, bZ as AddHarmonyOptions, bV as AddLyricOptions, bR as AddNavigationOptions, cb as AddOctaveShiftOptions, bz as AddOrnamentOptions, b0 as AddPartOptions, bB as AddPedalOptions, bF as AddRehearsalMarkOptions, bG as AddRepeatBarlineOptions, bI as AddRepeatOptions, bP as AddSegnoOptions, b6 as AddSlurOptions, c8 as AddStringNumberOptions, bs as AddTempoOptions, bD as AddTextDirectionOptions, bE as AddTextOptions, b4 as AddTieOptions, a$ as AddVoiceOptions, bv as AddWedgeOptions, bj as AutoBeamOptions, bO as BarStyle, c5 as BowingType, ce as BreathMarkValue, ch as CaesuraValue, bM as ChangeBarlineOptions, be as ChangeClefOptions, aV as ChangeNoteDurationOptions, bU as ConvertToGraceOptions, bp as CopyNotesMultiMeasureOptions, bm as CopyNotesOptions, bf as CreateTupletOptions, bo as CutNotesOptions, b1 as DuplicatePartOptions, bY as HarmonyKind, bd as InsertClefChangeOptions, aS as InsertNoteOptions, cM as LocalValidateOptions, a_ as LowerAccidentalOptions, cL as MeasureValidationContext, bc as ModifyDynamicsOptions, bu as ModifyTempoOptions, b3 as MoveNoteToStaffOptions, bq as MultiMeasureSelection, bl as NoteSelection, ca as OctaveShiftType, aR as OperationErrorCode, aQ as OperationResult, br as PasteNotesMultiMeasureOptions, bn as PasteNotesOptions, aZ as RaiseAccidentalOptions, b9 as RemoveArticulationOptions, bi as RemoveBeamOptions, c7 as RemoveBowingOptions, cg as RemoveBreathMarkOptions, cj as RemoveCaesuraOptions, c1 as RemoveChordSymbolOptions, bb as RemoveDynamicsOptions, bL as RemoveEndingOptions, by as RemoveFermataOptions, c4 as RemoveFingeringOptions, bT as RemoveGraceNoteOptions, b_ as RemoveHarmonyOptions, bW as RemoveLyricOptions, aT as RemoveNoteOptions, cd as RemoveOctaveShiftOptions, bA as RemoveOrnamentOptions, bC as RemovePedalOptions, bH as RemoveRepeatBarlineOptions, bJ as RemoveRepeatOptions, b7 as RemoveSlurOptions, c9 as RemoveStringNumberOptions, bt as RemoveTempoOptions, b5 as RemoveTieOptions, bg as RemoveTupletOptions, bw as RemoveWedgeOptions, bN as SetBarlineOptions, bk as SetBeamingOptions, aX as SetNotePitchBySemitoneOptions, aW as SetNotePitchOptions, b2 as SetStavesOptions, aY as ShiftNotePitchOptions, cc as StopOctaveShiftOptions, c2 as UpdateChordSymbolOptions, b$ as UpdateHarmonyOptions, bX as UpdateLyricOptions, cF as ValidationError, cI as ValidationErrorCode, cB as ValidationException, cJ as ValidationLevel, cH as ValidationLocation, J as addArticulation, S as addBeam, aF as addBowing, aM as addBreathMark, aO as addCaesura, a as addChord, h as addChordNote, o as addChordNoteChecked, aA as addChordSymbol, am as addCoda, an as addDaCapo, ao as addDalSegno, L as addDynamics, ah as addEnding, a4 as addFermata, ap as addFine, aD as addFingering, ar as addGraceNote, ax as addHarmony, au as addLyric, f as addNote, k as addNoteChecked, aJ as addOctaveShift, a6 as addOrnament, w as addPart, a8 as addPedal, ac as addRehearsalMark, af as addRepeat, ad as addRepeatBarline, al as addSegno, H as addSlur, aH as addStringNumber, $ as addTempo, ab as addText, aa as addTextDirection, F as addTie, aq as addToCoda, v as addVoice, a2 as addWedge, cE as assertMeasureValid, cm as assertValid, U as autoBeam, aj as changeBarline, P as changeClef, B as changeKey, d as changeNoteDuration, C as changeTime, at as convertToGrace, W as copyNotes, Z as copyNotesMultiMeasure, Q as createTuplet, Y as cutNotes, E as deleteMeasure, g as deleteNote, n as deleteNoteChecked, y as duplicatePart, cA as formatLocation, cD as getMeasureContext, O as insertClefChange, D as insertMeasure, i as insertNote, cl as isValid, l as lowerAccidental, N as modifyDynamics, j as modifyNoteDuration, q as modifyNoteDurationChecked, m as modifyNotePitch, p as modifyNotePitchChecked, a1 as modifyTempo, A as moveNoteToStaff, X as pasteNotes, _ as pasteNotesMultiMeasure, e as raiseAccidental, K as removeArticulation, T as removeBeam, aG as removeBowing, aN as removeBreathMark, aP as removeCaesura, aB as removeChordSymbol, M as removeDynamics, ai as removeEnding, a5 as removeFermata, aE as removeFingering, as as removeGraceNote, ay as removeHarmony, av as removeLyric, r as removeNote, aL as removeOctaveShift, a7 as removeOrnament, x as removePart, a9 as removePedal, ag as removeRepeat, ae as removeRepeatBarline, I as removeSlur, aI as removeStringNumber, a0 as removeTempo, G as removeTie, R as removeTuplet, a3 as removeWedge, ak as setBarline, V as setBeaming, s as setNotePitch, b as setNotePitchBySemitone, z as setStaves, c as shiftNotePitch, aK as stopOctaveShift, t as transpose, u as transposeChecked, aC as updateChordSymbol, az as updateHarmony, aw as updateLyric, ck as validate, cp as validateBackupForward, cr as validateBeams, cn as validateDivisions, co as validateMeasureDuration, cC as validateMeasureLocal, cu as validatePartReferences, cv as validatePartStructure, cs as validateSlurs, cz as validateSlursAcrossMeasures, cw as validateStaffStructure, cq as validateTies, cy as validateTiesAcrossMeasures, ct as validateTuplets, cx as validateVoiceStaff } from './index-BGUfI7Li.mjs';
5
+ import { ExpressionOptions, TimingSidecar } from './query/index.mjs';
6
+ export { ExpressionHint, ExpressionKind, FindNotesFilter, NormalizedPositionOptions, PitchRange, PlaybackControls, PlaybackMeasure, RoundtripMetrics, TimingBreakpoint, TimingMapOptions, VoiceFilter, buildVoiceToStaffMap, buildVoiceToStaffMapForPart, countNotes, extractPlaybackControls, findBarlines, findDirectionsByType, findNotes, findNotesWithNotation, generatePlaybackSequence, generatePlaybackTimeline, 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, hasPlaybackControls, inferStaff, isRestMeasure, iterateEntries, iterateNotes, measureRoundtrip, scoresEqual, withAbsolutePositions } from './query/index.mjs';
7
+ export { DirectionTypeOfKind, getAllPartInfos, getDirectionOfKind, getDirectionsOfKind, getPartAbbreviation, getPartInfo, getPartName, getPartNameMap, getSoundDamperPedal, getSoundDynamics, getSoundSoftPedal, getSoundSostenutoPedal, getSoundTempo, hasBeam, hasDirectionOfKind, hasLyrics, hasNotations, hasTie, hasTieStart, hasTieStop, hasTuplet, isChordNote, isCueNote, isGraceNote, isPartInfo, isPitchedNote, isRest, isUnpitchedNote } from './accessors/index.mjs';
8
+
9
+ declare function parse(input: string | Uint8Array): Score;
10
+
11
+ /**
12
+ * Parse a compressed MusicXML (.mxl) file
13
+ * @param data - The compressed file data as Uint8Array or Buffer
14
+ * @returns The parsed Score
15
+ */
16
+ declare function parseCompressed(data: Uint8Array): Score;
17
+ /**
18
+ * Check if data is a compressed MusicXML file
19
+ * @param data - The file data
20
+ * @returns true if the data appears to be a ZIP file
21
+ */
22
+ declare function isCompressed(data: Uint8Array): boolean;
23
+ /**
24
+ * Parse either compressed (.mxl) or uncompressed (.xml/.musicxml) MusicXML
25
+ * Automatically detects the format
26
+ * @param data - The file data as Uint8Array or string
27
+ * @returns The parsed Score
28
+ */
29
+ declare function parseAuto(data: Uint8Array | string): Score;
30
+
31
+ /**
32
+ * ABC Notation Parser
33
+ * Parses ABC notation format into the Score internal model.
34
+ *
35
+ * Supports ABC standard v2.1 core features:
36
+ * - Header fields (X, T, C, M, L, Q, K, V, w)
37
+ * - Notes with pitch, duration, accidentals, octave modifiers
38
+ * - Rests (z, Z)
39
+ * - Bar lines (|, ||, |], [|, |:, :|, ::)
40
+ * - Repeats and volta endings ([1, [2)
41
+ * - Chords (simultaneous notes: [CEG])
42
+ * - Chord symbols ("Am", "G7", etc.)
43
+ * - Ties (-) and slurs ((...))
44
+ * - Grace notes ({...})
45
+ * - Tuplets ((3..., (p:q:r...)
46
+ * - Dynamics (!p!, !f!, etc.)
47
+ * - Lyrics (w: field)
48
+ * - Multi-voice (V: field)
49
+ */
50
+
51
+ /**
52
+ * Parse an ABC notation string into a Score object.
53
+ */
54
+ declare function parseAbc(abcString: string): Score;
55
+
56
+ interface SerializeOptions {
57
+ version?: string;
58
+ indent?: string;
59
+ /** Validate score before serializing (default: false) */
60
+ validate?: boolean;
61
+ /** Options for validation (if validate is true) */
62
+ validateOptions?: ValidateOptions;
63
+ /** Throw error if validation fails (default: false, will only warn) */
64
+ throwOnValidationError?: boolean;
65
+ /** Callback to receive validation result */
66
+ onValidation?: (result: ValidationResult) => void;
67
+ }
68
+ declare function serialize(score: Score, options?: SerializeOptions): string;
69
+
70
+ /**
71
+ * Serialize a Score to compressed MusicXML (.mxl) format
72
+ * @param score - The Score to serialize
73
+ * @param options - Serialization options
74
+ * @returns The compressed file data as Uint8Array
75
+ */
76
+ declare function serializeCompressed(score: Score, options?: SerializeOptions): Uint8Array;
77
+
78
+ /**
79
+ * MIDI export options
80
+ *
81
+ * Extends {@link ExpressionOptions} so fermata holds and rit./accel. ramps land
82
+ * in the exported tempo map (and the timing sidecar) identically.
83
+ */
84
+ interface MidiExportOptions extends ExpressionOptions {
85
+ /** Ticks per quarter note (default: 480) */
86
+ ticksPerQuarterNote?: number;
87
+ /** Default tempo in BPM (default: 120) */
88
+ defaultTempo?: number;
89
+ /** Default velocity for notes when no dynamics are present (default: 80) */
90
+ defaultVelocity?: number;
91
+ }
92
+ /**
93
+ * A single point on the timing sidecar: a correspondence between a time in the
94
+ * generated MIDI and a conceptual musical position (measure + beat).
95
+ *
96
+ * Breakpoints are emitted at every played-measure start and every tempo change
97
+ * (plus a terminal point). Between two consecutive breakpoints the relationship
98
+ * `midiSec ↔ quarterPos` is linear (tempo is piecewise-constant), so a consumer
99
+ * can interpolate any intermediate time exactly.
100
+ */
101
+ /** Result of {@link exportMidiWithTimingMap}. */
102
+ interface MidiWithTimingMap {
103
+ /** The Standard MIDI File data. */
104
+ midi: Uint8Array;
105
+ /** The MIDI-time ↔ musical-position sidecar. */
106
+ sidecar: TimingSidecar;
107
+ }
108
+ /**
109
+ * Export a Score to Standard MIDI File format (SMF Type 1)
110
+ * @param score - The Score to export
111
+ * @param options - Export options
112
+ * @returns The MIDI file data as Uint8Array
113
+ */
114
+ declare function exportMidi(score: Score, options?: MidiExportOptions): Uint8Array;
115
+ /**
116
+ * Export a Score to MIDI together with a timing sidecar that maps the generated
117
+ * MIDI timeline to conceptual musical positions (measure + beat).
118
+ *
119
+ * The MIDI bytes are byte-for-byte identical to {@link exportMidi}; the sidecar
120
+ * is derived from the same internal time computation so the two can never drift.
121
+ *
122
+ * @param score - The Score to export
123
+ * @param options - Export options (must match those used for any aligned audio)
124
+ * @returns The MIDI data and its timing sidecar
125
+ */
126
+ declare function exportMidiWithTimingMap(score: Score, options?: MidiExportOptions): MidiWithTimingMap;
127
+
128
+ /**
129
+ * ABC Notation Serializer
130
+ * Converts Score internal model to ABC notation format string.
131
+ */
132
+
133
+ interface AbcSerializeOptions {
134
+ /** Reference number (X: field). Default: 1 */
135
+ referenceNumber?: number;
136
+ /** Maximum notes per line before wrapping. Default: no limit */
137
+ notesPerLine?: number;
138
+ /** Include chord symbols. Default: true */
139
+ includeChordSymbols?: boolean;
140
+ /** Include dynamics. Default: true */
141
+ includeDynamics?: boolean;
142
+ /** Include lyrics. Default: true */
143
+ includeLyrics?: boolean;
144
+ }
145
+ /**
146
+ * Serialize a Score object to ABC notation format string.
147
+ */
148
+ declare function serializeAbc(score: Score, options?: AbcSerializeOptions): string;
149
+
150
+ declare const STEPS: Pitch['step'][];
151
+ declare const STEP_SEMITONES: Record<Pitch['step'], number>;
152
+ /** Convert pitch to semitone value (MIDI-like) */
153
+ declare function pitchToSemitone(pitch: Pitch): number;
154
+ /** Get position at end of measure */
155
+ declare function getMeasureEndPosition(measure: Measure): number;
156
+
157
+ /**
158
+ * Generates a unique ID for elements in the Score structure.
159
+ *
160
+ * The ID format is "i" + 10 random URL-safe characters, where:
161
+ * - "i" prefix ensures XML ID compatibility (XML IDs must start with a letter or underscore)
162
+ * - the 10-character suffix is drawn from the same 64-character URL-safe
163
+ * alphabet as nanoid, backed by `crypto.getRandomValues`
164
+ *
165
+ * Example: "iV1StGXR8_"
166
+ *
167
+ * @returns A unique 11-character ID string
168
+ */
169
+ declare function generateId(): string;
170
+
171
+ export { type AbcSerializeOptions, ExpressionOptions, Measure, type MidiExportOptions, type MidiWithTimingMap, Pitch, STEPS, STEP_SEMITONES, Score, type SerializeOptions, TimingSidecar, ValidateOptions, ValidationResult, exportMidi, exportMidiWithTimingMap, generateId, getMeasureEndPosition, isCompressed, parse, parseAbc, parseAuto, parseCompressed, pitchToSemitone, serialize, serializeAbc, serializeCompressed };
@@ -0,0 +1,171 @@
1
+ import { S as Score, g as Pitch, M as Measure } from './types-B_6pqTfs.js';
2
+ export { A as Accidental, i as AccidentalInfo, O as AdjacentNotes, a4 as AssembledLyrics, B as BackupEntry, p as Barline, a5 as BarlineWithContext, a0 as BeamGroup, j as BeamInfo, s as Chord, C as Clef, aa as ClefChangeInfo, w as Credit, v as Defaults, D as DirectionEntry, Q as DirectionKind, l as DirectionType, z as DirectionWithContext, R as DynamicWithContext, m as DynamicsValue, a7 as EndingInfo, E as EntryWithContext, F as ForwardEntry, a2 as HarmonyWithContext, a8 as KeyChangeInfo, K as KeySignature, L as Lyric, a3 as LyricWithContext, e as MeasureAttributes, f as MeasureEntry, k as Notation, a1 as NotationType, N as NoteEntry, t as NoteIteratorItem, h as NoteType, y as NoteWithContext, r as NoteWithPosition, Y as OctaveShiftWithContext, d as Part, b as PartGroup, P as PartInfo, c as PartListEntry, W as PedalWithContext, H as PositionQueryOptions, u as Print, a6 as RepeatInfo, a as ScoreMetadata, _ as SlurSpan, q as StaffGroup, G as StaffRange, ab as StructuralChanges, U as TempoWithContext, T as TieInfo, Z as TiedNoteGroup, a9 as TimeChangeInfo, n as TimeSignature, o as Transpose, $ as TupletGroup, I as VerticalSlice, V as VoiceGroup, J as VoiceLine, x as VoiceToStaffMap, X as WedgeWithContext } from './types-B_6pqTfs.js';
3
+ import { cK as ValidateOptions, cG as ValidationResult } from './index-se1B-IZl.js';
4
+ export { b8 as AddArticulationOptions, bh as AddBeamOptions, c6 as AddBowingOptions, cf as AddBreathMarkOptions, ci as AddCaesuraOptions, aU as AddChordOptions, c0 as AddChordSymbolOptions, bQ as AddCodaOptions, ba as AddDynamicsOptions, bK as AddEndingOptions, bx as AddFermataOptions, c3 as AddFingeringOptions, bS as AddGraceNoteOptions, bZ as AddHarmonyOptions, bV as AddLyricOptions, bR as AddNavigationOptions, cb as AddOctaveShiftOptions, bz as AddOrnamentOptions, b0 as AddPartOptions, bB as AddPedalOptions, bF as AddRehearsalMarkOptions, bG as AddRepeatBarlineOptions, bI as AddRepeatOptions, bP as AddSegnoOptions, b6 as AddSlurOptions, c8 as AddStringNumberOptions, bs as AddTempoOptions, bD as AddTextDirectionOptions, bE as AddTextOptions, b4 as AddTieOptions, a$ as AddVoiceOptions, bv as AddWedgeOptions, bj as AutoBeamOptions, bO as BarStyle, c5 as BowingType, ce as BreathMarkValue, ch as CaesuraValue, bM as ChangeBarlineOptions, be as ChangeClefOptions, aV as ChangeNoteDurationOptions, bU as ConvertToGraceOptions, bp as CopyNotesMultiMeasureOptions, bm as CopyNotesOptions, bf as CreateTupletOptions, bo as CutNotesOptions, b1 as DuplicatePartOptions, bY as HarmonyKind, bd as InsertClefChangeOptions, aS as InsertNoteOptions, cM as LocalValidateOptions, a_ as LowerAccidentalOptions, cL as MeasureValidationContext, bc as ModifyDynamicsOptions, bu as ModifyTempoOptions, b3 as MoveNoteToStaffOptions, bq as MultiMeasureSelection, bl as NoteSelection, ca as OctaveShiftType, aR as OperationErrorCode, aQ as OperationResult, br as PasteNotesMultiMeasureOptions, bn as PasteNotesOptions, aZ as RaiseAccidentalOptions, b9 as RemoveArticulationOptions, bi as RemoveBeamOptions, c7 as RemoveBowingOptions, cg as RemoveBreathMarkOptions, cj as RemoveCaesuraOptions, c1 as RemoveChordSymbolOptions, bb as RemoveDynamicsOptions, bL as RemoveEndingOptions, by as RemoveFermataOptions, c4 as RemoveFingeringOptions, bT as RemoveGraceNoteOptions, b_ as RemoveHarmonyOptions, bW as RemoveLyricOptions, aT as RemoveNoteOptions, cd as RemoveOctaveShiftOptions, bA as RemoveOrnamentOptions, bC as RemovePedalOptions, bH as RemoveRepeatBarlineOptions, bJ as RemoveRepeatOptions, b7 as RemoveSlurOptions, c9 as RemoveStringNumberOptions, bt as RemoveTempoOptions, b5 as RemoveTieOptions, bg as RemoveTupletOptions, bw as RemoveWedgeOptions, bN as SetBarlineOptions, bk as SetBeamingOptions, aX as SetNotePitchBySemitoneOptions, aW as SetNotePitchOptions, b2 as SetStavesOptions, aY as ShiftNotePitchOptions, cc as StopOctaveShiftOptions, c2 as UpdateChordSymbolOptions, b$ as UpdateHarmonyOptions, bX as UpdateLyricOptions, cF as ValidationError, cI as ValidationErrorCode, cB as ValidationException, cJ as ValidationLevel, cH as ValidationLocation, J as addArticulation, S as addBeam, aF as addBowing, aM as addBreathMark, aO as addCaesura, a as addChord, h as addChordNote, o as addChordNoteChecked, aA as addChordSymbol, am as addCoda, an as addDaCapo, ao as addDalSegno, L as addDynamics, ah as addEnding, a4 as addFermata, ap as addFine, aD as addFingering, ar as addGraceNote, ax as addHarmony, au as addLyric, f as addNote, k as addNoteChecked, aJ as addOctaveShift, a6 as addOrnament, w as addPart, a8 as addPedal, ac as addRehearsalMark, af as addRepeat, ad as addRepeatBarline, al as addSegno, H as addSlur, aH as addStringNumber, $ as addTempo, ab as addText, aa as addTextDirection, F as addTie, aq as addToCoda, v as addVoice, a2 as addWedge, cE as assertMeasureValid, cm as assertValid, U as autoBeam, aj as changeBarline, P as changeClef, B as changeKey, d as changeNoteDuration, C as changeTime, at as convertToGrace, W as copyNotes, Z as copyNotesMultiMeasure, Q as createTuplet, Y as cutNotes, E as deleteMeasure, g as deleteNote, n as deleteNoteChecked, y as duplicatePart, cA as formatLocation, cD as getMeasureContext, O as insertClefChange, D as insertMeasure, i as insertNote, cl as isValid, l as lowerAccidental, N as modifyDynamics, j as modifyNoteDuration, q as modifyNoteDurationChecked, m as modifyNotePitch, p as modifyNotePitchChecked, a1 as modifyTempo, A as moveNoteToStaff, X as pasteNotes, _ as pasteNotesMultiMeasure, e as raiseAccidental, K as removeArticulation, T as removeBeam, aG as removeBowing, aN as removeBreathMark, aP as removeCaesura, aB as removeChordSymbol, M as removeDynamics, ai as removeEnding, a5 as removeFermata, aE as removeFingering, as as removeGraceNote, ay as removeHarmony, av as removeLyric, r as removeNote, aL as removeOctaveShift, a7 as removeOrnament, x as removePart, a9 as removePedal, ag as removeRepeat, ae as removeRepeatBarline, I as removeSlur, aI as removeStringNumber, a0 as removeTempo, G as removeTie, R as removeTuplet, a3 as removeWedge, ak as setBarline, V as setBeaming, s as setNotePitch, b as setNotePitchBySemitone, z as setStaves, c as shiftNotePitch, aK as stopOctaveShift, t as transpose, u as transposeChecked, aC as updateChordSymbol, az as updateHarmony, aw as updateLyric, ck as validate, cp as validateBackupForward, cr as validateBeams, cn as validateDivisions, co as validateMeasureDuration, cC as validateMeasureLocal, cu as validatePartReferences, cv as validatePartStructure, cs as validateSlurs, cz as validateSlursAcrossMeasures, cw as validateStaffStructure, cq as validateTies, cy as validateTiesAcrossMeasures, ct as validateTuplets, cx as validateVoiceStaff } from './index-se1B-IZl.js';
5
+ import { ExpressionOptions, TimingSidecar } from './query/index.js';
6
+ export { ExpressionHint, ExpressionKind, FindNotesFilter, NormalizedPositionOptions, PitchRange, PlaybackControls, PlaybackMeasure, RoundtripMetrics, TimingBreakpoint, TimingMapOptions, VoiceFilter, buildVoiceToStaffMap, buildVoiceToStaffMapForPart, countNotes, extractPlaybackControls, findBarlines, findDirectionsByType, findNotes, findNotesWithNotation, generatePlaybackSequence, generatePlaybackTimeline, 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, hasPlaybackControls, inferStaff, isRestMeasure, iterateEntries, iterateNotes, measureRoundtrip, scoresEqual, withAbsolutePositions } from './query/index.js';
7
+ export { DirectionTypeOfKind, getAllPartInfos, getDirectionOfKind, getDirectionsOfKind, getPartAbbreviation, getPartInfo, getPartName, getPartNameMap, getSoundDamperPedal, getSoundDynamics, getSoundSoftPedal, getSoundSostenutoPedal, getSoundTempo, hasBeam, hasDirectionOfKind, hasLyrics, hasNotations, hasTie, hasTieStart, hasTieStop, hasTuplet, isChordNote, isCueNote, isGraceNote, isPartInfo, isPitchedNote, isRest, isUnpitchedNote } from './accessors/index.js';
8
+
9
+ declare function parse(input: string | Uint8Array): Score;
10
+
11
+ /**
12
+ * Parse a compressed MusicXML (.mxl) file
13
+ * @param data - The compressed file data as Uint8Array or Buffer
14
+ * @returns The parsed Score
15
+ */
16
+ declare function parseCompressed(data: Uint8Array): Score;
17
+ /**
18
+ * Check if data is a compressed MusicXML file
19
+ * @param data - The file data
20
+ * @returns true if the data appears to be a ZIP file
21
+ */
22
+ declare function isCompressed(data: Uint8Array): boolean;
23
+ /**
24
+ * Parse either compressed (.mxl) or uncompressed (.xml/.musicxml) MusicXML
25
+ * Automatically detects the format
26
+ * @param data - The file data as Uint8Array or string
27
+ * @returns The parsed Score
28
+ */
29
+ declare function parseAuto(data: Uint8Array | string): Score;
30
+
31
+ /**
32
+ * ABC Notation Parser
33
+ * Parses ABC notation format into the Score internal model.
34
+ *
35
+ * Supports ABC standard v2.1 core features:
36
+ * - Header fields (X, T, C, M, L, Q, K, V, w)
37
+ * - Notes with pitch, duration, accidentals, octave modifiers
38
+ * - Rests (z, Z)
39
+ * - Bar lines (|, ||, |], [|, |:, :|, ::)
40
+ * - Repeats and volta endings ([1, [2)
41
+ * - Chords (simultaneous notes: [CEG])
42
+ * - Chord symbols ("Am", "G7", etc.)
43
+ * - Ties (-) and slurs ((...))
44
+ * - Grace notes ({...})
45
+ * - Tuplets ((3..., (p:q:r...)
46
+ * - Dynamics (!p!, !f!, etc.)
47
+ * - Lyrics (w: field)
48
+ * - Multi-voice (V: field)
49
+ */
50
+
51
+ /**
52
+ * Parse an ABC notation string into a Score object.
53
+ */
54
+ declare function parseAbc(abcString: string): Score;
55
+
56
+ interface SerializeOptions {
57
+ version?: string;
58
+ indent?: string;
59
+ /** Validate score before serializing (default: false) */
60
+ validate?: boolean;
61
+ /** Options for validation (if validate is true) */
62
+ validateOptions?: ValidateOptions;
63
+ /** Throw error if validation fails (default: false, will only warn) */
64
+ throwOnValidationError?: boolean;
65
+ /** Callback to receive validation result */
66
+ onValidation?: (result: ValidationResult) => void;
67
+ }
68
+ declare function serialize(score: Score, options?: SerializeOptions): string;
69
+
70
+ /**
71
+ * Serialize a Score to compressed MusicXML (.mxl) format
72
+ * @param score - The Score to serialize
73
+ * @param options - Serialization options
74
+ * @returns The compressed file data as Uint8Array
75
+ */
76
+ declare function serializeCompressed(score: Score, options?: SerializeOptions): Uint8Array;
77
+
78
+ /**
79
+ * MIDI export options
80
+ *
81
+ * Extends {@link ExpressionOptions} so fermata holds and rit./accel. ramps land
82
+ * in the exported tempo map (and the timing sidecar) identically.
83
+ */
84
+ interface MidiExportOptions extends ExpressionOptions {
85
+ /** Ticks per quarter note (default: 480) */
86
+ ticksPerQuarterNote?: number;
87
+ /** Default tempo in BPM (default: 120) */
88
+ defaultTempo?: number;
89
+ /** Default velocity for notes when no dynamics are present (default: 80) */
90
+ defaultVelocity?: number;
91
+ }
92
+ /**
93
+ * A single point on the timing sidecar: a correspondence between a time in the
94
+ * generated MIDI and a conceptual musical position (measure + beat).
95
+ *
96
+ * Breakpoints are emitted at every played-measure start and every tempo change
97
+ * (plus a terminal point). Between two consecutive breakpoints the relationship
98
+ * `midiSec ↔ quarterPos` is linear (tempo is piecewise-constant), so a consumer
99
+ * can interpolate any intermediate time exactly.
100
+ */
101
+ /** Result of {@link exportMidiWithTimingMap}. */
102
+ interface MidiWithTimingMap {
103
+ /** The Standard MIDI File data. */
104
+ midi: Uint8Array;
105
+ /** The MIDI-time ↔ musical-position sidecar. */
106
+ sidecar: TimingSidecar;
107
+ }
108
+ /**
109
+ * Export a Score to Standard MIDI File format (SMF Type 1)
110
+ * @param score - The Score to export
111
+ * @param options - Export options
112
+ * @returns The MIDI file data as Uint8Array
113
+ */
114
+ declare function exportMidi(score: Score, options?: MidiExportOptions): Uint8Array;
115
+ /**
116
+ * Export a Score to MIDI together with a timing sidecar that maps the generated
117
+ * MIDI timeline to conceptual musical positions (measure + beat).
118
+ *
119
+ * The MIDI bytes are byte-for-byte identical to {@link exportMidi}; the sidecar
120
+ * is derived from the same internal time computation so the two can never drift.
121
+ *
122
+ * @param score - The Score to export
123
+ * @param options - Export options (must match those used for any aligned audio)
124
+ * @returns The MIDI data and its timing sidecar
125
+ */
126
+ declare function exportMidiWithTimingMap(score: Score, options?: MidiExportOptions): MidiWithTimingMap;
127
+
128
+ /**
129
+ * ABC Notation Serializer
130
+ * Converts Score internal model to ABC notation format string.
131
+ */
132
+
133
+ interface AbcSerializeOptions {
134
+ /** Reference number (X: field). Default: 1 */
135
+ referenceNumber?: number;
136
+ /** Maximum notes per line before wrapping. Default: no limit */
137
+ notesPerLine?: number;
138
+ /** Include chord symbols. Default: true */
139
+ includeChordSymbols?: boolean;
140
+ /** Include dynamics. Default: true */
141
+ includeDynamics?: boolean;
142
+ /** Include lyrics. Default: true */
143
+ includeLyrics?: boolean;
144
+ }
145
+ /**
146
+ * Serialize a Score object to ABC notation format string.
147
+ */
148
+ declare function serializeAbc(score: Score, options?: AbcSerializeOptions): string;
149
+
150
+ declare const STEPS: Pitch['step'][];
151
+ declare const STEP_SEMITONES: Record<Pitch['step'], number>;
152
+ /** Convert pitch to semitone value (MIDI-like) */
153
+ declare function pitchToSemitone(pitch: Pitch): number;
154
+ /** Get position at end of measure */
155
+ declare function getMeasureEndPosition(measure: Measure): number;
156
+
157
+ /**
158
+ * Generates a unique ID for elements in the Score structure.
159
+ *
160
+ * The ID format is "i" + 10 random URL-safe characters, where:
161
+ * - "i" prefix ensures XML ID compatibility (XML IDs must start with a letter or underscore)
162
+ * - the 10-character suffix is drawn from the same 64-character URL-safe
163
+ * alphabet as nanoid, backed by `crypto.getRandomValues`
164
+ *
165
+ * Example: "iV1StGXR8_"
166
+ *
167
+ * @returns A unique 11-character ID string
168
+ */
169
+ declare function generateId(): string;
170
+
171
+ export { type AbcSerializeOptions, ExpressionOptions, Measure, type MidiExportOptions, type MidiWithTimingMap, Pitch, STEPS, STEP_SEMITONES, Score, type SerializeOptions, TimingSidecar, ValidateOptions, ValidationResult, exportMidi, exportMidiWithTimingMap, generateId, getMeasureEndPosition, isCompressed, parse, parseAbc, parseAuto, parseCompressed, pitchToSemitone, serialize, serializeAbc, serializeCompressed };