lilypond-user
[Top][All Lists]
Advanced

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

Re: Tuplet bracket and cross staff


From: Andrew Bernard
Subject: Re: Tuplet bracket and cross staff
Date: Sun, 26 Jun 2016 13:00:26 +1000

 Hi Matteo,

I have a tuplet angle function that somebody (I cannot recall who)
sent me some time ago. I use it heavily and extensively and I can say
it has been tested by me to the limit - it works well.

Using this code you just say \tupletAngles 1 0 or similar and that's
all you need. Put it is a file tuplet-angles.ily and include it. Using
\tupletAngles 0 0 is very handy for straigthening up tuplets when you
don't want lilypond to angle them.

Here it is. [Surprised this is not more well known.]

Andrew

== snip

\version "2.19.42"

%% ===========================================
tupletAngles =
#(define-music-function (y-off angl)(number? number?)
   "
 y-off a (possible) offset in Y-direction
 angl is supposed to be the angle of the TupletBracket in degrees,
 "
   #{
     \once\override TupletBracket #'stencil =
     #(lambda (grob)
        (let* ((pos (ly:grob-property grob 'positions))
               (y-length (interval-length pos))
               (st (ly:tuplet-bracket::print grob))
               (st-x-ext (ly:stencil-extent st X))
               (st-x-length (interval-length st-x-ext))
               (alpha (degrees->radians angl))
               (dir (ly:grob-property grob 'direction))
               (new-start (+ (if (= dir 1)
                                 (max (car pos)(cdr pos))
                                 (min (car pos)(cdr pos)))
                            y-off))
               (new-y (* st-x-length (tan alpha))))
          (ly:grob-set-property! grob 'positions (cons new-start (+
new-start new-y)))
          (ly:tuplet-bracket::print grob)))
   #})

horizontalTuplets =
\override TupletBracket  #'stencil =
#(lambda (grob)
   (let* ((pos (ly:grob-property grob 'positions))
          (dir (ly:grob-property grob 'direction))
          (new-pos (if (= dir 1)
                       (max (car pos)(cdr pos))
                       (min (car pos)(cdr pos)))))
     (ly:grob-set-property! grob 'positions (cons new-pos new-pos))
     (ly:tuplet-bracket::print grob)))

%% ===========================================




\language "italiano"


staffDown = \change Staff = "LH"

staffUp = \change Staff = "RH"



RH_VIII = \relative do'' {

  r2

  \tupletUp

  \once \override TupletBracket.staff-padding = #9

  \tupletAngles -6 30
  \tuplet 5/4 {

    \staffDown r16  sol'-. \staffUp re'\( mib re

  } sib'8\)-. r

  |

}



LH_VIII = \relative do' {

  \clef "treble" r2 s4 la''8-. r8

  |

}



<<

  \set PianoStaff.connectArpeggios = ##t

  \new Staff = "RH" \with {

    \accidentalStyle neo-modern

    \numericTimeSignature

    \override Flag.stencil = #modern-straight-flag

    \override VerticalAxisGroup.remove-empty = ##f

  }  \RH_VIII

  \new Staff = "LH" \with {

    \accidentalStyle neo-modern

    \numericTimeSignature

    \clef "bass"

    \override Flag.stencil = #modern-straight-flag

    \override VerticalAxisGroup.remove-empty = ##f

  } \LH_VIII

>>


== snip



reply via email to

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