2.1 Lilypond code blocks

Lilypond code blocks look like

  #{ Lilypond code #}

They can be used anywhere where you can write Scheme code: the Scheme reader actually is changed for accommodating LilyPond code blocks and can deal with embedded Scheme expressions starting with $ and #.

It extracts the Lilypond code block and generates a call to the LilyPond parser which is executed at runtime to interpret the LilyPond code block. Any embedded Scheme expression is executed in the lexical environment of the Lilypond code block, so you have access to local variables and function parameters at the point the Lilypond code block is written.

A LilyPond code block may contain anything that you can use on the right side of an assignment. In addition, an empty LilyPond block corresponds to a void music expression, and a LilyPond block containing multiple music events gets turned into a sequential music expression.

Other languages: deutsch, español, français.
About automatic language selection.

LilyPond — Extending