[Top][All Lists]

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

Re: Aleatoric Elements with barlines

From: Martin Neubauer
Subject: Re: Aleatoric Elements with barlines
Date: Wed, 9 Jan 2019 16:11:10 +0100
User-agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0

On 09/01/2019 14:06, Ben wrote:
> On 1/8/2019 10:43 PM, Martin Neubauer wrote:
>> On 07/01/2019 17:29, Reggie wrote:
>>> Aaron you are a great teacher thank you. Just a couple few more
>>> questions
>>> please. First how did you know that it had to equal 2 full measures?
>>> I did
>>> not see how you arrived. Second please tell me is there any negative
>>> effect
>>> of moving the barline from score to staff I didn't want to do that on a
>>> global scale because this alignment is just one small section of a
>>> "normal"
>>> composition, but if it's safe? Then ok. Any caveats with moving to
>>> staff?
>>> Thank you. I don't understand the math of 2 full bars.
>> In situations like these I might use the \scaleToLength function. That
>> way it's possible to control the horizontal placement of the music in
>> the different staves by judicious use of spacer rests and still not
>> having to worry about getting the synchronisation points right between
>> the staves. Also in that case there would be no need to use
>> \cadenzaOn/\cadenzaOff.
> Hi Martin!
> How do you use the scaleToLength function? I can't find much about it
> when searching the documentation for it. Sounds interesting from how you
> describe it. Thanks!
It turns out I've forgotten I took it from this list some time ago
(apparently written by Malte Meyn). It's basically just a wrapper for
\scaleDurations but provides just the right interface for the mentioned
use case. Before I used an own variation (because it's just that
useful), but since it was written quite clumsily compared to Malte's, it
just vanished into the mists of time...

Anyway, here's the function:

scaleToLength =
#(define-music-function (dur mus) (ly:duration? ly:music?)
   (let* ((real-len (ly:music-length mus))
          (mom (ly:duration-length dur))
          (ratio-mom (ly:moment-div mom real-len))
          (ratio (cons (ly:moment-main-numerator ratio-mom)
                   (ly:moment-main-denominator ratio-mom))))
       \scaleDurations #ratio #mus

And using it is simple enough:
\scaleToLength 1 {
  % some music

Try it, it's great!
> _______________________________________________
> lilypond-user mailing list
> address@hidden

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

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