Brought to you by NumFOCUS Foundation and O’Reilly Media
The official Jupyter Conference
Aug 21-22, 2018: Training
Aug 22-24, 2018: Tutorials & Conference
New York, NY

abjadcompile: Realtime Algorithmic Music Notation Preview in Atom via Jupyter and Hydrogen

Moderated by: Jeffrey Treviño, nCoda

The proposed poster describes the implementation of the abjadcompile Atom package, as well as the nCoda project of which it is a part, with helpful background summary of the LilyPond music typesetting application and the Abjad API for Formalized Score Control.

A package extension to the Atom text editor, abjadcompile injects kernel middleware into the Hydrogen package’s communications with a running Jupyter kernel to enable pre- and post-execution interaction with Atom and its packages. abjadcompile consumes and chains services from the Hydrogen and lilycompile packages to enable realtime music notation preview: after activating a Jupyter kernel via Atom’s Hydrogen package, the user aggregates music notation elements in Python with the Abjad API for Formalized Score Control and then executes the code with Hydrogen’s block and line execution capabilities; upon execution, abjadcompile’s kernel middleware intercepts calls to abjad’s `show()` function — which normally writes a lilypond music shorthand file, converts the result to a .pdf file, and displays the resulting .pdf in the OS’s default .pdf display application — and replaces them with calls to `abjad.persist()`, which writes a lilypond file without display and returns path to the resulting file; next, abjadcompile passes the lilypond file’s path, returned via the stdout stream, to the package’s consumed lilycompile service to render the lilypond file as a .pdf file and display the result in a new Atom editor pane. The resulting user experience is one of instantaneous, algorithmic generation and preview of music notation, entirely within the Atom editor.

abjadcompile is part of the nCoda project, an open-source initiative to explore the potentials of the Atom text editor as a Jupyter front-end for code-literate music composition and analysis.