Greetings Pierre, Thank you so much for your solutions! It took me a while to realize that I in fact needed to upgrade to 2.19.35 in order to implement them, but once squared away, they worked magnificently. True, the latter approach is especially hackish, but I did find it much easier to comprehend exactly what was going on. Thank you again!
Hwaen Ch'uqi On 1/21/16, Pierre Perol-Schneider <pierre.schneider.pa...@gmail.com> wrote: > E.g.: > > \version "2.19.35" > > compressPercentRepeat = > #(define-music-function (repeats notes) (integer? ly:music?) > (let* ( > (mea (ly:music-length notes)) > (num (ly:moment-main-numerator mea)) > (den (ly:moment-main-denominator mea)) > (dur (ly:make-duration 0 0 (* num (1- repeats)) den))) > #{ > #notes > \set Score.restNumberThreshold = #1 > \set Score.skipBars = ##t > \temporary\override MultiMeasureRest.stencil = > #ly:multi-measure-rest::percent > \temporary\override MultiMeasureRestNumber.stencil = > #(lambda (grob) > (grob-interpret-markup grob > (markup #:concat > ( ;; Optional: > ;#:fontsize -3 "x" > #:fontsize -2 (number->string repeats))))) > \temporary\override MultiMeasureRest.thickness = #0.48 > \temporary\override MultiMeasureRest.Y-offset = #0 > #(make-music 'MultiMeasureRestMusic 'duration dur) > \revert MultiMeasureRest.Y-offset > \revert MultiMeasureRest.thickness > \revert MultiMeasureRestNumber.stencil > \revert MultiMeasureRest.stencil > \unset Score.skipBars > \unset Score.restNumberThreshold > #})) > > %%%% Test: > soloInstrumentOne = \relative { > \time 4/4 > c'4 c c c > \compressPercentRepeat #8 { c'4 c c c } > \break > c,4 c c c > \bar "|." > } > > soloInstrumentTwo = \relative { > \repeat unfold 10 { c''4 c c c } > } > > \markup\italic "Orchestral score:" > \score { > \new StaffGroup << > \new Staff > \with { instrumentName = "Inst 1" } > \soloInstrumentOne > \new Staff > \with { instrumentName = "Inst 2" } > \soloInstrumentTwo > >> > } > > \markup\italic "Solo score:" > \score { > \new Staff > \with { instrumentName = "Inst 1" } > \soloInstrumentOne > } > > \layout { > ragged-last = ##t > } > > > Cheers, > Pierre > > 2016-01-19 12:44 GMT+01:00 Pierre Perol-Schneider < > pierre.schneider.pa...@gmail.com>: > >> BTW, another hacky solution would be to use \compressFullBarRests and >> simply change its stencil with the 'percent' sign. >> Not nice though. >> ~Pierre >> >> 2016-01-19 12:27 GMT+01:00 Pierre Perol-Schneider < >> pierre.schneider.pa...@gmail.com>: >> >>> 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 <hwaench...@gmail.com>: >>> >>>> 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 >>>> lilypond-user@gnu.org >>>> https://lists.gnu.org/mailman/listinfo/lilypond-user >>>> >>> >>> >> > _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user