lilypond-user
[Top][All Lists]
Advanced

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

Re: Leadsheet with cadenza / ad lib.


From: Stephan Schöll
Subject: Re: Leadsheet with cadenza / ad lib.
Date: Thu, 8 Jun 2023 22:54:33 +0200
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.11.2

Hi Leo
Hi Valentin

Thanks a lot for your quick replies.

Since my need is very local and limited, Leo's proposal works perfectly
fine for me.

Valentin, your extensive solution might be worth adding to the LSR, right?

Best regards

Stephan

Am 08.06.2023 um 15:28 schrieb Valentin Petzel:
Hello Stephan, hello Leo,

depending on the circumstances it might be useful to replace cadenzas with
scaled duration such that the music fits a whole measue. Using a small helper
function one might do something like this:

%%%%%
scaleMusicTo =
#(define-music-function (duration mus) (fraction? ly:music?)
    (let* ((mdur (ly:music-length mus))
           (mdur (/ (ly:moment-main-numerator mdur) (ly:moment-main-denominator
mdur)))
           (tdur (/ (car duration) (cdr duration))))
      (scaleDurations (/ tdur mdur) mus)))

melody = \relative c'' {
    \global
    \scaleMusicTo 1/1 {
      \repeat unfold 19 { a16 }
    }
    R1\fermata
    \scaleMusicTo 1/1 {
      \repeat unfold 21 { f16 } f16\fermata
    }
    R1
    \fine
}
%%%%%

The disadvantage of this is of course that Lilypond is going to treat these
note values as smaller note values than what is notated, which will affect
spacing. Alternatively you could define your cadenzas outside and automatically
have correct length rests and skips done:

%%%%%
cadenza =
#(define-music-function (n) (number?)
    #{
      \cadenzaOn
      $(assoc-get n cadenzas)
      \cadenzaOff
      \bar "|"
    #})

cadenzaD =
#(define-scheme-function (n) (number?)
    (let* ((c (assoc-get n cadenzas))
           (dur (ly:music-length c))
           (dur (/ (ly:moment-main-numerator dur) (ly:moment-main-denominator
dur))))
      dur))

cadenzaR =
#(define-music-function (n) (number?)
    #{ R1*$(cadenzaD n) #})

cadenzaS =
#(define-music-function (n) (number?)
    #{ s1*$(cadenzaD n) #})

cadenzas.1 = \repeat unfold 19 { a16 }
cadenzas.2 = { \repeat unfold 21 { f16 } f16\fermata }


melody = \relative c'' {
    \global
    \cadenza 1
    R1\fermata
    \cadenza 2
    R1
    \fine
}

harmonies = \chordmode {
    \global
    \cadenzaS 1
    a1:m
    \cadenzaS 2
    f1:m
    \fine
}
%%%%%

But note that this still causes bugs, because cadenzas do not play well with
multimeasure rests:

{
   \cadenzaOn
   c8
   \cadenzaOff
   \bar "|"
   R1
}

This is because Lilypond does not handle cadenzas as an arbitrary length
measure, but simply stops timing. So instead of \cadenzaOn and \cadenzaOff you
could automatically use a suitable \partial:

%%%%%
cadenza =
#(define-music-function (n) (number?)
    #{
      \partial #(ly:make-duration 0 0 (cadenzaD n))
      $(assoc-get n cadenzas)
    #})
%%%%%

Cheers,
Valentin



reply via email to

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