\version "2.21.0" myscore = #(define-scheme-function () () (ly:parser-include-string #{ "\score {\music \addlyrics { \words } \layout {}}" #})) % | | % I'd like to get rid of those curly brackets % % At some places the lilypond gammar does not allow to % use a MUSIC_FUNCTION instead of a MUSIC_IDENTIFIER or a % grouped_music_list. The solution is to use "{ \name }" % instead of "\name" in those cases. % If you use % % name = some_music_or_lyrics % % name is given the meaning that some_music_or_lyrics has at % the time of the definition. % % If you use % % \macro "name = some_music_or_lyrics" % % instead, name is defined to be a music function with the % meaning of some_music_or_lyrics at the time of its usage. macro = #(define-scheme-function (arg) (string?) (let* ( (index (string-index arg #\=)) (left (string-take arg index)) (right (string-drop arg (+ 1 index)))) (ly:parser-include-string (string-append left " = #(define-music-function () () #{ " right " #})" )))) musA = \relative { c'4 e d f g2 } musB = \relative { g'4 g a b c2 } musC = \relative { g'4 g f d c2 } musD = \relative { a'4 a a b c1 \bar "|." } lyrA = \lyricmode { A B C D E } lyrB = \lyricmode { F G H I J } lyrC = \lyricmode { f g h i j } lyrD = \lyricmode { V W X Y Z } \macro "music = \musA \musB \musD" \macro "words = \lyrA \lyrB \lyrD" \myscore musB = \musC lyrB = \lyrC \myscore