musicxml-io 0.3.3 → 0.3.4
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 +43 -6
- package/dist/chunk-CANSNTYK.js +4944 -0
- package/dist/chunk-EFP2DAOK.mjs +4944 -0
- package/dist/chunk-TIFUKSTH.js +1809 -0
- package/dist/chunk-ZDAN74FN.mjs +1809 -0
- package/dist/index.js +687 -7273
- package/dist/index.mjs +918 -7230
- package/dist/operations/index.js +217 -5070
- package/dist/operations/index.mjs +109 -4830
- package/dist/query/index.js +158 -1778
- package/dist/query/index.mjs +79 -1596
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
[](https://www.npmjs.com/package/musicxml-io)
|
|
4
4
|
[](https://opensource.org/licenses/MIT)
|
|
5
5
|
|
|
6
|
-
TypeScript library for parsing and serializing MusicXML.
|
|
6
|
+
TypeScript library for parsing and serializing MusicXML and ABC notation.
|
|
7
7
|
|
|
8
8
|
## Architecture
|
|
9
9
|
|
|
@@ -13,10 +13,15 @@ TypeScript library for parsing and serializing MusicXML.
|
|
|
13
13
|
│ .xml / .mxl │─────▶│ Score │─────▶│ .xml / .mxl │
|
|
14
14
|
└─────────────────┘ │ │ └─────────────────┘
|
|
15
15
|
parse │ ┌─────────┐ │ serialize
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
┌─────────────────┐ │ │ parts │ │ ┌─────────────────┐
|
|
17
|
+
│ ABC notation │ │ │ └─measures │ │ ABC notation │
|
|
18
|
+
│ .abc │─────▶│ │ └─entries│─────▶│ .abc │
|
|
19
|
+
└─────────────────┘ │ └─────────┘ │ └─────────────────┘
|
|
20
|
+
parseAbc │ │ serializeAbc
|
|
21
|
+
│ │ ┌─────────────────┐
|
|
22
|
+
│ │ │ MIDI │
|
|
23
|
+
│ │─────▶│ .mid │
|
|
24
|
+
│ │ └─────────────────┘
|
|
20
25
|
│ │ exportMidi
|
|
21
26
|
└────────┬────────┘
|
|
22
27
|
│
|
|
@@ -69,6 +74,27 @@ const transposed = transpose(score, 2); // up 2 semitones
|
|
|
69
74
|
const output = serialize(transposed);
|
|
70
75
|
```
|
|
71
76
|
|
|
77
|
+
### ABC Notation
|
|
78
|
+
|
|
79
|
+
```typescript
|
|
80
|
+
import { parseAbc, serializeAbc } from 'musicxml-io';
|
|
81
|
+
|
|
82
|
+
// ABC → Score
|
|
83
|
+
const score = parseAbc(abcString);
|
|
84
|
+
|
|
85
|
+
// Score → ABC
|
|
86
|
+
const abc = serializeAbc(score, {
|
|
87
|
+
referenceNumber: 1,
|
|
88
|
+
includeChordSymbols: true,
|
|
89
|
+
includeDynamics: true,
|
|
90
|
+
includeLyrics: true,
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
// Auto-detect format (MusicXML, .mxl, or ABC)
|
|
94
|
+
import { parseAuto } from 'musicxml-io';
|
|
95
|
+
const score2 = parseAuto(input);
|
|
96
|
+
```
|
|
97
|
+
|
|
72
98
|
⚠️ **Warning**: This library's API is not yet stable and may change between versions.
|
|
73
99
|
|
|
74
100
|
### File I/O (Node.js)
|
|
@@ -170,10 +196,12 @@ const { valid, errors } = validate(score);
|
|
|
170
196
|
| `parse(xml)` | Parse MusicXML string |
|
|
171
197
|
| `parseFile(path)` | Parse from file |
|
|
172
198
|
| `parseCompressed(buffer)` | Parse .mxl |
|
|
173
|
-
| `
|
|
199
|
+
| `parseAbc(abc)` | Parse ABC notation string |
|
|
200
|
+
| `parseAuto(data)` | Auto-detect format (MusicXML / .mxl / ABC) |
|
|
174
201
|
| `serialize(score)` | To MusicXML string |
|
|
175
202
|
| `serializeToFile(score, path)` | To file |
|
|
176
203
|
| `serializeCompressed(score)` | To .mxl |
|
|
204
|
+
| `serializeAbc(score, options?)` | To ABC notation string |
|
|
177
205
|
| `exportMidi(score)` | To MIDI |
|
|
178
206
|
|
|
179
207
|
### Operations
|
|
@@ -324,12 +352,21 @@ This feature enables:
|
|
|
324
352
|
|
|
325
353
|
## Round-trip Fidelity
|
|
326
354
|
|
|
355
|
+
### MusicXML
|
|
356
|
+
|
|
327
357
|
| Metric | Score |
|
|
328
358
|
|--------|------:|
|
|
329
359
|
| Overall | 99.6% |
|
|
330
360
|
| Node coverage | 99.9% |
|
|
331
361
|
| Attribute coverage | 95.9% |
|
|
332
362
|
|
|
363
|
+
### ABC Notation
|
|
364
|
+
|
|
365
|
+
| Path | Fidelity |
|
|
366
|
+
|------|----------|
|
|
367
|
+
| ABC → Score → ABC | High (42 fixtures passing) |
|
|
368
|
+
| ABC → MusicXML → ABC | Musical content preserved |
|
|
369
|
+
|
|
333
370
|
## Contributing
|
|
334
371
|
|
|
335
372
|
Contributions are welcome! Whether it's bug reports, feature requests, documentation improvements, or code contributions, we appreciate your help in making this library better.
|