Le 09/10/2021 à 21:47, David F. a écrit :
I did notice that the \markup defeats lyric ties.

You can special-case bare strings to return a string:

\version "2.22.1"

openQuote =
#(define-scheme-function (text) (markup?)
   (if (string? text)
       (string-append "“" text)
       #{ \markup \concat { “ #text } #}))

closeQuote =
#(define-scheme-function (text) (markup?)
   (if (string? text)
       (string-append text "”" text)
       #{ \markup \concat { #text ” } #}))

\relative { \time 3/4 e'4 e4. e8 d4 e d c2. }
\addlyrics { \openQuote O~In -- com -- pa --  ra -- \closeQuote ble, said she }


It’s not a big deal—that combo only occurs once in the songs I have.  But now 
I’m curious.  What do lyric syllables get turned into?  A LyricEvent?  Is it 
possible to build and return a LyricEvent from a function?

Yes. Add \displayMusic before any music to see
how it could be built in Scheme. The code might
look like

openQuote =
#(define-music-function (lyric-event) (ly:music?)
   (display-scheme-music lyric-event)
   (make-music 'LyricEvent
               lyric-event
               'text
               (let ((text (ly:music-property lyric-event 'text)))
                 (if (string? text)
                     (string-append "“" text)
                     #{ \markup \concat { “ #text } #}))))

The following pages contain some explanations that
may be useful:

https://lilypond.org/doc/v2.22/Documentation/extending/building-complicated-functions
https://extending-lilypond.readthedocs.io/en/latest/music.html#constructing-music-from-scratch

Best,
Jean

Reply via email to