Extending guide#
This guide attempts to cover all the important techniques for extending LilyPond. As you will see, understanding them is very much concomitant with understanding how LilyPond works internally.
LilyPond also has an official Extending Manual. Sadly, it is nowhere near complete. The present guide serves as a substitute for the unwritten parts of the Extending Manual.
The guide is structured as follows:
First, a general introduction to extending, with examples of the fundamental tools, and an overview of how LilyPond works internally;
Details on the interplay between LilyPond and Scheme code, and the different ways of inserting Scheme in LilyPond;
A focus on music objects and how to create and transform them;
A jump forward in LilyPond’s compilation process, to the backend, explaining how grobs work and how to tweak them;
Finally, a jump back to the translation step, which is the bridge between music and the backend; this part reuses notions from the two previous parts.
- Introduction to extending
- LilyPond and Scheme
- Music objects
- Backend programming
- The translation process
- Overview
- Contexts
- Useful translation hooks
- Writing an engraver
- Basics
- The time step cycle
- Processing stream events
- Example for setting properties in pre-process-music:
Force_chord_at_bar_start_engraver
- Creating grobs
- Example for creating grobs:
Tacet_engraver
- Time management
- Example for using event lengths:
Auto_breathe_engraver
- Acknowledging grobs
- Example for acknowledging grobs:
Balloon_notes_engraver
- End acknowledgers
- Example for end acknowledgers:
No_break_during_tie_engraver
- Setting grob parents and spanner bounds
- Example for setting parents:
Auto_stanza_engraver
- Example for setting bounds:
Align_all_dynamics_engraver
- Killing grobs
- Example for killing grobs:
Voice_line_engraver
- Adding properties and types