Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Serialize and notate music using LilyPond.
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.



Author: Jonathan Marmor


A simple object model for representing music notation, with a corresponding YAML format for serialization and easy editing. Generates LilyPond input files and PDFs of music notation that are highly customized for the house style of publisher Éditions musique SISYPHE (

musicob/test/sample_output.pdf is an example of notation generated by MusicOb.

  • is the main application and can be imported as a python library or used from the command line.
  • is a standalone module for converting MusicOb-generated LilyPond files into PDF that can also be used as a library or from the command line.
  • contains fragments of LilyPond input files, with huge parts hardcoded to a format that works for Éditions musique SISYPHE. There is probably a much more elegant way to do this, but this works, despite being inflexible.


A Minimal example of making a piece: one movement, one instrument, one note. Normally you would probably generate the music algorithmicly and/or type the metadata into the piece.yaml file.

>>> import os
>>> import notation
>>> here = os.path.dirname(os.path.abspath(notation.__file__))
>>> target = os.path.join(here, 'test', 'output')
>>> p = notation.Piece()
>>> p.title = 'The Star Spangled Banner'
>>> p.composer = 'John Stafford Smith'
>>> p.emsis_number = 12345 # Publisher's serial number
>>> p.filename = 'star_spangled'
>>> m = notation.Movement()
>>> p.movements = [m]
>>> m.title = 'The Only Movement'
>>> m.number = 1
>>> m.folder = 'mv1'
>>> m.tempo_duration = 4 # quarter note = 60
>>> m.tempo_bpm = 60
>>> i = notation.Instrument()
>>> m.instruments = [i]
>>> = 'Clarinet'
>>> i.musician = 'Katie'
>>> i.short_name = 'cl'
>>> i.midi_name = 'clarinet'
>>> i.clef = 'treble'
>>> i.transpose_from_middle_c = "bes,"
>>> n = notation.Note()
>>> i.notation = [n]
>>> n.pitches = "<d' >"
>>> n.rehearsal_mark = 'A'
>>> = 1
>>> n.time_signature_numerator = 4
>>> n.time_signature_denominator = 4
>>> n.duration = 1
>>> n.dynamic = 'f'

Write YAML, LilyPond, PDF, and MIDI files of this little piece.

>>> paths = p.write(target, yaml=True, ly=True, pdf=True, score=True, parts=True, midi=True)

If you already have MusicOb YAML files, you can make LilyPond, PDF, and MIDI files from the command line.

$ python musicob/ /path/to/yaml/files /path/for/output

If you have MusicOb LilyPond files you can make PDF and MIDI files from the command line.

$ python musicob/ /path/to/lilypond/files /path/for/output piece_file_name --score --parts

To run the doctests for

$ python musicob/ musicob/test/yaml_source musicob/test/output --test


  • Python 2.7 (
  • PyYaml (
  • LilyPond ( [Currently hard coded to v2.12.3 but could easily be changed.]
  • For music formatting to look right the fonts Granjon and Minion need to be installed and, if I remember correctly, registered with LilyPond in some way.
  • MusicOb has only been tested on Mac OS X.


  • Doesn't support tuplets of any kind.
  • Doesn't support grand staves.
  • Many other basic features of music haven't been implemented because I haven't needed them yet, such as temporary octave transpositions.
Something went wrong with that request. Please try again.