musicxml-io 0.3.1 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -26,6 +26,31 @@ declare function isCompressed(data: Uint8Array): boolean;
26
26
  */
27
27
  declare function parseAuto(data: Uint8Array | string): Score;
28
28
 
29
+ /**
30
+ * ABC Notation Parser
31
+ * Parses ABC notation format into the Score internal model.
32
+ *
33
+ * Supports ABC standard v2.1 core features:
34
+ * - Header fields (X, T, C, M, L, Q, K, V, w)
35
+ * - Notes with pitch, duration, accidentals, octave modifiers
36
+ * - Rests (z, Z)
37
+ * - Bar lines (|, ||, |], [|, |:, :|, ::)
38
+ * - Repeats and volta endings ([1, [2)
39
+ * - Chords (simultaneous notes: [CEG])
40
+ * - Chord symbols ("Am", "G7", etc.)
41
+ * - Ties (-) and slurs ((...))
42
+ * - Grace notes ({...})
43
+ * - Tuplets ((3..., (p:q:r...)
44
+ * - Dynamics (!p!, !f!, etc.)
45
+ * - Lyrics (w: field)
46
+ * - Multi-voice (V: field)
47
+ */
48
+
49
+ /**
50
+ * Parse an ABC notation string into a Score object.
51
+ */
52
+ declare function parseAbc(abcString: string): Score;
53
+
29
54
  interface SerializeOptions {
30
55
  version?: string;
31
56
  indent?: string;
@@ -67,6 +92,28 @@ interface MidiExportOptions {
67
92
  */
68
93
  declare function exportMidi(score: Score, options?: MidiExportOptions): Uint8Array;
69
94
 
95
+ /**
96
+ * ABC Notation Serializer
97
+ * Converts Score internal model to ABC notation format string.
98
+ */
99
+
100
+ interface AbcSerializeOptions {
101
+ /** Reference number (X: field). Default: 1 */
102
+ referenceNumber?: number;
103
+ /** Maximum notes per line before wrapping. Default: no limit */
104
+ notesPerLine?: number;
105
+ /** Include chord symbols. Default: true */
106
+ includeChordSymbols?: boolean;
107
+ /** Include dynamics. Default: true */
108
+ includeDynamics?: boolean;
109
+ /** Include lyrics. Default: true */
110
+ includeLyrics?: boolean;
111
+ }
112
+ /**
113
+ * Serialize a Score object to ABC notation format string.
114
+ */
115
+ declare function serializeAbc(score: Score, options?: AbcSerializeOptions): string;
116
+
70
117
  /**
71
118
  * Parse a MusicXML file from disk
72
119
  * Automatically handles both .xml/.musicxml and .mxl formats
@@ -90,6 +137,7 @@ interface ExportOptions extends SerializeOptions, MidiExportOptions {
90
137
  * - .mxl: Compressed MusicXML
91
138
  * - .xml/.musicxml: Uncompressed MusicXML
92
139
  * - .mid/.midi: Standard MIDI File
140
+ * - .abc: ABC notation
93
141
  * @param score - The Score to serialize
94
142
  * @param filePath - Path to write the file
95
143
  * @param options - Serialization options
@@ -298,4 +346,4 @@ declare function getPartNameMap(score: Score): Record<string, string | undefined
298
346
  */
299
347
  declare function generateId(): string;
300
348
 
301
- export { DirectionEntry, DirectionType, type DirectionTypeOfKind, Measure, type MidiExportOptions, NoteEntry, PartInfo, PartListEntry, Pitch, STEPS, STEP_SEMITONES, Score, type SerializeOptions, ValidateOptions, ValidationResult, decodeBuffer, exportMidi, generateId, getAllPartInfos, getDirectionOfKind, getDirectionsOfKind, getMeasureEndPosition, getPartAbbreviation, getPartInfo, getPartName, getPartNameMap, getSoundDamperPedal, getSoundDynamics, getSoundSoftPedal, getSoundSostenutoPedal, getSoundTempo, hasBeam, hasDirectionOfKind, hasLyrics, hasNotations, hasTie, hasTieStart, hasTieStop, hasTuplet, isChordNote, isCompressed, isCueNote, isGraceNote, isPartInfo, isPitchedNote, isRest, isUnpitchedNote, parse, parseAuto, parseCompressed, parseFile, pitchToSemitone, serialize, serializeCompressed, serializeToFile };
349
+ export { type AbcSerializeOptions, DirectionEntry, DirectionType, type DirectionTypeOfKind, Measure, type MidiExportOptions, NoteEntry, PartInfo, PartListEntry, Pitch, STEPS, STEP_SEMITONES, Score, type SerializeOptions, ValidateOptions, ValidationResult, decodeBuffer, exportMidi, generateId, getAllPartInfos, getDirectionOfKind, getDirectionsOfKind, getMeasureEndPosition, getPartAbbreviation, getPartInfo, getPartName, getPartNameMap, getSoundDamperPedal, getSoundDynamics, getSoundSoftPedal, getSoundSostenutoPedal, getSoundTempo, hasBeam, hasDirectionOfKind, hasLyrics, hasNotations, hasTie, hasTieStart, hasTieStop, hasTuplet, isChordNote, isCompressed, isCueNote, isGraceNote, isPartInfo, isPitchedNote, isRest, isUnpitchedNote, parse, parseAbc, parseAuto, parseCompressed, parseFile, pitchToSemitone, serialize, serializeAbc, serializeCompressed, serializeToFile };
package/dist/index.d.ts CHANGED
@@ -26,6 +26,31 @@ declare function isCompressed(data: Uint8Array): boolean;
26
26
  */
27
27
  declare function parseAuto(data: Uint8Array | string): Score;
28
28
 
29
+ /**
30
+ * ABC Notation Parser
31
+ * Parses ABC notation format into the Score internal model.
32
+ *
33
+ * Supports ABC standard v2.1 core features:
34
+ * - Header fields (X, T, C, M, L, Q, K, V, w)
35
+ * - Notes with pitch, duration, accidentals, octave modifiers
36
+ * - Rests (z, Z)
37
+ * - Bar lines (|, ||, |], [|, |:, :|, ::)
38
+ * - Repeats and volta endings ([1, [2)
39
+ * - Chords (simultaneous notes: [CEG])
40
+ * - Chord symbols ("Am", "G7", etc.)
41
+ * - Ties (-) and slurs ((...))
42
+ * - Grace notes ({...})
43
+ * - Tuplets ((3..., (p:q:r...)
44
+ * - Dynamics (!p!, !f!, etc.)
45
+ * - Lyrics (w: field)
46
+ * - Multi-voice (V: field)
47
+ */
48
+
49
+ /**
50
+ * Parse an ABC notation string into a Score object.
51
+ */
52
+ declare function parseAbc(abcString: string): Score;
53
+
29
54
  interface SerializeOptions {
30
55
  version?: string;
31
56
  indent?: string;
@@ -67,6 +92,28 @@ interface MidiExportOptions {
67
92
  */
68
93
  declare function exportMidi(score: Score, options?: MidiExportOptions): Uint8Array;
69
94
 
95
+ /**
96
+ * ABC Notation Serializer
97
+ * Converts Score internal model to ABC notation format string.
98
+ */
99
+
100
+ interface AbcSerializeOptions {
101
+ /** Reference number (X: field). Default: 1 */
102
+ referenceNumber?: number;
103
+ /** Maximum notes per line before wrapping. Default: no limit */
104
+ notesPerLine?: number;
105
+ /** Include chord symbols. Default: true */
106
+ includeChordSymbols?: boolean;
107
+ /** Include dynamics. Default: true */
108
+ includeDynamics?: boolean;
109
+ /** Include lyrics. Default: true */
110
+ includeLyrics?: boolean;
111
+ }
112
+ /**
113
+ * Serialize a Score object to ABC notation format string.
114
+ */
115
+ declare function serializeAbc(score: Score, options?: AbcSerializeOptions): string;
116
+
70
117
  /**
71
118
  * Parse a MusicXML file from disk
72
119
  * Automatically handles both .xml/.musicxml and .mxl formats
@@ -90,6 +137,7 @@ interface ExportOptions extends SerializeOptions, MidiExportOptions {
90
137
  * - .mxl: Compressed MusicXML
91
138
  * - .xml/.musicxml: Uncompressed MusicXML
92
139
  * - .mid/.midi: Standard MIDI File
140
+ * - .abc: ABC notation
93
141
  * @param score - The Score to serialize
94
142
  * @param filePath - Path to write the file
95
143
  * @param options - Serialization options
@@ -298,4 +346,4 @@ declare function getPartNameMap(score: Score): Record<string, string | undefined
298
346
  */
299
347
  declare function generateId(): string;
300
348
 
301
- export { DirectionEntry, DirectionType, type DirectionTypeOfKind, Measure, type MidiExportOptions, NoteEntry, PartInfo, PartListEntry, Pitch, STEPS, STEP_SEMITONES, Score, type SerializeOptions, ValidateOptions, ValidationResult, decodeBuffer, exportMidi, generateId, getAllPartInfos, getDirectionOfKind, getDirectionsOfKind, getMeasureEndPosition, getPartAbbreviation, getPartInfo, getPartName, getPartNameMap, getSoundDamperPedal, getSoundDynamics, getSoundSoftPedal, getSoundSostenutoPedal, getSoundTempo, hasBeam, hasDirectionOfKind, hasLyrics, hasNotations, hasTie, hasTieStart, hasTieStop, hasTuplet, isChordNote, isCompressed, isCueNote, isGraceNote, isPartInfo, isPitchedNote, isRest, isUnpitchedNote, parse, parseAuto, parseCompressed, parseFile, pitchToSemitone, serialize, serializeCompressed, serializeToFile };
349
+ export { type AbcSerializeOptions, DirectionEntry, DirectionType, type DirectionTypeOfKind, Measure, type MidiExportOptions, NoteEntry, PartInfo, PartListEntry, Pitch, STEPS, STEP_SEMITONES, Score, type SerializeOptions, ValidateOptions, ValidationResult, decodeBuffer, exportMidi, generateId, getAllPartInfos, getDirectionOfKind, getDirectionsOfKind, getMeasureEndPosition, getPartAbbreviation, getPartInfo, getPartName, getPartNameMap, getSoundDamperPedal, getSoundDynamics, getSoundSoftPedal, getSoundSostenutoPedal, getSoundTempo, hasBeam, hasDirectionOfKind, hasLyrics, hasNotations, hasTie, hasTieStart, hasTieStop, hasTuplet, isChordNote, isCompressed, isCueNote, isGraceNote, isPartInfo, isPitchedNote, isRest, isUnpitchedNote, parse, parseAbc, parseAuto, parseCompressed, parseFile, pitchToSemitone, serialize, serializeAbc, serializeCompressed, serializeToFile };