music_xml 2.1.0
music_xml: ^2.1.0 copied to clipboard
A Dart package to parse and serialize MusicXML 4.0.
music_xml #
A Dart package to parse and serialize MusicXML 4.0.
Features #
- Parse MusicXML documents into typed Dart objects
- All elements extend
XmlElementfor XML roundtripping (parse and serialize) - Supports: notes, pitches, unpitched (percussion), grace notes, chords, lyrics, ties, key/time/clef signatures, tempo, dynamics, chord symbols, barlines, and more
- Follows the MusicXML 4.0 element hierarchy
Getting started #
Add music_xml to your pubspec.yaml:
dependencies:
music_xml: ^2.0.0
Usage #
import 'package:music_xml/music_xml.dart';
final document = MusicXmlDocument.parse(xmlString);
// Access score structure
final parts = document.score.parts;
final measures = parts.first.measures;
final notes = measures.first.notes;
// Access typed elements
final pitch = notes.first.pitch;
print(pitch?.toPitchString()); // "C4"
print(pitch?.toMidiPitch()); // 60
Deployment #
Run the publish command in dry-run mode to see if everything passes analysis:
flutter pub publish --dry-run
Publish to pub.dev:
flutter pub publish
Additional information #
Originally inspired by Google's Magenta musicxml_parser.py, now restructured as a standalone MusicXML 4.0 library.