Jump to content

Parenthesize a group of notes using a Scheme function

From LilyPond wiki

This scheme code puts parentheses around a group of notes.

See also Parenthesize note heads using a Scheme function and the commands \startOptionalMaterial and \stopOptionalMaterial.

\version "2.24"

startParenthesis =
  \once \override Parentheses.stencils =
    #(lambda (grob)
       (let ((par-list (parentheses-interface::calc-parenthesis-stencils grob)))
         (list (first par-list) point-stencil)))

endParenthesis =
  \once \override Parentheses.stencils =
    #(lambda (grob)
       (let ((par-list (parentheses-interface::calc-parenthesis-stencils grob)))
         (list point-stencil (second par-list))))

{
  \override Parentheses.font-size = #5
  \startParenthesis <c \parenthesize c'>
  d' e' f'
  \endParenthesis \parenthesize g'
}