lilypond-user
[Top][All Lists]
Advanced

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

Re: synchronizing other parts w/cadenza


From: Thomas Morley
Subject: Re: synchronizing other parts w/cadenza
Date: Thu, 19 Jan 2012 00:55:17 +0100

Hi Neil,

2012/1/18 Neil Puttock <address@hidden>:
> On 18 January 2012 01:01, Thomas Morley <address@hidden> wrote:
>
>> I worked a little more in the direction you objected.
>>
>> \version "2.15.24"
>>
>> cadenzaRest =
>> #(define-music-function (parser location fermata? music) (boolean? ly:music?)
>>  "Make a full-bar rest with the same length as MUSIC
>>  setting measureLength to ensure the rest is properly centred.
>>  A fermata can be set."
>>  (let ((fermata (make-music 'MultiMeasureTextEvent
>>                             'tweaks (list
>>                                      ;; Set the 'text based on the 'direction
>>                                      (cons 'text (lambda (grob)
>>                                                    (if (eq?
>> (ly:grob-property grob 'direction) DOWN)
>>                                                        (markup
>> #:musicglyph "scripts.dfermata")
>>                                                        (markup
>> #:musicglyph "scripts.ufermata"))))
>>                                      (cons 'outside-staff-priority 40)
>>                                      (cons 'outside-staff-padding 0))))
>>        (lst (list
>>        #{
>>          \set Timing.measureLength = #(ly:music-length music)
>
> I'd add
>
> \once \override MultiMeasureRest #'usable-duration-logs = #'(0)
>
> here to ensure it always uses a semibreve rest.
>
> Cheers,
> Neil

very good idea, when using the cadenzaRest-function as above.
But I was annoyed by having two functions with very similiar code.

After more thinking, why not:

\version "2.15.24"

cadenzaNotes =
#(define-music-function (parser location fermata? music cad-music)
(boolean? ly:music? ly:music?)
  (let* ((mus-len (ly:music-length  cad-music))
         (num (ly:moment-main-numerator mus-len))
         (denom (ly:moment-main-denominator mus-len))
         (fermata (make-music 'MultiMeasureTextEvent
                             'tweaks (list
                                      ;; Set the 'text based on the 'direction
                                      (cons 'text (lambda (grob)
                                                    (if (eq?
(ly:grob-property grob 'direction) DOWN)
                                                        (markup
#:musicglyph "scripts.dfermata")
                                                        (markup
#:musicglyph "scripts.ufermata"))))
                                      (cons 'outside-staff-priority 40)
                                      (cons 'outside-staff-padding 0))))
        (lst (list
        #{
          \set Timing.measureLength = $mus-len
          \scaleDurations #(cons num denom) $music
          \unset Timing.measureLength
        #}))
        )
 (make-sequential-music
  (if fermata?
  (cons fermata lst)
  lst))))


othernotes = \relative c'' { d1 c1 }
cnotes = \relative c'' {  c8[ d e f g]  c,8[ d e f g]}
snotes = { $(skip-of-length cnotes) }
mnotes¹ = \cadenzaNotes ##t R1 \cnotes
mnotes² = \cadenzaNotes ##f \relative c'' { c2 d } \cnotes


\score {
 <<
   \new Staff { \othernotes \cnotes \othernotes }
   \new Staff { \othernotes \snotes \othernotes }
   \new Staff { \othernotes \mnotes¹ \othernotes }
   \new Staff { \othernotes \mnotes² \othernotes }
   \new Staff \relative c'' { d1 c1~ \cadenzaNotes ##t { c2\fermata
g4\fermata c~ }  \cnotes  c1 d }
   % manually:
   \new Staff { \othernotes R1*10/8\fermataMarkup  \othernotes }
   \new Staff { \othernotes \scaleDurations #'(10 . 8) \relative c'' {
c2\fermata g4\fermata c }  \othernotes }
 >>
}

Cheers,
  Harm



reply via email to

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