Abjad (2.16)

GitHub | PyPI | Documentation | Mailing list | Issue Tracker | Travis-CI


Abjad helps composers build up complex pieces of music notation in an iterative and incremental way. Use Abjad to create symbolic representations of all the notes, rests, staves, tuplets, beams and slurs in any score. Because Abjad extends the Python programming language, you can use Abjad to make systematic changes to your music as you work. And because Abjad wraps the powerful LilyPond music notation package, you can use Abjad to control the typographic details of the symbols on the page.


1. Get Abjad and LilyPond

Get Abjad via pip:

~$ sudo pip install abjad

Get LilyPond from http://lilypond.org/development.html.

Consult our installation instructions for detailed help on getting Abjad, setting it up, and installing any dependencies like LilyPond:

2. Make notation

Start your Python interpreter and import Abjad:

>>> from abjad import *

First make eight 1/4 notes, rising by half-step from C to G:

>>> duration = Duration(1, 4)
>>> notes = [Note(pitch, duration) for pitch in range(8)]
>>> staff = Staff(notes)
>>> show(staff)

That’s nice, but a little bland.

Let’s split the notes you just made every 5/16, transpose every other split group up by a major-seventh, slur every split group, and attach an accent to the first note of each split group:

>>> shards = mutate(staff[:]).split(
...     durations=[Duration(5, 16)],
...     cyclic=True,
...     tie_split_notes=False,
...     )
>>> for index, shard in enumerate(shards):
...     if index % 2:
...         mutate(shard).transpose('M7')
...     attach(Slur(), shard)
...     attach(Articulation('accent'), shard[0])
>>> show(staff)

That looks a little more intriguing, doesn’t it?

Now let’s create a second staff, copied from the first, invert all of the new staff’s pitches around middle-G, and finally group both staves into a staff group:

>>> copied_staff = mutate(staff).copy()
>>> staff_group = StaffGroup([staff, copied_staff])
>>> for note in iterate(copied_staff).by_class(Note):
...     note.written_pitch = note.written_pitch.invert(axis='G4')
>>> show(staff_group)

Explore Abjad’s documentation to find even more ways you can create and transform notation with Python, LilyPond and Abjad.

Texts on Abjad

A number of papers and dissertations discuss Abjad.


Abjad lets you:

  • Create musical notation in an object-oriented way.
  • Model compositional thinking computationally.
  • Generate and transform complex rhythmic through rhythm-makers, meter-rewriting and quantization.
  • Construct powerful component selectors for locating musical objects in a score.
  • Parse LilyPond and RTM syntax into musical objects.
  • Control all of the typographic details of music notation.
  • Embed musical notation in IPython notebooks, LaTeX and Sphinx documents.

Explore the high-level overview of Abjad’s concepts or our tutorials and examples to see these features in action: