lilypond-user
[Top][All Lists]
Advanced

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

RE: Just a fun example of what Lilypond can do


From: Andrew Bernard
Subject: RE: Just a fun example of what Lilypond can do
Date: Sun, 6 Nov 2016 16:32:28 +1100

Hi,

If you want better control over tuplet brackets and their angles, here's
some useful code.
You can get the brackets horizontal with little effort using this.

[Not my code, but I am unable to recall who created this to acknowledge
them.]

[Do tell us your name, it would be good and proper. Even a pseudonym is
better than nothing. ]

Andrew

== snip

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

== snip

Andrew



-----Original Message-----
From: lilypond-user] On Behalf Of mclaren
Sent: Sunday, 6 November 2016 2:48 PM
To: address@hidden
Subject: Just a fun example of what Lilypond can do

No bugs, no problems with this score. Thought I'd just toss this out there
to show a neat example of some things Lilypond can do that no other notation
program (that I know of -- haven't used SCORE) can do.





reply via email to

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