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
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)
Click on any music notation you find in Abjad’s documentation to see its LilyPond source code.
You might notice that the music notation throughout Abjad’s documentation doesn’t quite look like what LilyPond produces out-of-the-box. There are a number of small differences. For example, all of the notes, chords and rests are spaced proportionally. There are no bar numbers. The glissandi are a little bit thicker than normal. Tuplet brackets show the tuplet ratio rather than a single number.
How does this happen? Our notation examples are generated as part of
Abjad’s doc-building process via a custom Sphinx extension housed in
To get the look-and-feel we want for our examples, we include a default
stylesheet in each generated file.
Not all examples are styled the same. When demonstrating LilyPond
overrides or page layout options we may replace Abjad’s default
documentation stylesheet with another stylesheet or disable documentation
stylesheets entirely. If, while examining the LilyPond source files in
Abjad’s documentation, you encounter
\include "..." statements in those
files, you can find the corresponding stylesheets in Abjad’s documentation
Now, let’s split the notes you just made every 5/16 duration, transpose every other split group up by a major-seventh, then slur every split group, and finally 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) ... >>> 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)
Many scores have been composed in whole or in part with the assistance of Abjad and LilyPond. Here are excerpts from a few such works.
Traiettorie inargentate (2013)¶
Invisible Cities (iii): Ersilia (2015)¶
- For chamber orchestra.
- Composed by Josiah Wolf Oberholtzer.
- Written for Ensemble Dal Niente.
- Source available from https://github.com/josiah-wolf-oberholtzer/ersilia/.
Visit our score gallery for many more examples:
- Score gallery
- Al-kitab al-khamr (2015)
- Invisible Cities (iii): Ersilia (2015)
- Ins wasser eingeschrieben (2015)
- Invisible Cities (ii): Armilla (2015)
- Refrain (2014)
- Huitzil (2014)
- Invisible Cities (i): Zaira (2014)
- Krummzeit (2014)
- Plague Water (2014)
- The World All Around (2012-13)
- Traiettorie inargentate (2013)
- Cartography (2013)
- Aurora (2011)
- L’archipel du corps (2011)
- L’imaginaire (2010)
- Lagartija (2010)
- Mon seul désir (2009)
- Lidércfény (2008)
- Sekka (2007)
- Čáry (2006)
- Poème Récursif (2005)
July 11-15, 2016 | Palo Alto, CA
Introduction to the production of professionally engraved musical scores using the Python programming language and the Abjad API for Formalized Score Control as part of compositional practice.
The course introduces Abjad’s object-oriented approach to music notation and algorithmic composition through real-world examples and hands-on coding activities. No previous programming experience is required. Python basics will be taught from the ground up during the course with musical examples designed to make sense to composers.
Topics covered include:
- system installation and configuration,
- defining your own functions, classes and modules,
- generating structured tableaux of rhythms, pitch collections and other materials during precomposition,
- managing polyphony with operations on voices, staves and other musical containers,
- working with parametric score layout,
- understanding the document structure of complex scores, and
- controlling the details of musical typography programmatically.
Taught by Jeff Treviño, Trevor Bača, and Josiah Wolf Oberholtzer.
For information on the Women in Computer Music Scholarship for the Formalized Score Control workshop, please visit this page.
Texts on Abjad¶
A number of papers and dissertations discuss Abjad.
- Bača, Trevor, Josiah Wolf Oberholtzer, Jeffrey Treviño and Vıctor Adán. “Abjad: An Open-Software System For Formalized Score Control.” Proceedings of the First International Conference on Technologies for Music Notation and Representation. 2015.
- Oberholtzer, Josiah Wolf. A Computational Model of Music Composition. Doctoral dissertation, Harvard University, Graduate School of Arts & Sciences. 2015.
- Trevino, Jeffrey Robert. Compositional and analytic applications of automated music notation via object-oriented programming. Doctoral dissertation, University of California, San Diego. 2013.
Abjad lets you:
- Create musical notation in an object-oriented way.
- Model compositional thinking computationally.
- Generate and transform complex rhythms 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:
- For beginners
- Literature examples
- The new Abjad cookbook
- 1. Mapping patterns to notation
- 2. Selecting musical objects morphophologically
- 3. Splitting and fusing musical objects
- 4. Swapping objects in and out of scores
- 5. Creating tables of chords
- 6. Interpolating between chords
- 7. Creating custom musical symbols with markup
- 8. Spacing music proportionally
- 9. Creating floating time signatures
- 10. Creating annotation-aware spanners
- 11. Typesetting parametric staves
- 12. Creating complex rhythms with rhythm-makers
- 13. Modeling texture music with timespans
- 14. Creating texture music with timespans
- 15. Creating fragmented scores
- 16. Setting up a new score project
- 17. Working with score templates and LilyPond concatentation
- 18. Working with LilyPond stylesheets
- 19. Preparing complex documents with Abjad, LilyPond and LaTeX
- 20. Templating and persisting complex objects
- 21. Creating graphs
- The old Abjad cookbook
- Core concepts
- Reference manual
Abjad’s codebase in detail¶
- Abjad API