Swiftpack.co - Package - dn-m/NotationModel


Swift Version Platforms Build Status

The NotationModel package contains modules for the purposes of defining a model of musical notations.

The types contained herein extend the structures defined in the dn-m/Music package, providing a rich context for abstract musical information so that it can be represented within a variety of notational media. This package remains agnostic to the concrete rendering backend.

For work on the graphical representation of music in Swift, see dn-m/NotationView.



The SpelledPitch module exposes structures for describing abstract pitches (e.g., what you get if you press a key on a MIDI keyboard) with letter names and accidentals. This is done in a progressively-disclosed and type-safe manner: it is easy to describe common pitch scenarios, linearly more difficult to describe more-rare pitch scenarios, and it is impossible to describe logically-invalid pitch scenarios.

The Pitch.Spelling structure provides a model of the Helmholtz-Ellis notation system. This notation system scales elegantly from the Western common practice twelve-note equal division of the octave tuning system to that of high-limit just intonation. This system is represented in the SMuFL specification, making a mapping of these structures into a rendering context as seamless as possible.


The SpelledRhythm module defines models of beams, ties, and dots.


Defines a model for positioning values onto two-dimensional plots.


Extends the PlotModel, incorporating the concept of clefs, noteheads, accidentals, etc.


Work on this package requires Swift 4.2.

Build instructions

Clone the repo.

git clone https://github.com/dn-m/NotationModel

Dive inside.

cd NotationModel

Ask Swift Package Manager to update dependencies (all are dn-m).

swift package update

Compiles code and runs tests in terminal.

swift test

Ask Swift Package Manager to generate a nice Xcode project.

swift package generate-xcodeproj

Open it up.

open NotationModel.xcodeproj/

The NotationModel package contains several modules:


Stars: 3


Used By

Total: 0


Support multiple Swift 5 compilers - 2019-08-15 16:19:31

Version 0.9.0 removes the usage of CollectionWrapping and RandomAccessCollectionWrapping, which stopped working properly as of Swift 5.0.1 or thereabouts.

Remove PitchSpeller implementation, add Codable conformance, remove linux for now, fix deprecated syntax - 2019-06-30 01:21:57

Swift 5 - 2019-06-12 16:35:53

Various updates to SpelledPitch ecosystem - 2018-11-03 19:07:56

Refine Pitch.Spelling - 2018-10-21 22:29:44

Refine Interval description - 2018-10-14 20:04:32

Update Music to version 0.3.0 - 2018-08-14 22:22:51

Use much better APIs for Duration, Rhythm, Meter, Tempo, and Dynamics.

Add Linux Support - 2018-08-13 14:24:11

Introducing Beaming Model - 2018-07-24 21:05:55