3.6.1 Displaying LilyPond notation

Displaying a music expression in LilyPond notation can be done with the music function \displayLilyMusic. To see the output, you will typically want to call LilyPond using the command line. For example,

  \displayLilyMusic \transpose c a, { c4 e g a bes }

will display

{ a,4 cis4 e4 fis4 g4 }

By default, LilyPond will print these messages to the console along with all the other LilyPond compilation messages. To split up these messages and save the results of \displayLilyMusic, redirect the output to a file.

lilypond file.ly >display.txt

Note that LilyPond does not just display the music expression, but also interprets it (since \displayLilyMusic returns it in addition to displaying it). Just insert \displayLilyMusic into the existing music in order to get information about it.

To interpret and display a music section in the console but, at the same time, remove it from the output file use the \void command.

  \void \displayLilyMusic \transpose c a, { c4 e g a bes }

LilyPond — Notation Reference v2.21.82 (development-branch).