lilypond-user
[Top][All Lists]
Advanced

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

Re: Text in alternative endings


From: Thomas Morley
Subject: Re: Text in alternative endings
Date: Wed, 24 Jan 2018 10:54:36 +0100

2018-01-24 0:11 GMT+01:00 David Kastrup <address@hidden>:
> Ralph Palmer <address@hidden> writes:
>
>> Hi -
>>
>> I'm running LilyPond 2.19.80 with Frescobaldi 2.18.1 under Linux/Ubuntu.
>>
>> I'm trying to substitute text for the numbers in alternative endings. I've
>> struggled with this before. I've tried looking in the Notation Reference
>> and in the Snippet Repository. I'm attaching the closest I've been able to
>> come to what I want.
>>
>> I have a partial measure at the beginning, before the repeat.
>> I'd like to get rid of the end-repeat sign at the beginning of the first
>> alternative.
>> The notes are all there, where they're supposed to be.
>> The "1., etc." for the first alternative is just the way I'd like it.
>> However, the bracket for the first alternative closes the repeat structure,
>> and there is no enclosure or text for the second alternative.
>>
>> This is not intuitive to me.
>>
>> Can someone please help me solve this?
>
> Look up the syntax of \alternative maybe?  It only allows _one_
> brace-enclosed sequential music expression.  Every expression in this
> sequential music expression is one alternative.  In particular, your
> \set-command, not being included in any other expression, is an
> alternative of its own.
>
> --
> David Kastrup



Hi Ralph,

as David already said rereading the docs about \alternative-syntax
would help, also the section about manual repeats.

Correct syntax for pure manual repeats would be:

\version "2.19.80"

voltaFinal = \markup \text { Last time }
voltaEtc = \markup { 1., \text { etc. } }

tune =
\relative c' {
  \clef treble
  \key c \major
  \time 3/4
  \partial 4 { d'4 } |
  \set Score.repeatCommands = #'(start-repeat)
  g4. f8 f4 |
  \set Score.repeatCommands = #(list (list 'volta voltaEtc))
  d4 f g |
  a4 b4. a8 |
  \set Score.repeatCommands =
    #(list (list 'volta #f) (list 'volta voltaFinal) 'end-repeat)
  d,4 e f |
  g4 r4 \bar "|."
  \set Score.repeatCommands = #'((volta #f))
}

\score {
  \tune
}

Also possible is the combination of default \repeat volta and
\alternative with manual settings, although it leads actually to
duplicates:

tune =
\relative c' {
  \clef treble
  \key c \major
  \time 3/4
  \partial 4 { d'4 } |
  \repeat volta 2 {
    \set Score.repeatCommands = #'(start-repeat)
    g4. f8 f4 |
  }
  \alternative {
    {
      \set Score.repeatCommands = #(list (list 'volta voltaEtc))
      d4 f g |
      a4 b4. a8 |
    }
    {
      \set Score.repeatCommands =
        #(list (list 'volta #f) (list 'volta voltaFinal) 'end-repeat)
      d,4 e f |
      g4 r4 \bar "|."
      \set Score.repeatCommands = #'((volta #f))
    }
  }
}

\score {
  \tune
}

Though, IIUC, you only want to change the text of the VoltaBrackets,
Why not apply an override like:

tune =
\relative c' {
  \clef treble
  \key c \major
  \time 3/4

  \partial 4 { d'4 } |
  \repeat volta 2 {
    g4. f8 f4 |
  }
  \alternative {
    {
      \once \override Score.VoltaBracket.before-line-breaking =
        #(lambda (grob) (ly:grob-set-property! grob 'text voltaEtc))
      d4 f g |
      a4 b4. a8 |
    }
    {
      \once \override Score.VoltaBracket.before-line-breaking =
        #(lambda (grob) (ly:grob-set-property! grob 'text voltaFinal))
      d,4 e f |
      g4 r4 \bar "|."
    }
  }
}

\score {
  \tune
}


@David
The most common use-case for using manual repeats seems to be the wish
to change the VoltaBracket-text.
Shouldn't we document the before-line-breaking-override as shown above
somewhere and let the manual repeat-commands for doing more
complicated stuff?

Cheers,
  Harm



reply via email to

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