lilypond-user
[Top][All Lists]
Advanced

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

Re: Aleatoric Elements with barlines


From: Ben
Subject: Re: Aleatoric Elements with barlines
Date: Wed, 9 Jan 2019 17:57:46 -0500
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0

On 1/9/2019 5:39 PM, Aaron Hill wrote:
On 2019-01-09 2:19 pm, Ben wrote:
Thanks for the function! I'm still a little confused about the
value(s) that you use with the function. I see it looks like it takes
a duration value, right? Like 1, 4, 16? But I can't see how it would
work on the music. Maybe I just put the wrong example music code in
mine, but can you share an example where you input " % some music " to
show how the function works?

Do you always use one number or does the function also allow/need like
1 4 or 1 8, etc.

The function expects a ly:duration.  That can be as simple as "1" for whole or something more complex like "\longa*2/3".

See the following example usage:

%%%%
\version "2.19.82"

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 #}))

\paper { ragged-right = ##f }
\layout {
  \context { \Score
    \remove "Timing_translator"
    \remove "Default_bar_line_engraver"
  }
  \context { \Staff
    \consists "Timing_translator"
    \consists "Default_bar_line_engraver"
  }
}

<< \new Staff \scaleToLength \longa*1/2 \relative c'' {
  r1*17/13\fermata \bar ".|:"
  < d e f >1\> r1\!\fermata \bar ":|."
  s2 \bar "||"
}
\new Staff \scaleToLength \breve \relative c'' {
  \bar ".|:"
  < d e f >1\> r1\!\fermata \bar ":|."
  s2 \bar "||"
}
\new Staff \scaleToLength 1*2 \relative c'' {
  r1*7/11\fermata \bar ".|:"
  < d e f >1\> r1\!\fermata \bar ":|."
  s2 \bar "||"
} >>
%%%%

What I've done is specify that each music section is to be two measures via a few means: "1*2", "\breve", and "\longa*1/2".  One system has no rest leading it at all, and the other two are very unusual lengths indeed.  Each section has only a fixed half note spacer rest at the end, so their lengths are all unique.

Note that since I removed \cadenzaOn, there will be a default bar line every measure, which we can see in the output.  But this proves that the alignment of notes is correctly scaled by \scaleToLength.


Aaron that is....SO awesome! Thanks for explaining that. I'm going to be using that function a lot for sure. :)



reply via email to

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