Re: Multi Measure Rests in Cadenzas

2023-07-31 Thread Rupert Marshall-Luck
Hallo Calvin,

(First time posting here - I hope this works!)

I've found the following (based on https://lsr.di.unimi.it/LSR/Snippet?id=836) 
works well in this sort of situation. The function `cadenzatoMetre` takes two 
music expressions as arguments. The first denotes the rhythmic "frame" within 
which you want the cadenza placed - this can be a rest or a set of pitches: the 
actual content of the expression doesn't matter as it isn't printed by the 
function; it just serves as a reference. The second argument is the cadenza 
itself.

The function calculates a "scaling factor" based on the metrical lengths of the 
two arguments and uses the function `ly:music-compress` to scale the cadenza 
accordingly.


% Example begins
% ===
\version "2.24.1"

cadenzaToMetre =
#(define-music-function (nonCadenzaMusic cadenzaMusic)
  (ly:music? ly:music?)
(let* ((cadenzaLength (ly:music-length cadenzaMusic))
   (nonCadenzaLength (ly:music-length nonCadenzaMusic))
   (factor (ly:moment-div nonCadenzaLength cadenzaLength))
  )
  (ly:music-compress cadenzaMusic factor)
  )
)

% Cadenza
% 
cadenza = { c''1\fermata b'16[ c'' d'' e'' f'' g''] f''4\fermata e''\fermata }

{
  <<
\new Staff {
  e''1
  R1\fermata
  e''1
}

\new Staff{
  c''1
  \cadenzaToMetre r1 \cadenza
  c''1
}
  >>
}

% Example ends
% =

Hope this might help!

Best wishes,

Rupert


> On 31/07/2023 06:19 GMT Valentin Petzel  wrote:
> 
>  
> Hello Calvin,
> 
> MM rests and cadenzas do not play well together. The reason for this is that 
> the MM is placed centered between start and end of measure. But \cadenzaOn is 
> not really made for creating arbitrary length measures. What is does is 
> simply 
> telling Lilypond to stop counting. So when you do
> 
> \cadenzaOn a \bar "|"
> \cadenzaOff a
> 
> this is technically a single measure (where the cadenza part simply happes 
> before even the first moment). So the MM rest will be centered along the 
> whole 
> thing. (So technically this is a case where MM rests and \bar "|" within a 
> measure do not play together).
> 
> Instead of using a cadanza you might want to use \partial to create a measure 
> of arbitrary length.
> 
> Cheers,
> Valentin
> 
> Am Montag, 31. Juli 2023, 04:17:51 CEST schrieb Calvin Ransom:
> > I have a cadenza where Staff A rests while Staff B plays and after the
> > cadenza Staff A comes back in. In the below minimal example, there is an
> > extra rest added above the note when Staff A comes back in. How do I get
> > rid of this rest? If I use r1 instead of R1 I don't have this issue (but I
> > need to use R1 as my cadenzas are longer than a single measure)
> > 
> > % SNIPPET BEGINS %
> > \version "2.24.1"
> > 
> > \new ChoirStaff <<
> >   \new Staff {
> > a1
> > R1
> > a %why is there a rest above this note?
> > a
> >   }
> >   \new Staff  {
> > a1
> > \break
> > \cadenzaOn
> > a
> > \bar "|"
> > \break
> > \cadenzaOff
> > a
> > a
> >   }
> > 
> > 
> > % SNIPPET ENDS %
> > 
> > Calvin Ransom
> > 
> > Sent from my T530



Re: Multi Measure Rests in Cadenzas

2023-07-31 Thread Valentin Petzel
Hello Calvin,

MM rests and cadenzas do not play well together. The reason for this is that 
the MM is placed centered between start and end of measure. But \cadenzaOn is 
not really made for creating arbitrary length measures. What is does is simply 
telling Lilypond to stop counting. So when you do

\cadenzaOn a \bar "|"
\cadenzaOff a

this is technically a single measure (where the cadenza part simply happes 
before even the first moment). So the MM rest will be centered along the whole 
thing. (So technically this is a case where MM rests and \bar "|" within a 
measure do not play together).

Instead of using a cadanza you might want to use \partial to create a measure 
of arbitrary length.

Cheers,
Valentin

Am Montag, 31. Juli 2023, 04:17:51 CEST schrieb Calvin Ransom:
> I have a cadenza where Staff A rests while Staff B plays and after the
> cadenza Staff A comes back in. In the below minimal example, there is an
> extra rest added above the note when Staff A comes back in. How do I get
> rid of this rest? If I use r1 instead of R1 I don't have this issue (but I
> need to use R1 as my cadenzas are longer than a single measure)
> 
> % SNIPPET BEGINS %
> \version "2.24.1"
> 
> \new ChoirStaff <<
>   \new Staff {
> a1
> R1
> a %why is there a rest above this note?
> a
>   }
>   \new Staff  {
> a1
> \break
> \cadenzaOn
> a
> \bar "|"
> \break
> \cadenzaOff
> a
> a
>   }
> 
> 
> % SNIPPET ENDS %
> 
> Calvin Ransom
> 
> Sent from my T530



signature.asc
Description: This is a digitally signed message part.


Multi Measure Rests in Cadenzas

2023-07-30 Thread Calvin Ransom
I have a cadenza where Staff A rests while Staff B plays and after the cadenza 
Staff A comes back in.
In the below minimal example, there is an extra rest added above the note when 
Staff A comes back in. How do I get rid of this rest? If I use r1 instead of R1 
I don't have this issue (but I need to use R1 as my cadenzas are longer than a 
single measure)

% SNIPPET BEGINS %
\version "2.24.1"

\new ChoirStaff <<
  \new Staff {
a1
R1
a %why is there a rest above this note?
a
  }
  \new Staff  {
a1
\break
\cadenzaOn
a
\bar "|"
\break
\cadenzaOff
a
a
  }
>>

% SNIPPET ENDS %

Calvin Ransom

Sent from my T530