lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Making lyrics quicker


From: Aaron Hill
Subject: Re: Making lyrics quicker
Date: Tue, 11 Aug 2020 02:03:43 -0700
User-agent: Roundcube Webmail/1.4.2

On 2020-08-11 1:57 am, Aaron Hill wrote:
On 2020-08-11 1:48 am, Aaron Hill wrote:
         (last (car (take-right elts 1)))

And in my haste to reply, I overlooked simplifying the car/take-right
1 to being just a call to the SRFI-1 "last" procedure:

         (last (last elts))

Though, I probably should pick a better local variable name than
"last".  Even though the compiler does the right thing, such usage
could be prone to misunderstanding.

Minimally improved version here that also demonstrates that lyric hyphens work:

%%%%
\version "2.20.0"

#(define (lyrics? x)
  (and (ly:music? x)
       (music-is-of-type? x 'sequential-music)
       (every (music-type-predicate '(lyric-event))
              (ly:prob-property x 'elements))))

addPunct = #(define-music-function
  (lyrics punct)
  (lyrics? markup?)
  (let* ((elts (ly:prob-property lyrics 'elements))
         (last-elt (last elts))
         (text (ly:prob-property last-elt 'text)))
    (ly:prob-set-property! last-elt 'text
      #{ \markup \concat { $text $punct } #})
    lyrics))

foobarbaz = \lyricmode { foo -- bar baz }

\new Voice \fixed c' { g8 fis g4 a4. b8 | c'1 }
\addlyrics { \addPunct \foobarbaz "," \addPunct \foobarbaz "!" }
%%%%


-- Aaron Hill

Attachment: lyric-add-punct.cropped.png
Description: PNG image


reply via email to

[Prev in Thread] Current Thread [Next in Thread]