1

I'm trying to replicate a triplet drawn as a bow with the number over the bow rather than under and shifted to hover over the first note. By following LilyPond - change tuplet bracket to a small bow, I got the bow/slur. Now, how do I move the number?

I want the number and bow to be positioned like this:

enter image description here

So far I have this code

\tupletUp \tuplet 3/2 {a16[A16 f16]}

to get this:

enter image description here

2
  • I'm not sure how to the the "3" outside of the bracket/slur (or why you'd want that), but in the newer versions of LilyPond there is an inbuilt method to get slurs for tuplet brackets, \override TupletBracket.tuplet-slur = ##t (see: lilypond.org/doc/v2.24/Documentation/notation/…). Commented Sep 13, 2023 at 6:57
  • I've already figured out that override to get slurs for tuple brackets. The reason I want the numbers is that I have a lot of sheet music done like that.
    – Frotz
    Commented Sep 13, 2023 at 18:35

1 Answer 1

1

Generally you’d move the Tuplet Number simply by offsetting its X/Y-offset values. If you want some refinement maybe do

{
  \override TupletNumber.Y-offset =
  #(lambda (grob)
     (let* ((bracket (ly:grob-object grob 'bracket))
            (stc (ly:grob-property grob 'stencil))
            (ext (ly:stencil-extent stc Y))
            (align (ly:grob-property grob 'self-alignment-Y 0))
            (palign (ly:grob-property grob 'parent-alignment-Y align))
            (align (/ (1+ align) 2))
            (palign (/ (1+ palign) 2))
            (pos (ly:grob-property bracket 'positions)))
       (+ (* palign (cdr pos)) (* (- 1 palign) (car pos))
          (* align (cdr ext)) (* (- 1 palign) (car ext)))))
  \override TupletNumber.X-offset =
  #(lambda (grob)
     (let* ((bracket (ly:grob-object grob 'bracket))
            (stc (ly:grob-property grob 'stencil))
            (ext (ly:stencil-extent stc X))
            (align (ly:grob-property grob 'self-alignment-X 0))
            (palign (ly:grob-property grob 'parent-alignment-X align))
            (align (/ (1+ align) 2))
            (palign (/ (1+ palign) 2))
            (pos (ly:grob-property bracket 'X-positions)))
       (display palign)
       (+ (* palign (cdr pos)) (* (- 1 palign) (car pos))
          (* align (cdr ext)) (* (- 1 palign) (car ext)))))

  \override TupletBracket.tuplet-slur = ##t
  \override TupletNumber.padding =
  #(lambda (grob)
     (let ((b (ly:grob-object grob 'bracket)))
       (- (interval-center (ly:grob-property b 'edge-height)))))
  \override TupletNumber.self-alignment-Y =
  #(lambda (grob)
     (ly:grob-property (ly:grob-object grob 'bracket) 'direction))
  \override TupletNumber.parent-alignment-Y =
  #(lambda (grob)
     (* 2 (ly:grob-property (ly:grob-object grob 'bracket) 'direction)))
  \override TupletNumber.parent-alignment-X = #-0.8

  \tuplet 3/2 { c'4 d' e' }
  \tuplet 3/2 { c''4 d'' e'' }
}

This would look like this

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.