Swiftpack.co - Package - dn-m/MusicXML


Swift Version Platforms Build Status Code Coverage

A work-in-progress implementation of the musicXML specification in Swift.

The goal of this project is to allow Swift users to read, manipulate, and write musicXML files in a richly-typed manner on any platform supported by Swift.


The upcoming pre-release versions will be focused on completing different tasks.


Pre-release version 0.3.0 will be defined by completing the implementation of the encoding of abstract musical content. The LilyPond Test Suite tests will be transformed into round-trip tests to ensure that the plumbing is clean.


Pre-release version 0.4.0 will be defined by refining the public interfaces exposed by the MusicXML package. Up until this point, pubic initializers may be somewhat clumsy.

Getting Started


Use the Swift Package Manager to include the MusicXML module into your project.


If you want to use the MusicXML module in your own project, add the MusicXML package to the dependencies section of your Package.swift file:

let package = Package(
    name: ...,
    products: [ ... ],
    dependencies: [
        .package(url: "https://github.com/dn-m/MusicXML", from: "0.1.0")
    targets: [ ... ]

Then, import the MusicXML module into a file which uses it:

import MusicXML

You can decode a MusicXML structure in a variety of ways:

let fromData: MusicXML = try MusicXML(data: data)
let fromString: MusicXML = try MusicXML(string: string)
let fromURL: MusicXML = try MusicXML(url: url)


To contribute to the MusicXML package, clone the git repository:

git clone https://github.com/dn-m/MusicXML && cd MusicXML

Build the package:

swift build

Run the tests:

swift test

If you use the Xcode IDE, use the Swift Package Manager to generate an .xcodeproj file:

swift package generate-xcodeproj

More Resources

See the MusicXML XSD Schema Reference for more information about how musicXML is structured.


Stars: 12
Help us keep the lights on


Used By

Total: 0


0.2.0 - Oct 13, 2019

Pre-release version 0.2.0 now successfully parses the LilyPond test suite in its entirety, with the exception of two tests:

  • Compressed-MusicXML, which is not yet critical to support yet
  • PartNoId, which is invalid as per the MusicXML specification.

Thanks to @DJBen and @bwetherfield for making this possible 🎉 !

0.1.0 - Dec 4, 2018

Provide a model and API for deserializing only the "Hello World" example provided by MakeMusic.