Re: Compressing percent repeats.

2016-01-22 Thread Michael Gerdau
> Well actually I've hesitated to do that. It depends on how you read it. I
> finally choose to stick to :
> 
> \version "2.19.35"
> 
> \relative c'' {
>   \set countPercentRepeats = ##t
>   \repeat percent 8 { c1 }
> }

I see - in light of that it makes sense.

> But ok, it's a personal choice, maybe not the best.

I'm in no position to decide this either way.
I just would have played it wrongly as I would have interpreted the
number the same way as for \compressFullBarRests 

But that may very well just be me not knowing how to properly read
these compressed bars. 

In any case:
Nice function and thank you for sharing it.

Kind regards,
Michael
-- 
 Michael Gerdau   email: m...@qata.de
 GPG-keys available on request or at public keyserver

signature.asc
Description: This is a digitally signed message part.
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Compressing percent repeats.

2016-01-22 Thread Pierre Perol-Schneider
Hi Michae,

Well actually I've hesitated to do that. It depends on how you read it. I
finally choose to stick to :

\version "2.19.35"

\relative c'' {
  \set countPercentRepeats = ##t
  \repeat percent 8 { c1 }
}

But ok, it's a personal choice, maybe not the best.

Cheers,
Pierre

2016-01-22 23:59 GMT+01:00 Michael Gerdau :

> Hi Pierre,
>
> > \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)
>
> Shouldn't this be
> #:fontsize -2 (number->string (- repeats 1))
>
> > \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
> > }
>
> Kind regards,
> Michael
> --
>  Michael Gerdau   email: m...@qata.de
>  GPG-keys available on request or at public keyserver
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Compressing percent repeats.

2016-01-22 Thread Michael Gerdau
Hi Pierre,

> \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)

Shouldn't this be
#:fontsize -2 (number->string (- repeats 1))

> \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
> }

Kind regards,
Michael
-- 
 Michael Gerdau   email: m...@qata.de
 GPG-keys available on request or at public keyserver

signature.asc
Description: This is a digitally signed message part.
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Compressing percent repeats.

2016-01-22 Thread Hwaen Ch'uqi
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  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 :
>>>
 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 inf

Re: Compressing percent repeats.

2016-01-21 Thread Pierre Perol-Schneider
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 :
>>
>>> 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
>>>

Re: Compressing percent repeats.

2016-01-19 Thread Pierre Perol-Schneider
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 :
>
>> 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


Re: Compressing percent repeats.

2016-01-19 Thread Pierre Perol-Schneider
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 :

> 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