lilypond-user
[Top][All Lists]

## Re:feathered beam calculations

 From: Flaming Hakama by Elaine Subject: Re:feathered beam calculations Date: Fri, 21 Dec 2018 15:44:52 -0800

---------- Forwarded message ----------
Cc:
Bcc:
Date: Fri, 21 Dec 2018 12:10:12 -0700 (MST)
Subject: Re: feathered beam calculations
Aaron Hill wrote
> Given the current implementation, it would be necessary to use an
> approximate rational like 50/63 as the moment in order to get 'f' to be
> half of 'c'.  Why that number?  Well, it's a close approximation to the
> irrational cube root of one half.  We determine this exact value by
> taking the desired ratio (1/2) and raising it to the reciprocal of the
> number of scaling steps between the first and last notes (three, in this
> case, which becomes the fraction 1/3).  (1/2)^(1/3) is about 0.7937; and
> 50/63 is roughly 0.79365.
>
> But before we get lost in the murky details of whether the implemented
> behavior is right or the documentation is right, let us circle back
> around to a key point that I feel has not been stressed enough.
>
> This means your score really should be bar check clean *before* you ever
> use \featherDurations.
>
> I said earlier we would talk about bar checks *within* the feathered
> sequence of notes.  Consider the following addition to our example:
>
>      << { r64 \featherDurations #(ly:make-moment 2/1)
>               { c32*127/14[ d e f g a | b] } }
>         { r64 \featherDurations #(ly:make-moment 2/1)
>               { c32*63/12[ d e f g a] } | b1 }
>         { r64 { c64 d32 e16 f8 g4 a2 } | b1 } >>
>
> You'll see that the 'b' is included within the beamed notes.  Because we
> now have seven notes covering the period of two measures less one 64th,
> we had to adjust our scaling fraction to 127/14.  However, what is most
> important is that \featherDurations fixes the timing of the notes to
> allow the inside bar check to pass.  Omit it, and you'll see that the
> bar check fails.  But also try changing the 2/1 moment to anything else,
> and the bar check will also fail.
>
> What we have here is a very fragile element in the score that can be
> easily avoided by never requiring any note (apart from the first) within
> a feathered sequence to align to anything else.  The final 'b' above
> should properly be outside the feathered sequence (or possibly start a
> new sequence of its own).  In this way, the math to ensure all of the
> sequences have the right lengths can be done completely independent of
> \featherDurations.
>
> Hopefully some of this will be helpful.
>
> -- Aaron Hill
>
> _______________________________________________
> lilypond-user mailing list

> lilypond-user@

> https://lists.gnu.org/mailman/listinfo/lilypond-user

Aaron that makes sense but only if you have failed bar checks before
feathering. Let's say you have a perfect score with no fails. And now you
want to simply insert feather beamed notes only in one measure but have them
spaced out according to the speed accelerando ritard as standard. How do you
even begin to know what math * * * * you should be doing when there is no
math to do in the first place??? NO bar check math because everything is
already fine. Why can't you just spread out the notes according to how
feathers are supposed to? Prove me please. Here look.

\relative c'
{

\override Beam.grow-direction = #LEFT
\featherDurations #(ly:make-moment 2/1)
c32[ d e f g f e f d f g f d e d f] c4~c | c1 |
}

My CODE has no errors. And yet the 2/1 does NOT space out any notes at ALL
it's just normal beamed notes with fancy feathers. What math do I need how
does one even know what math to use since there are no bar bad checks? See?
:))

\version "2.18.2"

%{

If you want the spacing to be proportionate to duration,
then you are responsible for calculating those durations.

It is basically high school level math, so grab a beer
and let's go.

Let's think this through from the beginning.

In terms of the literal feathered beaming, you have specified
eight notes, which scale in duration from a 32nd to an 8th.
What is the actual duration of this sequence?

Assuming a linear scale, on average, these would sum to 1.25

(For example, add first & last and multiply by N/2:  (1/32 + 1/8) * 8 = 1.25)

So, in order for the written durations of the beams (1.25 measures)
to match the intended duration, based on what else is in the measure
(0.5 measures), the entire passage would need to be scaled by a factor
of 1.25/0.5 = 1/2.5

With that in mind, let's proceed towards an approach
of scaling durations.

The way to get a printed note to scale to a different
duration is like c32*2 (the equivalent of a 16th) or
c32*4 (the equivalent of an 8th).

But in addition to scaling the entire sequence, we need to
specify the relative durations of the notes.

How do you do the math?  There is more than one way.
Note that our goal is to find a sequence that in 16 steps
scales to a value that is about 4x the intial value.

Here is one approximation, trying to keep things in fractions
and not reals for the sake of syntax:

%}

sequence = \relative c' {
c32*10/10 [
d32*12/10
e32*14/10
f32*16/10

g32*18/10
f32*20/10
e32*22/10
f32*24/10

d32*28/10
f32*30/10
g32*32/10
f32*34/10

d32*36/10
e32*38/10
d32*40/10
f32*42/10 ]
}

%{

You can see that the last duration is 42/10, which is larger than 40/10, so
since we have overshot, this sequence sums to 1.3, rather than 1.25.

((1/32)*(10/10) + (1/32)*(12/10) + (1/32)*(14/10) + (1/32)*(16/10) + (1/32)*(18/10) + (1/32)*(20/10) + (1/32)*(22/10) + (1/32)*(24/10) + (1/32)*(28/10) + (1/32)*(30/10) + (1/32)*(32/10) + (1/32)*(34/10) + (1/32)*(36/10) + (1/32)*(38/10) + (1/32)*(40/10) + (1/32)*(42/10)) = 1.3

In any case, we can just use this value as the factor used to
change the denominator to in order to scale from 1.3 measures
(the actual total length) to 0.5 measures (the desired length),
or  1.3/0.5 = 2.6.

So, we change our denominator from 10 to 26:

%}

scaledSequence = \relative c' {
c32*10/26 [
d32*12/26
e32*14/26
f32*16/26

g32*18/26
f32*20/26
e32*22/26
f32*24/26

d32*28/26
f32*30/26
g32*32/26
f32*34/26

d32*36/26
e32*38/26
d32*40/26
f32*42/26 ]
}

%{

((1/32)*(10/26) + (1/32)*(12/26) + (1/32)*(14/26) + (1/32)*(16/26) + (1/32)*(18/26) + (1/32)*(20/26) + (1/32)*(22/26) + (1/32)*(24/26) + (1/32)*(28/26) + (1/32)*(30/26) + (1/32)*(32/26) + (1/32)*(34/26) + (1/32)*(36/26) + (1/32)*(38/26) + (1/32)*(40/26) + (1/32)*(42/26)) = 0.5

Now that we have done the scaling manually,
we don't need to change the durations in the featherDurations call:

%}

\relative c' {
\override Beam.grow-direction = #LEFT
\featherDurations #(ly:make-moment 1/1)
\scaledSequence
\override Beam.grow-direction = #'()
c4 ~ c | c1
}

HTH,

Elaine Alt
415 . 341 .4954                                           "Confusion is highly underrated"