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 01:48:33 -0700
User-agent: Roundcube Webmail/1.4.2

On 2020-08-11 1:08 am, Paul McKay wrote:
I'm working on transcribing some movements of an oratorio. In common with that genre, the same words (more or less) get repeated over and over again.
I'm trying to minimize both typing and errors and have come up with the
following which does most of what I want:

\version "2.20.0"

Lord = \markup \concat { "L" \smallCaps "ord" }
noSee = \lyricmode { Yet doth the \Lord see it not; }
mock = \lyricmode { He mock -- eth at us; }
curse = \lyricmode { His curse hath fal -- len down up -- on us; }

sopranoVerse = \lyricmode {
    %{p20%}  \mock \noSee \mock \mock \curse
}
I still need to type in explicit lyrics for when half-phrases are repeated. The real shortcoming is that the phrases actually tend to be followed by different punctuation. I've hard coded semicolons in this example, but I'd
like to be able to replace them with other things without doing much
typing. Making each one a function would be fine: something like \*curse ! *No problem putting punctuation after each one, but I'm only a beginner with
*define-music-function* and this isn't a music function.

Why would it not be a music function? Lyrics are music, after all. In particular, \lyricmode results in SequentialMusic consisting of LyricEvents.

Here is a function that modifies the text of the last LyricEvent, appending the specified punctuation:

%%%%
\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 (car (take-right elts 1)))
         (text (ly:prob-property last 'text)))
    (ly:prob-set-property! last 'text
      #{ \markup \concat { $text $punct } #})
    lyrics))

foo = \lyricmode { foo foo foo }

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


-- Aaron Hill

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


reply via email to

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