Skip to content
Switch branches/tags
This branch is 84 commits ahead, 1 commit behind sshelagh/ob-lilypond:master.

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


(Score Engraving and Arrangement in Emacs OrgMode)



An Emacs org-babel language - provided to allow LilyPond Music Score generation, complete with optional auditioning via midi, whilst leveraging the full power of org mode, and literate programming.


There are two modes available with ob-lilypond

  • basic-mode (default)

  • arrange-mode

Which you use depends on what you intend to do.

Basic Mode

Basic mode (the default) allows you to embed LilyPond snippets into an org mode file, and compile and export them using typical Org mode commands. This is useful if you want to mix blocks of lilypond-generated score with text, and perhaps other images, for export to latex, docbook, pdf, or html.

Following are some examples generated in ob-lilypond Basic Mode...

  • Here is an example of a pdf file containing high quality vector graphics generated by org mode and ob-lilypond.

  • and the org file that compiled the LilyPond snippets and exported the pdf.

  • Here is an example of an html page containing images (png) generated by org mode and ob-lilypond.

  • and the org file that compiled the LilyPond snippets and exported the html page.

Compiling LilyPond Blocks

In Basic Mode Hitting 'C-c C-c' within a lilypond block will compile the block. Exporting of all blocks and org file contents is initialted with 'C-c C-e' (standard org mode export keys).

Arrange Mode

Arrange Mode allows you to develop complete pieces of score, whilst organising sections of the piece in typical org mode ways. And because you are in Emacs org mode, you are free to use literate programming techniques to generate things programmatically / store information in tables etc. In addition, there are automated features to automatically audition the piece (via MIDI) and or display the resultant pdf output.

To change the default mode to Arrange Mode, put the following in your emacs init file...

(setq ly-arrange-mode t)

...or to temporarily switch between modes use the command M-x ly-toggle-arrange-mode

Following are examples generated using ob-lilypond in Arrange Mode...

Tangling and Compiling LilyPond Blocks

In Arrange Mode, hitting 'C-c C-c' within a lilypond block initiates ly-tangle (tangling of all lilypond blocks). Depending on the feature settings, ob-lilypond will then either display a pdf of the score, play the generated midi file, both, or neither.

M-x ly-tangle can also be called from anywhere in the file and can be tied to a function key with something like...

(global-set-key [f8] 'ly-tangle)

Some commands are included in Arrange Mode to quickly disable / enable certain post-tangle activities, including...

  • ly-toggle-midi-play (toggle whether midi will be played following a successful compilation)
  • ly-toggle-pdf-display (toggle whether pdf will be displayed following a successful compilation)

NOTE:- If using Timidity for midi playback, kill the midi stream with C-g in Emacs


To use ob-lilypond, you must be on a very recent version of org-mode, since it relies on a command that has been changed very recently and will break on older versions (ob-lilypond is also included in the latest org-mode by default).

For information on obtaining the latest org-mode follow this link to the Emacs Org Mode Manual and follow the instructions.

Then, add lilypond to your list of babel languages (in your init file)...

'((ruby . t)
  (C . t)
  (emacs-lisp . t)
  (sh t)
  (dot t)
  (clojure t)
  (ditaa t)
  (lilypond t)))

To ensure all is correct consider running the tests (see below)


Mac OS X



  • Currently untested


Tests are provided and can be run by opening testing/lisp/test-ob-lilypond.el and running the following commands...

  • M-x eval-buffer (within testing/lisp/test-ob-lilypond.el)
  • M-x ert (t)


Any issues should be reported to the Emacs Org Mode Mailing-list


org-babel lilypond language module






No releases published


No packages published