lilypond-user
[Top][All Lists]
Advanced

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

Re: Repeat volta not at beginning of piece doesn't get initial repeat ba


From: Thomas Morley
Subject: Re: Repeat volta not at beginning of piece doesn't get initial repeat bar line
Date: Mon, 14 Jul 2014 19:00:58 +0200

2014-07-14 18:47 GMT+02:00 Thomas Morley <address@hidden>:
> 2014-07-14 14:03 GMT+02:00 John McWilliam <address@hidden>:

> I'd not mix \repeat volta ... and \alternative ... with manual repeat 
> settings.

Correction, you _can_ mix them, _if_ you use correct syntax.
Though, it's a little complicated I think.
Therefore I made the following code sometime ago (and had completely
forgotten about it):

\version "2.16.2"

setRepeatCommand =
#(define-music-function (parser location arg)(scheme?)
#{
  \applyContext #(lambda (ctx)
   (let* ((where (ly:context-property-where-defined ctx 'repeatCommands))
          (repeat-commands (ly:context-property where 'repeatCommands))
          (to-append
            (cond ((symbol? arg)
                   (list arg))
                  ((or (boolean? arg) (markup? arg))
                   (list (list 'volta arg)))
                  (else '())))
          (appended-settings (append repeat-commands to-append)))

    ;(newline)
    ;(display appended-settings)
    ;(newline)

    (ly:context-set-property! where 'repeatCommands appended-settings)))
#})

%% maybe:
% #(allow-volta-hook "|")


startRepeat = \setRepeatCommand #'start-repeat
endRepeat = \setRepeatCommand #'end-repeat
startVolta-I = \setRepeatCommand #"1."
startVolta-II-IV = \setRepeatCommand \markup \fontsize #3 "2. - 4."
endVolta = \setRepeatCommand ##f

\relative c' {

        a1
        \startRepeat
        b
        \startVolta-I
        c
        \endRepeat
        \endVolta
        \startVolta-II-IV
        d
        \endVolta
        e
}

voltaOne = \setRepeatCommand \markup { \text \fontsize #2 \bold "1.– " }
voltaTwo = \setRepeatCommand \markup { \text \fontsize #2 \bold "Fine" }

\relative c'' {
  \time 4/2
  \repeat volta 2 {
    f2 g a4. (g8 f4) e
  }
  \alternative {
    {
      \voltaOne
      d\breve
    }
    {
      \endVolta
      \endRepeat
      \voltaTwo
      d\breve
    }
  }
  \bar "|."
}

Cheers,
  Harm



reply via email to

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