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 cis e fis g }

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). This is convenient since you can just
insert \displayLilyMusic into existing music in order to get
information about it. If you don’t actually want Lilypond to
interpret the displayed music as well as display it, use \void
in order to have it ignored: