lilypond-user
[Top][All Lists]
Advanced

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

Re: Compressing percent repeats.


From: Pierre Perol-Schneider
Subject: Re: Compressing percent repeats.
Date: Tue, 19 Jan 2016 12:27:57 +0100

Hi Hwaen Ch'uqi,

Far from being perfect but it's a start:

\version "2.19.35"

compressPercent =
#(define-music-function (repeats notes) (integer? ly:music?)
  #{
    \tag Orch {
    %% Optional:
    %\set countPercentRepeats = ##t
    \repeat percent #repeats \absolute { #notes } 
    }
    \tag Solo {
      \repeat percent 2 {
        \set countPercentRepeats = ##t
        \override PercentRepeatCounter.stencil = #(lambda (grob)
           (grob-interpret-markup grob
             (markup #:concat
               ( ;; Optional:
                 #:fontsize -3 "x"
                 (number->string repeats)))))
        #notes
        \applyContext #(lambda (c)
                          (set! (ly:context-property
                                 (ly:context-find c 'Timing)
                                 'currentBarNumber)
                           (+ (- repeats 2) (ly:context-property c 'currentBarNumber))))
      }
    }
#})

soloInstrumentOne = \relative {
  c' c c c
  \compressPercent 8 \relative { c''4 c c c } 
  \break
  c4 c c c
  \bar "|."
}

soloInstrumentTwo = \relative {
  \repeat unfold 10 { c''4 c c c } 
}

%%% Orchestral score %%%
\score {
  \new StaffGroup <<
    \new Staff
      \with { instrumentName = "Inst 1" }
      \keepWithTag Orch\soloInstrumentOne
    \new Staff
      \with { instrumentName = "Inst 2" }  
      \soloInstrumentTwo
  >>
}

%%% Solo score %%%
\score {
  \new Staff
    \with { instrumentName = "Inst 1" }
    \keepWithTag Solo\soloInstrumentOne
  }


HTH,
Cheers,
Pierre

2016-01-19 3:46 GMT+01:00 Hwaen Ch'uqi <address@hidden>:
Greetings All,

I am generating parts from an orchestral score and am wondering if
there is any way of handling percent repeats in the same manner as
\compressFullBarRests does for multimeasure rests? That is, a number
would be placed above, say, an isolated repeat informing the player
how many times to repeat the measure; meanwhile, currentBarNumber
would be automatically updated. I see from this thread

https://lists.gnu.org/archive/html/lilypond-user/2014-02/msg00050.html

that text could be placed manually (though not optimally) above the
isolated repeat, and so too could I manually reset currentBarNumber,
but that will surely prove to be time-consuming for a piece of this
magnitude. Any help would be greatly appreciated.

Hwaen Ch'uqi

_______________________________________________
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]