music_xml 2.1.0 copy "music_xml: ^2.1.0" to clipboard
music_xml: ^2.1.0 copied to clipboard

A Dart package to parse and serialize MusicXML 4.0.

music_xml #

Build pub package

A Dart package to parse and serialize MusicXML 4.0.

Features #

  • Parse MusicXML documents into typed Dart objects
  • All elements extend XmlElement for 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.

15
likes
150
points
74
downloads

Publisher

verified publisherdemen.org

Weekly Downloads

A Dart package to parse and serialize MusicXML 4.0.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

xml

More

Packages that depend on music_xml