lilypond-user
[Top][All Lists]
Advanced

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

Re: parameters in lyrics?


From: Simon Albrecht
Subject: Re: parameters in lyrics?
Date: Fri, 4 Dec 2015 09:13:49 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0

On 03.12.2015 18:04, David Nalesnik wrote:


On Thu, Dec 3, 2015 at 10:54 AM, David Nalesnik <address@hidden <mailto:address@hidden>> wrote:

    Hi,

    On Thu, Dec 3, 2015 at 10:35 AM, Urs Liska <address@hidden
    <mailto:address@hidden>> wrote:



        Am 03.12.2015 um 17:30 schrieb Graham King:
        On Thu, 2015-12-03 at 17:12 +0100, Urs Liska wrote:


        Am 03.12.2015 um 17:10 schrieb Graham King:

        On Thu, 2015-12-03 at 16:57 +0100, Urs Liska wrote:
        Ah, forgot: the ending function would also have to be
        written before the syllable, so

        Three \foo deaf and \bar blind mice are \foobar alive.

        should return

        Three [deaf and blind] mice are [alive]

        Uh, no.  I'd like it to return
            Three [deaf and] blind mice are [alive]

        That's the bit I'm struggling with.

        You can't do that (I think). But I don't see a problem with
        writing the function before the syllable.
        Or what am I missing?
        I've got a lot of music with

        foo = \override LyricText.font-shape = #'italic
        bar = \revert LyricText.font-shape

        and I'd like to redefine foo and bar to replace the italics
        with [bracketed text].  And to switch between italics and
        brackets easily.

        To achieve that it doesn't matter if the function is placed
        before or after the syllable.
        Your function has to merge the syllable with the surrounding
        (be it a bracket or an \override) anyway, so you can handle
        the pre-/postfix issue within the function itself.

        But as I wrote in another reply (with full code example) I
        don't know how to mix music and lyrics inside that function.
        But surely someone else can help with that.


    This looks too hideous to be the right way, but...


 Yes, my sense was right

Maybe I'm missing something, but wouldn't the following suffice?

\version "2.19.21"

start =
#(define-scheme-function (parser location syllable)(markup?)
   (format "[~a" syllable))

start = \override LyricText.color = #red

end =
#(define-scheme-function (parser location syllable)(markup?)
   (format "~a]" syllable))

end = \revert LyricText.color

It should work (untested, though) with
end =
#(define-music-function (parser location syllable)(markup?)
  #{
    (make-music
      'LyricEvent
      'text
      syllable
      'duration
      (ly:make-duration 2))
    \revert LyricText.color
  #})

We hit the same problem as in the other recent thread though: this only works with \lyricsto or \addlyrics due to the hardcoded duration.

HTH, Simon


wrap =
#(define-scheme-function (parser location syllable)(markup?)
   (format "[~a]" syllable))

wrap = \once \override LyricText.color = #red

theNotes = {
  \relative { e''1 d c d e }
}

theWords = \lyricmode {
  Three \start blind \end mice are \wrap alive
}

\score
{
  \new StaffGroup
  <<
    \new Voice = "voice" \theNotes
    \new Lyrics \lyricsto "voice" \theWords
  >>
}

(Just comment out the definitions you don't want.)

--David


_______________________________________________
lilypond-user mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/lilypond-user




reply via email to

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