import { S as Score, M as Measure, n as TimeSignature, f as Part, P as Pitch, N as NoteEntry, K as KeySignature, C as Clef, ac as ArticulationType, m as DynamicsValue, ad as OrnamentType, i as NoteType } from './types-CkeI8vw6.js'; type ValidationErrorCode = 'MISSING_DIVISIONS' | 'INVALID_DIVISIONS' | 'MEASURE_DURATION_MISMATCH' | 'MEASURE_DURATION_OVERFLOW' | 'MEASURE_DURATION_UNDERFLOW' | 'VOICE_INCOMPLETE' | 'VOICE_GAP' | 'NEGATIVE_POSITION' | 'BACKUP_EXCEEDS_POSITION' | 'TIE_START_WITHOUT_STOP' | 'TIE_STOP_WITHOUT_START' | 'TIE_PITCH_MISMATCH' | 'BEAM_BEGIN_WITHOUT_END' | 'BEAM_END_WITHOUT_BEGIN' | 'SLUR_START_WITHOUT_STOP' | 'SLUR_STOP_WITHOUT_START' | 'TUPLET_START_WITHOUT_STOP' | 'TUPLET_STOP_WITHOUT_START' | 'PART_ID_NOT_IN_PART_LIST' | 'PART_LIST_ID_NOT_IN_PARTS' | 'PART_MEASURE_COUNT_MISMATCH' | 'PART_MEASURE_NUMBER_MISMATCH' | 'PART_GROUP_START_WITHOUT_STOP' | 'PART_GROUP_STOP_WITHOUT_START' | 'DUPLICATE_PART_ID' | 'INVALID_VOICE_NUMBER' | 'INVALID_STAFF_NUMBER' | 'STAFF_EXCEEDS_STAVES' | 'MISSING_STAVES_DECLARATION' | 'STAVES_DECLARATION_MISMATCH' | 'MISSING_CLEF_FOR_STAFF' | 'CLEF_STAFF_EXCEEDS_STAVES' | 'INVALID_DURATION' | 'EMPTY_MEASURE'; type ValidationLevel = 'error' | 'warning' | 'info'; interface ValidationLocation { partIndex?: number; partId?: string; measureIndex?: number; measureNumber?: string; entryIndex?: number; voice?: string; staff?: number; } interface ValidationError { code: ValidationErrorCode; level: ValidationLevel; message: string; location: ValidationLocation; details?: Record; } interface ValidationResult { valid: boolean; errors: ValidationError[]; warnings: ValidationError[]; infos: ValidationError[]; } interface ValidateOptions { /** Check divisions consistency (default: true) */ checkDivisions?: boolean; /** Check measure durations match time signature (default: true) */ checkMeasureDuration?: boolean; /** Check that each voice fills the entire measure (Piano Roll semantics) (default: false) */ checkMeasureFullness?: boolean; /** Check backup/forward position consistency (default: true) */ checkPosition?: boolean; /** Check tie start/stop pairing (default: true) */ checkTies?: boolean; /** Check beam begin/end pairing (default: true) */ checkBeams?: boolean; /** Check slur start/stop pairing (default: true) */ checkSlurs?: boolean; /** Check tuplet start/stop pairing (default: true) */ checkTuplets?: boolean; /** Check part ID references (default: true) */ checkPartReferences?: boolean; /** Check part structure (measure count, numbers) (default: true) */ checkPartStructure?: boolean; /** Check voice/staff numbers (default: true) */ checkVoiceStaff?: boolean; /** Check staff structure (staves declaration, clefs) (default: true) */ checkStaffStructure?: boolean; /** Tolerance for measure duration (in divisions, default: 0) */ durationTolerance?: number; } /** * Validate a Score for internal consistency */ declare function validate(score: Score, options?: ValidateOptions): ValidationResult; /** * Validate that divisions are defined and consistent */ declare function validateDivisions(score: Score): ValidationError[]; /** * Validate measure duration matches time signature */ declare function validateMeasureDuration(measure: Measure, divisions: number, time: TimeSignature, location: ValidationLocation, tolerance?: number): ValidationError[]; /** * Validate backup/forward position consistency */ declare function validateBackupForward(measure: Measure, location: ValidationLocation): ValidationError[]; /** * Validate tie start/stop pairing */ declare function validateTies(measure: Measure, location: ValidationLocation): ValidationError[]; /** * Validate beam begin/end pairing */ declare function validateBeams(measure: Measure, location: ValidationLocation): ValidationError[]; /** * Validate slur start/stop pairing */ declare function validateSlurs(measure: Measure, _location: ValidationLocation): ValidationError[]; /** * Validate tuplet start/stop pairing */ declare function validateTuplets(measure: Measure, location: ValidationLocation): ValidationError[]; /** * Validate part ID references between partList and parts */ declare function validatePartReferences(score: Score): ValidationError[]; /** * Validate voice and staff numbers */ declare function validateVoiceStaff(measure: Measure, staves: number, location: ValidationLocation): ValidationError[]; /** * Validate part structure (measure counts and numbers match across parts) */ declare function validatePartStructure(score: Score): ValidationError[]; /** * Validate staff structure within a part */ declare function validateStaffStructure(part: Part, partIndex: number): ValidationError[]; /** * Context needed to validate a single measure */ interface MeasureValidationContext { /** Current divisions value (from previous attributes) */ divisions: number; /** Current time signature */ time?: TimeSignature; /** Current staves count */ staves: number; /** Part index (for error location) */ partIndex: number; /** Part ID (for error location) */ partId: string; /** Measure index (for error location) */ measureIndex: number; } /** * Options for local measure validation */ interface LocalValidateOptions { checkMeasureDuration?: boolean; checkMeasureFullness?: boolean; checkPosition?: boolean; checkBeams?: boolean; checkTuplets?: boolean; checkVoiceStaff?: boolean; durationTolerance?: number; } /** * Validate a single measure with provided context. * This is useful for validating after local operations like addNote, deleteNote. * * @example * ```typescript * const context = getMeasureContext(score, partIndex, measureIndex); * const errors = validateMeasureLocal(measure, context); * if (errors.length > 0) { * throw new Error('Operation created invalid state'); * } * ``` */ declare function validateMeasureLocal(measure: Measure, context: MeasureValidationContext, options?: LocalValidateOptions): ValidationError[]; /** * Get the validation context for a measure by traversing previous attributes. * This collects divisions, time, and staves from measure 0 to the target measure. */ declare function getMeasureContext(score: Score, partIndex: number, measureIndex: number): MeasureValidationContext; /** * Validate a measure after an operation, throwing if invalid. * Convenience wrapper around validateMeasureLocal. */ declare function assertMeasureValid(score: Score, partIndex: number, measureIndex: number, options?: LocalValidateOptions): void; /** * Check if a score is valid (no errors) */ declare function isValid(score: Score, options?: ValidateOptions): boolean; /** * Validate and throw if invalid */ declare function assertValid(score: Score, options?: ValidateOptions): void; /** * Format a validation location for display */ declare function formatLocation(location: ValidationLocation): string; /** * Validation exception with structured error information */ declare class ValidationException extends Error { readonly errors: ValidationError[]; constructor(errors: ValidationError[], message: string); } /** * Validate ties across measures * This is more complex as ties can span multiple measures */ declare function validateTiesAcrossMeasures(part: Part): ValidationError[]; /** * Validate slurs across measures */ declare function validateSlursAcrossMeasures(part: Part): ValidationError[]; /** * Operation result type - success with data or failure with errors */ type OperationResult = { success: true; data: T; warnings?: ValidationError[]; } | { success: false; errors: ValidationError[]; }; type OperationErrorCode = 'NOTE_CONFLICT' | 'EXCEEDS_MEASURE' | 'INVALID_POSITION' | 'NOTE_NOT_FOUND' | 'PART_NOT_FOUND' | 'MEASURE_NOT_FOUND' | 'INVALID_DURATION' | 'INVALID_STAFF' | 'DUPLICATE_PART_ID' | 'TIE_ALREADY_EXISTS' | 'TIE_NOT_FOUND' | 'TIE_PITCH_MISMATCH' | 'TIE_INVALID_TARGET' | 'SLUR_ALREADY_EXISTS' | 'SLUR_NOT_FOUND' | 'ARTICULATION_ALREADY_EXISTS' | 'ARTICULATION_NOT_FOUND' | 'DYNAMICS_ALREADY_EXISTS' | 'DYNAMICS_NOT_FOUND' | 'INVALID_CLEF' | 'ACCIDENTAL_OUT_OF_BOUNDS' | 'BARLINE_NOT_FOUND' | 'BARLINE_ALREADY_EXISTS' | 'ENDING_NOT_FOUND' | 'ENDING_ALREADY_EXISTS' | 'REPEAT_NOT_FOUND' | 'REPEAT_ALREADY_EXISTS' | 'GRACE_NOTE_NOT_FOUND' | 'INVALID_GRACE_NOTE' | 'LYRIC_NOT_FOUND' | 'LYRIC_ALREADY_EXISTS' | 'HARMONY_NOT_FOUND' | 'HARMONY_ALREADY_EXISTS' | 'INVALID_HARMONY' | 'TEMPO_NOT_FOUND' | 'INVALID_RANGE' | 'WEDGE_NOT_FOUND' | 'FERMATA_ALREADY_EXISTS' | 'FERMATA_NOT_FOUND' | 'ORNAMENT_ALREADY_EXISTS' | 'ORNAMENT_NOT_FOUND' | 'PEDAL_NOT_FOUND' | 'INVALID_TEXT'; interface InsertNoteOptions { partIndex: number; measureIndex: number; voice: string; staff?: number; position: number; pitch: Pitch; duration: number; noteType?: NoteEntry['noteType']; dots?: number; } /** * Insert a note at the specified position in a voice. * - If the position has a rest, replaces it with the note * - If there's a conflicting note, returns NOTE_CONFLICT error * - If the note exceeds measure duration, returns EXCEEDS_MEASURE error */ declare function insertNote(score: Score, options: InsertNoteOptions): OperationResult; interface RemoveNoteOptions { partIndex: number; measureIndex: number; noteIndex: number; } /** * Remove a note and replace with rest */ declare function removeNote(score: Score, options: RemoveNoteOptions): OperationResult; interface AddChordOptions { partIndex: number; measureIndex: number; noteIndex: number; pitch: Pitch; } /** * Add a chord note to an existing note */ declare function addChord(score: Score, options: AddChordOptions): OperationResult; interface ChangeNoteDurationOptions { partIndex: number; measureIndex: number; noteIndex: number; newDuration: number; noteType?: NoteEntry['noteType']; dots?: number; } /** * Change note duration with proper handling of following notes * - If longer: consumes following rests/notes, returns error if would overwrite notes * - If shorter: fills remainder with rest */ declare function changeNoteDuration(score: Score, options: ChangeNoteDurationOptions): OperationResult; interface SetNotePitchOptions { partIndex: number; measureIndex: number; noteIndex: number; pitch: Pitch; } /** * Set note pitch (simple pitch change, no validation needed) */ declare function setNotePitch(score: Score, options: SetNotePitchOptions): OperationResult; interface SetNotePitchBySemitoneOptions { partIndex: number; measureIndex: number; noteIndex: number; /** MIDI-like semitone value (C4 = 48, C#4 = 49, etc.) */ semitone: number; /** Prefer sharp spelling over flat (defaults to key signature preference) */ preferSharp?: boolean; } /** * Set note pitch by semitone value, considering key signature and accidentals. * Automatically determines the appropriate enharmonic spelling and sets the accidental if needed. */ declare function setNotePitchBySemitone(score: Score, options: SetNotePitchBySemitoneOptions): OperationResult; interface ShiftNotePitchOptions { partIndex: number; measureIndex: number; noteIndex: number; /** Number of semitones to shift (positive = up, negative = down) */ semitones: number; /** Prefer sharp spelling over flat (defaults to key signature preference) */ preferSharp?: boolean; } /** * Shift note pitch by a number of semitones, considering key signature and accidentals. * Automatically determines the appropriate enharmonic spelling and sets the accidental if needed. */ declare function shiftNotePitch(score: Score, options: ShiftNotePitchOptions): OperationResult; interface RaiseAccidentalOptions { partIndex: number; measureIndex: number; noteIndex: number; } /** * Raise the accidental of a note by one step. * C → C#, C# → C##, Db → D, etc. * Keeps the note's step (letter name) and increments alter by 1. * Returns error if alter would exceed +2. */ declare function raiseAccidental(score: Score, options: RaiseAccidentalOptions): OperationResult; interface LowerAccidentalOptions { partIndex: number; measureIndex: number; noteIndex: number; } /** * Lower the accidental of a note by one step. * C# → C, C## → C#, D → Db, Db → Dbb, etc. * Keeps the note's step (letter name) and decrements alter by 1. * Returns error if alter would go below -2. */ declare function lowerAccidental(score: Score, options: LowerAccidentalOptions): OperationResult; interface AddVoiceOptions { partIndex: number; measureIndex: number; voice: string; staff?: number; } /** * Add a new voice to a measure, filled with a whole-measure rest */ declare function addVoice(score: Score, options: AddVoiceOptions): OperationResult; /** * Transpose all notes in the score */ declare function transpose(score: Score, semitones: number): OperationResult; interface AddPartOptions { id: string; name?: string; abbreviation?: string; insertIndex?: number; time?: TimeSignature; key?: KeySignature; clef?: Clef; divisions?: number; } declare function addPart(score: Score, options: AddPartOptions): OperationResult; declare function removePart(score: Score, partId: string): OperationResult; interface DuplicatePartOptions { sourcePartId: string; newPartId: string; newPartName?: string; } declare function duplicatePart(score: Score, options: DuplicatePartOptions): OperationResult; interface SetStavesOptions { partIndex: number; staves: number; clefs?: Clef[]; fromMeasure?: number; } declare function setStaves(score: Score, options: SetStavesOptions): OperationResult; interface MoveNoteToStaffOptions { partIndex: number; measureIndex: number; noteIndex: number; targetStaff: number; } declare function moveNoteToStaff(score: Score, options: MoveNoteToStaffOptions): OperationResult; declare function changeKey(score: Score, key: KeySignature, options: { fromMeasure: string | number; }): Score; declare function changeTime(score: Score, time: TimeSignature, options: { fromMeasure: string | number; }): Score; declare function insertMeasure(score: Score, options: { afterMeasure: string | number; copyAttributes?: boolean; }): Score; declare function deleteMeasure(score: Score, measureNumber: string | number): Score; interface AddTieOptions { partIndex: number; startMeasureIndex: number; startNoteIndex: number; endMeasureIndex: number; endNoteIndex: number; } /** * Add a tie between two notes. * The notes must have the same pitch. * Adds tie start to the first note and tie stop to the second note. */ declare function addTie(score: Score, options: AddTieOptions): OperationResult; interface RemoveTieOptions { partIndex: number; measureIndex: number; noteIndex: number; } /** * Remove a tie from a note (removes both start and stop if the note is part of a tie) */ declare function removeTie(score: Score, options: RemoveTieOptions): OperationResult; interface AddSlurOptions { partIndex: number; startMeasureIndex: number; startNoteIndex: number; endMeasureIndex: number; endNoteIndex: number; number?: number; placement?: 'above' | 'below'; } /** * Add a slur between two notes */ declare function addSlur(score: Score, options: AddSlurOptions): OperationResult; interface RemoveSlurOptions { partIndex: number; measureIndex: number; noteIndex: number; number?: number; } /** * Remove a slur from a note */ declare function removeSlur(score: Score, options: RemoveSlurOptions): OperationResult; interface AddArticulationOptions { partIndex: number; measureIndex: number; noteIndex: number; articulation: ArticulationType; placement?: 'above' | 'below'; } /** * Add an articulation to a note */ declare function addArticulation(score: Score, options: AddArticulationOptions): OperationResult; interface RemoveArticulationOptions { partIndex: number; measureIndex: number; noteIndex: number; articulation: ArticulationType; } /** * Remove an articulation from a note */ declare function removeArticulation(score: Score, options: RemoveArticulationOptions): OperationResult; interface AddDynamicsOptions { partIndex: number; measureIndex: number; position: number; dynamics: DynamicsValue; staff?: number; placement?: 'above' | 'below'; } /** * Add a dynamics marking at a specific position in a measure */ declare function addDynamics(score: Score, options: AddDynamicsOptions): OperationResult; interface RemoveDynamicsOptions { partIndex: number; measureIndex: number; directionIndex: number; } /** * Remove a dynamics direction from a measure */ declare function removeDynamics(score: Score, options: RemoveDynamicsOptions): OperationResult; interface ModifyDynamicsOptions { partIndex: number; measureIndex: number; /** Index of the dynamics direction to modify (among dynamics directions in the measure) */ directionIndex: number; /** New dynamics value */ dynamics: DynamicsValue; /** New placement (optional) */ placement?: 'above' | 'below'; } /** * Modify an existing dynamics marking in a measure */ declare function modifyDynamics(score: Score, options: ModifyDynamicsOptions): OperationResult; interface InsertClefChangeOptions { partIndex: number; measureIndex: number; position: number; clef: Clef; } /** * Insert a clef change at a specific position within a measure */ declare function insertClefChange(score: Score, options: InsertClefChangeOptions): OperationResult; /** @deprecated Use insertNote instead */ declare const addNote: (score: Score, options: { partIndex: number; measureIndex: number; staff?: number; voice: string; position: number; note: Omit; }) => Score; /** @deprecated Use removeNote instead */ declare const deleteNote: (score: Score, options: { partIndex: number; measureIndex: number; noteIndex: number; }) => Score; /** @deprecated Use addChord instead */ declare const addChordNote: (score: Score, options: { partIndex: number; measureIndex: number; afterNoteIndex: number; pitch: Pitch; }) => Score; /** @deprecated Use setNotePitch instead */ declare const modifyNotePitch: (score: Score, options: { partIndex: number; measureIndex: number; noteIndex: number; pitch: Pitch; }) => Score; /** @deprecated Use changeNoteDuration instead */ declare const modifyNoteDuration: (score: Score, options: { partIndex: number; measureIndex: number; noteIndex: number; duration: number; noteType?: NoteEntry["noteType"]; dots?: number; }) => Score; /** @deprecated Use insertNote instead */ declare const addNoteChecked: (score: Score, options: { partIndex: number; measureIndex: number; staff?: number; voice: string; position: number; note: Omit; }) => OperationResult; /** @deprecated Use removeNote instead */ declare const deleteNoteChecked: typeof removeNote; /** @deprecated Use addChord instead */ declare const addChordNoteChecked: (score: Score, options: { partIndex: number; measureIndex: number; afterNoteIndex: number; pitch: Pitch; }) => OperationResult; /** @deprecated Use setNotePitch instead */ declare const modifyNotePitchChecked: typeof setNotePitch; /** @deprecated Use changeNoteDuration instead */ declare const modifyNoteDurationChecked: (score: Score, options: { partIndex: number; measureIndex: number; noteIndex: number; duration: number; noteType?: NoteEntry["noteType"]; dots?: number; }) => OperationResult; /** @deprecated Use transpose instead */ declare const transposeChecked: typeof transpose; interface CreateTupletOptions { partIndex: number; measureIndex: number; /** Starting note index (0-based, counting pitched notes only) */ startNoteIndex: number; /** Number of notes to include in the tuplet */ noteCount: number; /** Actual notes in the time of normal notes (e.g., 3 for triplet) */ actualNotes: number; /** Normal notes (e.g., 2 for triplet) */ normalNotes: number; /** Show bracket (default: true) */ bracket?: boolean; /** Show number display (default: 'actual') */ showNumber?: 'actual' | 'both' | 'none'; } /** * Create a tuplet from consecutive notes. * A tuplet fits `actualNotes` notes in the time of `normalNotes` (e.g., 3 in the time of 2 for triplets). * * @example * // Create a triplet from 3 eighth notes (3 in the time of 2) * createTuplet(score, { * partIndex: 0, * measureIndex: 0, * startNoteIndex: 0, * noteCount: 3, * actualNotes: 3, * normalNotes: 2, * }) */ declare function createTuplet(score: Score, options: CreateTupletOptions): OperationResult; interface RemoveTupletOptions { partIndex: number; measureIndex: number; /** Note index of any note within the tuplet */ noteIndex: number; } /** * Remove tuplet from notes. * Finds the tuplet containing the specified note and removes all tuplet information. */ declare function removeTuplet(score: Score, options: RemoveTupletOptions): OperationResult; interface AddBeamOptions { partIndex: number; measureIndex: number; /** Starting note index */ startNoteIndex: number; /** Number of notes to beam together */ noteCount: number; /** Beam level (1 = eighth notes, 2 = sixteenth notes, etc.) */ beamLevel?: number; } /** * Add beaming to consecutive notes. * Notes must be in the same voice and should be eighth notes or shorter. */ declare function addBeam(score: Score, options: AddBeamOptions): OperationResult; interface RemoveBeamOptions { partIndex: number; measureIndex: number; /** Note index of any note within the beam group */ noteIndex: number; /** Beam level to remove (default: all levels) */ beamLevel?: number; } /** * Remove beaming from notes. */ declare function removeBeam(score: Score, options: RemoveBeamOptions): OperationResult; interface AutoBeamOptions { partIndex: number; measureIndex: number; /** Optional voice filter */ voice?: string; /** Group by beat (default: true) */ groupByBeat?: boolean; } /** * Automatically beam notes based on time signature and beat groupings. * Groups eighth notes and shorter notes by beat. */ declare function autoBeam(score: Score, options: AutoBeamOptions): OperationResult; /** * Selection represents copied content that can be pasted */ interface NoteSelection { /** Source information */ source: { partIndex: number; measureIndex: number; startPosition: number; endPosition: number; voice: string; staff?: number; }; /** Copied notes with their relative positions */ notes: Array<{ /** Relative position from selection start */ relativePosition: number; /** Note data (deep cloned) */ note: NoteEntry; }>; /** Total duration of the selection */ duration: number; } interface CopyNotesOptions { partIndex: number; measureIndex: number; /** Start position in the measure (in divisions) */ startPosition: number; /** End position in the measure (in divisions) */ endPosition: number; /** Voice to copy from */ voice: string; /** Staff to copy from (optional) */ staff?: number; } /** * Copy notes from a range in a measure. * Returns a NoteSelection that can be used with pasteNotes. */ declare function copyNotes(score: Score, options: CopyNotesOptions): OperationResult; interface PasteNotesOptions { /** Selection to paste */ selection: NoteSelection; /** Target part index */ partIndex: number; /** Target measure index */ measureIndex: number; /** Target position in the measure */ position: number; /** Target voice (defaults to original voice) */ voice?: string; /** Target staff (defaults to original staff) */ staff?: number; /** Clear existing notes in the paste range (default: true) */ overwrite?: boolean; } /** * Paste notes from a NoteSelection to a target position. */ declare function pasteNotes(score: Score, options: PasteNotesOptions): OperationResult; type CutNotesOptions = CopyNotesOptions; /** * Cut notes from a range (copy and delete). * Returns both the selection and the modified score. */ declare function cutNotes(score: Score, options: CutNotesOptions): OperationResult<{ score: Score; selection: NoteSelection; }>; interface CopyNotesMultiMeasureOptions { partIndex: number; /** Starting measure index */ startMeasureIndex: number; /** Ending measure index (inclusive) */ endMeasureIndex: number; /** Voice to copy from */ voice: string; /** Staff to copy from (optional) */ staff?: number; } /** * Selection for multiple measures */ interface MultiMeasureSelection { source: { partIndex: number; startMeasureIndex: number; endMeasureIndex: number; voice: string; staff?: number; }; /** Notes grouped by measure offset */ measures: Array<{ measureOffset: number; notes: Array<{ relativePosition: number; note: NoteEntry; }>; }>; } /** * Copy notes across multiple measures. */ declare function copyNotesMultiMeasure(score: Score, options: CopyNotesMultiMeasureOptions): OperationResult; interface PasteNotesMultiMeasureOptions { selection: MultiMeasureSelection; partIndex: number; /** Target starting measure index */ startMeasureIndex: number; /** Target voice (defaults to original voice) */ voice?: string; /** Target staff (defaults to original staff) */ staff?: number; /** Clear existing notes in paste measures (default: true) */ overwrite?: boolean; } /** * Paste notes across multiple measures. */ declare function pasteNotesMultiMeasure(score: Score, options: PasteNotesMultiMeasureOptions): OperationResult; interface AddTempoOptions { partIndex: number; measureIndex: number; /** Position in divisions within the measure */ position: number; /** Tempo in BPM */ bpm: number; /** Beat unit (e.g., 'quarter', 'half', 'eighth') */ beatUnit?: 'whole' | 'half' | 'quarter' | 'eighth' | '16th'; /** Whether beat unit has a dot */ beatUnitDot?: boolean; /** Text description (e.g., 'Allegro', 'Andante') */ text?: string; /** Placement (above/below staff) */ placement?: 'above' | 'below'; } /** * Add a tempo marking to a measure. */ declare function addTempo(score: Score, options: AddTempoOptions): OperationResult; interface RemoveTempoOptions { partIndex: number; measureIndex: number; /** Index of the direction to remove (among tempo directions) */ directionIndex?: number; } /** * Remove a tempo marking from a measure. */ declare function removeTempo(score: Score, options: RemoveTempoOptions): OperationResult; interface ModifyTempoOptions { partIndex: number; measureIndex: number; /** Index of the tempo direction to modify (among tempo directions in the measure) */ directionIndex?: number; /** New BPM value */ bpm?: number; /** New beat unit */ beatUnit?: 'whole' | 'half' | 'quarter' | 'eighth' | '16th' | '32nd' | '64th'; /** Beat unit dot */ beatUnitDot?: boolean; /** New tempo text (e.g., 'Allegro') */ text?: string; /** Placement */ placement?: 'above' | 'below'; } /** * Modify an existing tempo marking in a measure */ declare function modifyTempo(score: Score, options: ModifyTempoOptions): OperationResult; interface AddWedgeOptions { partIndex: number; /** Starting measure index */ startMeasureIndex: number; /** Starting position in divisions */ startPosition: number; /** Ending measure index */ endMeasureIndex: number; /** Ending position in divisions */ endPosition: number; /** Wedge type */ type: 'crescendo' | 'diminuendo'; /** Staff number (for multi-staff parts) */ staff?: number; /** Placement (above/below) */ placement?: 'above' | 'below'; } /** * Add a wedge (crescendo or diminuendo) spanning one or more measures. */ declare function addWedge(score: Score, options: AddWedgeOptions): OperationResult; interface RemoveWedgeOptions { partIndex: number; measureIndex: number; /** Index of the wedge start direction to remove */ directionIndex?: number; } /** * Remove a wedge (and its corresponding stop). */ declare function removeWedge(score: Score, options: RemoveWedgeOptions): OperationResult; interface AddFermataOptions { partIndex: number; measureIndex: number; noteIndex: number; /** Fermata shape */ shape?: 'normal' | 'angled' | 'square' | 'double-angled' | 'double-square' | 'double-dot' | 'half-curve' | 'curlew'; /** Fermata type (upright or inverted) */ fermataType?: 'upright' | 'inverted'; /** Placement */ placement?: 'above' | 'below'; } /** * Add a fermata to a note. */ declare function addFermata(score: Score, options: AddFermataOptions): OperationResult; interface RemoveFermataOptions { partIndex: number; measureIndex: number; noteIndex: number; } /** * Remove a fermata from a note. */ declare function removeFermata(score: Score, options: RemoveFermataOptions): OperationResult; interface AddOrnamentOptions { partIndex: number; measureIndex: number; noteIndex: number; /** Ornament type */ ornament: OrnamentType; /** Placement */ placement?: 'above' | 'below'; /** Accidental mark for the ornament */ accidentalMark?: 'sharp' | 'flat' | 'natural' | 'double-sharp' | 'flat-flat'; } /** * Add an ornament (trill, mordent, turn, etc.) to a note. */ declare function addOrnament(score: Score, options: AddOrnamentOptions): OperationResult; interface RemoveOrnamentOptions { partIndex: number; measureIndex: number; noteIndex: number; /** Specific ornament to remove (removes first ornament if not specified) */ ornament?: OrnamentType; } /** * Remove an ornament from a note. */ declare function removeOrnament(score: Score, options: RemoveOrnamentOptions): OperationResult; interface AddPedalOptions { partIndex: number; measureIndex: number; /** Position in divisions */ position: number; /** Pedal type */ pedalType: 'start' | 'stop' | 'change' | 'continue'; /** Show as line or Ped/star symbols */ line?: boolean; /** Placement */ placement?: 'above' | 'below'; } /** * Add a pedal marking. */ declare function addPedal(score: Score, options: AddPedalOptions): OperationResult; interface RemovePedalOptions { partIndex: number; measureIndex: number; /** Index of the pedal direction to remove (among pedal directions) */ directionIndex?: number; } /** * Remove a pedal marking. */ declare function removePedal(score: Score, options: RemovePedalOptions): OperationResult; interface AddTextDirectionOptions { partIndex: number; measureIndex: number; /** Position in divisions */ position: number; /** Text content */ text: string; /** Font style */ fontStyle?: 'normal' | 'italic'; /** Font weight */ fontWeight?: 'normal' | 'bold'; /** Placement */ placement?: 'above' | 'below'; } /** * Add a text direction (expression text, performance instruction). */ declare function addTextDirection(score: Score, options: AddTextDirectionOptions): OperationResult; interface AddRehearsalMarkOptions { partIndex: number; measureIndex: number; /** Rehearsal mark text (e.g., 'A', 'B', '1', '2') */ text: string; /** Enclosure type */ enclosure?: 'square' | 'circle' | 'oval' | 'rectangle' | 'diamond' | 'triangle' | 'pentagon' | 'hexagon' | 'none'; } /** * Add a rehearsal mark to a measure. */ declare function addRehearsalMark(score: Score, options: AddRehearsalMarkOptions): OperationResult; type BarStyle = 'regular' | 'dotted' | 'dashed' | 'heavy' | 'light-light' | 'light-heavy' | 'heavy-light' | 'heavy-heavy' | 'tick' | 'short' | 'none'; interface AddRepeatBarlineOptions { partIndex: number; measureIndex: number; direction: 'forward' | 'backward'; times?: number; } /** * Add a repeat barline to a measure. * Forward repeats go on the left, backward repeats go on the right. * This operation applies to all parts at the specified measure index. */ declare function addRepeatBarline(score: Score, options: AddRepeatBarlineOptions): OperationResult; interface RemoveRepeatBarlineOptions { partIndex: number; measureIndex: number; location: 'left' | 'right'; } /** * Remove a repeat barline from a measure. * This operation applies to all parts at the specified measure index. */ declare function removeRepeatBarline(score: Score, options: RemoveRepeatBarlineOptions): OperationResult; interface AddEndingOptions { partIndex: number; measureIndex: number; number: string; type: 'start' | 'stop' | 'discontinue'; } /** * Add an ending (volta bracket) to a measure. * Start endings go on the left barline, stop/discontinue on the right. * This operation applies to all parts at the specified measure index. */ declare function addEnding(score: Score, options: AddEndingOptions): OperationResult; interface RemoveEndingOptions { partIndex: number; measureIndex: number; location: 'left' | 'right'; } /** * Remove an ending (volta bracket) from a measure. * This operation applies to all parts at the specified measure index. */ declare function removeEnding(score: Score, options: RemoveEndingOptions): OperationResult; interface ChangeBarlineOptions { partIndex: number; measureIndex: number; location: 'left' | 'right' | 'middle'; barStyle: BarStyle; } /** * Change the barline style at a specific location in a measure. * This operation applies to all parts at the specified measure index. */ declare function changeBarline(score: Score, options: ChangeBarlineOptions): OperationResult; interface AddSegnoOptions { partIndex: number; measureIndex: number; position?: number; } /** * Add a segno sign to a measure. */ declare function addSegno(score: Score, options: AddSegnoOptions): OperationResult; interface AddCodaOptions { partIndex: number; measureIndex: number; position?: number; } /** * Add a coda sign to a measure. */ declare function addCoda(score: Score, options: AddCodaOptions): OperationResult; interface AddNavigationOptions { partIndex: number; measureIndex: number; position?: number; } /** * Add a D.C. (Da Capo) marking to a measure. * This adds both the text direction and the sound element. */ declare function addDaCapo(score: Score, options: AddNavigationOptions): OperationResult; /** * Add a D.S. (Dal Segno) marking to a measure. */ declare function addDalSegno(score: Score, options: AddNavigationOptions): OperationResult; /** * Add a Fine marking to a measure. */ declare function addFine(score: Score, options: AddNavigationOptions): OperationResult; /** * Add a To Coda marking to a measure. */ declare function addToCoda(score: Score, options: AddNavigationOptions): OperationResult; interface AddGraceNoteOptions { partIndex: number; measureIndex: number; targetNoteIndex: number; pitch: Pitch; noteType?: NoteType; slash?: boolean; voice?: string; staff?: number; } /** * Add a grace note before a target note. * Grace notes do not have duration in MusicXML. */ declare function addGraceNote(score: Score, options: AddGraceNoteOptions): OperationResult; interface RemoveGraceNoteOptions { partIndex: number; measureIndex: number; graceNoteIndex: number; } /** * Remove a grace note from a measure. */ declare function removeGraceNote(score: Score, options: RemoveGraceNoteOptions): OperationResult; interface ConvertToGraceOptions { partIndex: number; measureIndex: number; noteIndex: number; slash?: boolean; } /** * Convert a regular note to a grace note. * The note's duration will be removed. */ declare function convertToGrace(score: Score, options: ConvertToGraceOptions): OperationResult; interface AddLyricOptions { partIndex: number; measureIndex: number; noteIndex: number; text: string; syllabic?: 'single' | 'begin' | 'middle' | 'end'; verse?: number; extend?: boolean; } /** * Add a lyric to a note. */ declare function addLyric(score: Score, options: AddLyricOptions): OperationResult; interface RemoveLyricOptions { partIndex: number; measureIndex: number; noteIndex: number; verse?: number; } /** * Remove a lyric from a note. */ declare function removeLyric(score: Score, options: RemoveLyricOptions): OperationResult; interface UpdateLyricOptions { partIndex: number; measureIndex: number; noteIndex: number; verse?: number; text?: string; syllabic?: 'single' | 'begin' | 'middle' | 'end'; extend?: boolean; } /** * Update an existing lyric on a note. */ declare function updateLyric(score: Score, options: UpdateLyricOptions): OperationResult; type HarmonyKind = 'major' | 'minor' | 'augmented' | 'diminished' | 'dominant' | 'major-seventh' | 'minor-seventh' | 'diminished-seventh' | 'augmented-seventh' | 'half-diminished' | 'major-minor' | 'major-sixth' | 'minor-sixth' | 'dominant-ninth' | 'major-ninth' | 'minor-ninth' | 'dominant-11th' | 'major-11th' | 'minor-11th' | 'dominant-13th' | 'major-13th' | 'minor-13th' | 'suspended-second' | 'suspended-fourth' | 'Neapolitan' | 'Italian' | 'French' | 'German' | 'pedal' | 'power' | 'Tristan' | 'other' | 'none'; interface AddHarmonyOptions { partIndex: number; measureIndex: number; position: number; root: { step: string; alter?: number; }; kind: HarmonyKind; kindText?: string; bass?: { step: string; alter?: number; }; degrees?: { value: number; alter?: number; type: 'add' | 'alter' | 'subtract'; }[]; staff?: number; placement?: 'above' | 'below'; } /** * Add a harmony (chord symbol) to a measure. */ declare function addHarmony(score: Score, options: AddHarmonyOptions): OperationResult; interface RemoveHarmonyOptions { partIndex: number; measureIndex: number; harmonyIndex: number; } /** * Remove a harmony from a measure. */ declare function removeHarmony(score: Score, options: RemoveHarmonyOptions): OperationResult; interface UpdateHarmonyOptions { partIndex: number; measureIndex: number; harmonyIndex: number; root?: { step: string; alter?: number; }; kind?: HarmonyKind; kindText?: string; bass?: { step: string; alter?: number; } | null; degrees?: { value: number; alter?: number; type: 'add' | 'alter' | 'subtract'; }[] | null; } /** * Update an existing harmony in a measure. */ declare function updateHarmony(score: Score, options: UpdateHarmonyOptions): OperationResult; interface AddFingeringOptions { partIndex: number; measureIndex: number; noteIndex: number; fingering: string; substitution?: boolean; alternate?: boolean; placement?: 'above' | 'below'; } /** * Add fingering notation to a note. * Fingering is typically indicated 1,2,3,4,5. */ declare function addFingering(score: Score, options: AddFingeringOptions): OperationResult; interface RemoveFingeringOptions { partIndex: number; measureIndex: number; noteIndex: number; } /** * Remove fingering notation from a note. */ declare function removeFingering(score: Score, options: RemoveFingeringOptions): OperationResult; type BowingType = 'up-bow' | 'down-bow'; interface AddBowingOptions { partIndex: number; measureIndex: number; noteIndex: number; bowingType: BowingType; placement?: 'above' | 'below'; } /** * Add bowing notation (up-bow or down-bow) to a note. * Used for bowed string instruments. */ declare function addBowing(score: Score, options: AddBowingOptions): OperationResult; interface RemoveBowingOptions { partIndex: number; measureIndex: number; noteIndex: number; bowingType?: BowingType; } /** * Remove bowing notation from a note. */ declare function removeBowing(score: Score, options: RemoveBowingOptions): OperationResult; interface AddStringNumberOptions { partIndex: number; measureIndex: number; noteIndex: number; stringNumber: number; placement?: 'above' | 'below'; } /** * Add string number notation to a note. * Used for fretted instruments and bowed strings. */ declare function addStringNumber(score: Score, options: AddStringNumberOptions): OperationResult; interface RemoveStringNumberOptions { partIndex: number; measureIndex: number; noteIndex: number; } /** * Remove string number notation from a note. */ declare function removeStringNumber(score: Score, options: RemoveStringNumberOptions): OperationResult; type OctaveShiftType = 'up' | 'down'; interface AddOctaveShiftOptions { partIndex: number; measureIndex: number; position: number; shiftType: OctaveShiftType; size?: number; } /** * Add an octave shift (8va/8vb) direction. * Type 'down' means notes appear higher than sounding (8va). * Type 'up' means notes appear lower than sounding (8vb). */ declare function addOctaveShift(score: Score, options: AddOctaveShiftOptions): OperationResult; interface StopOctaveShiftOptions { partIndex: number; measureIndex: number; position: number; size?: number; } /** * Stop an octave shift at the specified position. */ declare function stopOctaveShift(score: Score, options: StopOctaveShiftOptions): OperationResult; interface RemoveOctaveShiftOptions { partIndex: number; measureIndex: number; octaveShiftIndex?: number; } /** * Remove an octave shift direction from a measure. */ declare function removeOctaveShift(score: Score, options: RemoveOctaveShiftOptions): OperationResult; type BreathMarkValue = 'comma' | 'tick' | 'upbow' | 'salzedo'; interface AddBreathMarkOptions { partIndex: number; measureIndex: number; noteIndex: number; breathMarkType?: BreathMarkValue; placement?: 'above' | 'below'; } /** * Add a breath mark to a note. * Breath marks indicate where a performer should breathe. */ declare function addBreathMark(score: Score, options: AddBreathMarkOptions): OperationResult; interface RemoveBreathMarkOptions { partIndex: number; measureIndex: number; noteIndex: number; } /** * Remove a breath mark from a note. */ declare function removeBreathMark(score: Score, options: RemoveBreathMarkOptions): OperationResult; type CaesuraValue = 'normal' | 'thick' | 'short' | 'curved' | 'single'; interface AddCaesuraOptions { partIndex: number; measureIndex: number; noteIndex: number; caesuraType?: CaesuraValue; placement?: 'above' | 'below'; } /** * Add a caesura to a note. * A caesura indicates a brief, silent pause. * It is notated using a "railroad tracks" symbol. */ declare function addCaesura(score: Score, options: AddCaesuraOptions): OperationResult; interface RemoveCaesuraOptions { partIndex: number; measureIndex: number; noteIndex: number; } /** * Remove a caesura from a note. */ declare function removeCaesura(score: Score, options: RemoveCaesuraOptions): OperationResult; /** * Add text to the score. Alias for addTextDirection. */ declare const addText: typeof addTextDirection; type AddTextOptions = AddTextDirectionOptions; /** * Set beaming for notes. Alias for autoBeam. */ declare const setBeaming: typeof autoBeam; type SetBeamingOptions = AutoBeamOptions; /** * Add a chord symbol. Alias for addHarmony. */ declare const addChordSymbol: typeof addHarmony; type AddChordSymbolOptions = AddHarmonyOptions; /** * Remove a chord symbol. Alias for removeHarmony. */ declare const removeChordSymbol: typeof removeHarmony; type RemoveChordSymbolOptions = RemoveHarmonyOptions; /** * Update a chord symbol. Alias for updateHarmony. */ declare const updateChordSymbol: typeof updateHarmony; type UpdateChordSymbolOptions = UpdateHarmonyOptions; /** * Change the clef at a position. Alias for insertClefChange. */ declare const changeClef: typeof insertClefChange; type ChangeClefOptions = InsertClefChangeOptions; /** * Set barline style. Alias for changeBarline. */ declare const setBarline: typeof changeBarline; type SetBarlineOptions = ChangeBarlineOptions; /** * Add a repeat barline. Alias for addRepeatBarline. */ declare const addRepeat: typeof addRepeatBarline; type AddRepeatOptions = AddRepeatBarlineOptions; /** * Remove a repeat barline. Alias for removeRepeatBarline. */ declare const removeRepeat: typeof removeRepeatBarline; type RemoveRepeatOptions = RemoveRepeatBarlineOptions; export { copyNotesMultiMeasure as $, setStaves as A, moveNoteToStaff as B, changeKey as C, changeTime as D, insertMeasure as E, deleteMeasure as F, addTie as G, removeTie as H, addSlur as I, removeSlur as J, addArticulation as K, removeArticulation as L, addDynamics as M, removeDynamics as N, modifyDynamics as O, insertClefChange as P, changeClef as Q, createTuplet as R, removeTuplet as S, addBeam as T, removeBeam as U, type ValidateOptions as V, autoBeam as W, setBeaming as X, copyNotes as Y, pasteNotes as Z, cutNotes as _, type ValidationResult as a, type RaiseAccidentalOptions as a$, pasteNotesMultiMeasure as a0, addTempo as a1, removeTempo as a2, modifyTempo as a3, addWedge as a4, removeWedge as a5, addFermata as a6, removeFermata as a7, addOrnament as a8, removeOrnament as a9, removeHarmony as aA, updateHarmony as aB, addChordSymbol as aC, removeChordSymbol as aD, updateChordSymbol as aE, addFingering as aF, removeFingering as aG, addBowing as aH, removeBowing as aI, addStringNumber as aJ, removeStringNumber as aK, addOctaveShift as aL, stopOctaveShift as aM, removeOctaveShift as aN, addBreathMark as aO, removeBreathMark as aP, addCaesura as aQ, removeCaesura as aR, type OperationResult as aS, type OperationErrorCode as aT, type InsertNoteOptions as aU, type RemoveNoteOptions as aV, type AddChordOptions as aW, type ChangeNoteDurationOptions as aX, type SetNotePitchOptions as aY, type SetNotePitchBySemitoneOptions as aZ, type ShiftNotePitchOptions as a_, addPedal as aa, removePedal as ab, addTextDirection as ac, addText as ad, addRehearsalMark as ae, addRepeatBarline as af, removeRepeatBarline as ag, addRepeat as ah, removeRepeat as ai, addEnding as aj, removeEnding as ak, changeBarline as al, setBarline as am, addSegno as an, addCoda as ao, addDaCapo as ap, addDalSegno as aq, addFine as ar, addToCoda as as, addGraceNote as at, removeGraceNote as au, convertToGrace as av, addLyric as aw, removeLyric as ax, updateLyric as ay, addHarmony as az, addChord as b, type AddHarmonyOptions as b$, type LowerAccidentalOptions as b0, type AddVoiceOptions as b1, type AddPartOptions as b2, type DuplicatePartOptions as b3, type SetStavesOptions as b4, type MoveNoteToStaffOptions as b5, type AddTieOptions as b6, type RemoveTieOptions as b7, type AddSlurOptions as b8, type RemoveSlurOptions as b9, type RemoveFermataOptions as bA, type AddOrnamentOptions as bB, type RemoveOrnamentOptions as bC, type AddPedalOptions as bD, type RemovePedalOptions as bE, type AddTextDirectionOptions as bF, type AddTextOptions as bG, type AddRehearsalMarkOptions as bH, type AddRepeatBarlineOptions as bI, type RemoveRepeatBarlineOptions as bJ, type AddRepeatOptions as bK, type RemoveRepeatOptions as bL, type AddEndingOptions as bM, type RemoveEndingOptions as bN, type ChangeBarlineOptions as bO, type SetBarlineOptions as bP, type BarStyle as bQ, type AddSegnoOptions as bR, type AddCodaOptions as bS, type AddNavigationOptions as bT, type AddGraceNoteOptions as bU, type RemoveGraceNoteOptions as bV, type ConvertToGraceOptions as bW, type AddLyricOptions as bX, type RemoveLyricOptions as bY, type UpdateLyricOptions as bZ, type HarmonyKind as b_, type AddArticulationOptions as ba, type RemoveArticulationOptions as bb, type AddDynamicsOptions as bc, type RemoveDynamicsOptions as bd, type ModifyDynamicsOptions as be, type InsertClefChangeOptions as bf, type ChangeClefOptions as bg, type CreateTupletOptions as bh, type RemoveTupletOptions as bi, type AddBeamOptions as bj, type RemoveBeamOptions as bk, type AutoBeamOptions as bl, type SetBeamingOptions as bm, type NoteSelection as bn, type CopyNotesOptions as bo, type PasteNotesOptions as bp, type CutNotesOptions as bq, type CopyNotesMultiMeasureOptions as br, type MultiMeasureSelection as bs, type PasteNotesMultiMeasureOptions as bt, type AddTempoOptions as bu, type RemoveTempoOptions as bv, type ModifyTempoOptions as bw, type AddWedgeOptions as bx, type RemoveWedgeOptions as by, type AddFermataOptions as bz, setNotePitchBySemitone as c, type RemoveHarmonyOptions as c0, type UpdateHarmonyOptions as c1, type AddChordSymbolOptions as c2, type RemoveChordSymbolOptions as c3, type UpdateChordSymbolOptions as c4, type AddFingeringOptions as c5, type RemoveFingeringOptions as c6, type BowingType as c7, type AddBowingOptions as c8, type RemoveBowingOptions as c9, validateTiesAcrossMeasures as cA, validateSlursAcrossMeasures as cB, formatLocation as cC, ValidationException as cD, validateMeasureLocal as cE, getMeasureContext as cF, assertMeasureValid as cG, type ValidationError as cH, type ValidationLocation as cI, type ValidationErrorCode as cJ, type ValidationLevel as cK, type MeasureValidationContext as cL, type LocalValidateOptions as cM, type AddStringNumberOptions as ca, type RemoveStringNumberOptions as cb, type OctaveShiftType as cc, type AddOctaveShiftOptions as cd, type StopOctaveShiftOptions as ce, type RemoveOctaveShiftOptions as cf, type BreathMarkValue as cg, type AddBreathMarkOptions as ch, type RemoveBreathMarkOptions as ci, type CaesuraValue as cj, type AddCaesuraOptions as ck, type RemoveCaesuraOptions as cl, validate as cm, isValid as cn, assertValid as co, validateDivisions as cp, validateMeasureDuration as cq, validateBackupForward as cr, validateTies as cs, validateBeams as ct, validateSlurs as cu, validateTuplets as cv, validatePartReferences as cw, validatePartStructure as cx, validateStaffStructure as cy, validateVoiceStaff as cz, shiftNotePitch as d, changeNoteDuration as e, raiseAccidental as f, addNote as g, deleteNote as h, insertNote as i, addChordNote as j, modifyNoteDuration as k, lowerAccidental as l, modifyNotePitch as m, addNoteChecked as n, deleteNoteChecked as o, addChordNoteChecked as p, modifyNotePitchChecked as q, removeNote as r, setNotePitch as s, transpose as t, modifyNoteDurationChecked as u, transposeChecked as v, addVoice as w, addPart as x, removePart as y, duplicatePart as z };