lilypond-user
[Top][All Lists]
Advanced

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

Re: TupletNumber placement - can you improve this function?


From: David Nalesnik
Subject: Re: TupletNumber placement - can you improve this function?
Date: Sun, 20 May 2012 07:42:56 -0500

Hi Janek,

On Sun, May 20, 2012 at 2:34 AM, Janek Warchoł <address@hidden> wrote:
Hi David,

On Sun, May 20, 2012 at 12:02 AM, David Nalesnik
<address@hidden> wrote:
> Hi Janek,
>
>> today i've found this snippet: http://lsr.dsi.unimi.it/LSR/Item?id=646 [...]
>
> Just yesterday I was updating the score which was the reason for me writing
> this in the first place!!

Ah, so it was yours!  I didn't find any information about the authorship.

> Probably about a hundred cross-staff tuplets, no
> brackets, and a manual adjustment needed for each one of them...  Ugh.

That's the true LilyPond way: instead of fixing the same thing all the
time, write one fix once and for all - kudos!  I wish everyone
operated this way.

Thanks!  But with the time it took me to write it (and with the things that keep happening to it), I think I should specialize in cross-staff tuplets as a composer :)
 

> The conditions in the function were designed to leave ordinary beams
> untouched, and also to ignore tuplets with visible brackets.  (In earlier
> versions of LilyPond, the functions actually would give OK results with
> ordinary beams.)

Interesting - that wasn't the case when i tested it.

It looks for several conditions: if the beam isn't kneed, or if there is a visible tuplet bracket (you've forced one, or there is no beam attached to the first stem of the group), the functions will return the default values of 'X-offset and 'Y-offset.  Originally these properties were unset by default, so I simply left them unset if no adjustment to the number was needed.  At some point after 2.14, both 'X and 'Y-offset of TupletNumber were set to procedures.  The original LSR functions, applied in this circumstances, clear the default values and all horizontal and vertical positioning is lost!  (The number appears on the midline of the staff at the first stem of the beam.)

On Sun, May 20, 2012 at 1:45 AM, David Nalesnik
<address@hidden> wrote:
> OK, I got it to work with 2.15.38.

Amazing!
However, i see a weird bug - with visible TupletBrackets, some are not
left unchanged (see attachment).  The most interesting thing is that
this happens in 2.15.38, 2.15.36 is ok!

Try using manual beaming.  When I change the one tuplet causing problems in the example you attach, the problem goes away.

Here I noticed something interesting, which might actually be a bug.  Try the example without any overrides.  So:

\version "2.15.38"

 \paper {
  indent = 0
}

top = \change Staff = "1"
bottom = \change Staff = "2"

music = \relative c {
  \override Beam #'auto-knee-gap = #1
  \override TupletBracket #'bracket-visibility = ##t
  \set tupletSpannerDuration = #(ly:make-moment 1 4)
  \times 2/3 {
    c8 b c
    g a' f % autobeaming necessary here when example doubled
    f f,4
    e c'8
  }
  \times 2/3 {
    \bottom c8[ g' \top e']
    c'[ e, \bottom g,]
    \top e''[ \bottom c,, \top g'']
  }
  \times 4/5 {
    \bottom c,,16[ \top g'' e' \bottom g,, \top c']
  }
}

\score {
  \new PianoStaff <<
    \new Staff = "1" {
      s1 s
      s s
    }
    \new Staff = "2" {
      \clef bass
      \music
      \bar "||"
      \music  % no problem when commented out
    }
  >>
}

You get different results for the second tuplet depending on whether the example is doubled.  Autobeaming for that one tuplet fixes the problem.  Very interesting!  


> You don't need to change anything for the snippet to work with 2.14.

Unfortunately, when i added some non-cross-staff beams an error
"Unbound variable: ly:tuplet-number::calc-y-offset" appears when i try
with 2.14.2.  I attach my expanded example.

Exactly--this procedure wasn't there in 2.14.2.

Thank you for looking at this in such depth!  (Don't know how long it would have been otherwise since I "fixed" that score I was updating...)

Best,
David


reply via email to

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