Skip to content
Implementation of the musicXML specification in Swift
Branch: latest
Clone or download


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: "", 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 && 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.

You can’t perform that action at this time.