On Sat, Feb 11, 2017 at 11:11 AM, Werner LEMBERG <w...@gnu.org> wrote: > >>> For voices with lyrics it is common to put triplet indications >>> always above the staff, using the following rules. >>> >>> . stems up or down, no beam: as usual (i.e., a number and a >>> bracket at the top, as if using \tupletUp) >>> >>> . stems up, with beam: as usual (i.e., a number over the beam) >>> >>> The last case, however, is unusual: >>> >>> . stem down, with beam: a number and a *slur* at the top. > > BTW, these rules can be found in the vocal score of `Arabella' (by > Richard Strauss), for example. > >> It strikes me that I've seen code somewhere that uses slurs instead of >> brackets. I find this: >> http://www.lilypondforum.de/index.php?topic=1658.0 > > Yes, I can remember that also – very nice! > >> The results look great, but of course, the slur is broken. It might >> not be hard to modify that routine to do what you want.. > > Oh, I actually don't really care whether the slur is broken or not. > I'm rather interested in having a lilypond option to make it behave > (i.e., differentiate between tuplet slur and tuplet brackets) as > outlined above.
I've attached a patch which permits tuplets with slurs instead of brackets. Sorry that you have to build LilyPond to use it. It's pretty rough. For one thing, the slur shapes for inclined slurs are probably not ideal. To get the bowed-tuplets, you set TupletBracket.tuplet-slur to #t. You can move the slur closer/further from the number by setting TupletNumber.padding to the value you'd like (default: 0.3). Don't know what other consequences there might be when setting TupletNumber.padding, but I don't want to add more properties unless it's really necessary. To get the behavior you want, check the example file. There is a Scheme function which should put your rules into effect. > >> [...] Also, a full bracket might be used if the tuplet number >> wouldn't intersect the bracket. Maybe this should be default >> behavior? I know I've seen the bracket notation in Britten, albeit >> without the tuplet number. > > I think making lilypond provide unbroken tuplet slurs and brackets is > a welcome addition :-) I'll look at this too. Shouldn't be too hard. Best, David
From 79fe76eaf0fa518c2b6d466ec9e889b820bb9e16 Mon Sep 17 00:00:00 2001 From: David Nalesnik <david.nales...@gmail.com> Date: Sat, 11 Feb 2017 13:19:16 -0600 Subject: [PATCH] Allow slurs instead of brackets with tuplets Older editions often use slurs with tuplets. This patch creates a new property ('tuplet-slur'), which toggles this notation style. Note that 'bracket-visibility must be set to #t for the slurs to appear with beamed notes. (In the future, 'bracket-visibility might automatically be set to #t.) --- lily/tuplet-bracket.cc | 73 ++++++++++++++++++++++++++++++++++++------ scm/define-grob-properties.scm | 2 ++ scm/define-grobs.scm | 1 + 3 files changed, 66 insertions(+), 10 deletions(-) diff --git a/lily/tuplet-bracket.cc b/lily/tuplet-bracket.cc index 340b017..5a7dc86 100644 --- a/lily/tuplet-bracket.cc +++ b/lily/tuplet-bracket.cc @@ -58,6 +58,7 @@ #include "lookup.hh" #include "paper-column.hh" #include "moment.hh" +#include "bezier.hh" static Item * get_x_bound_item (Grob *me_grob, Direction hdir, Direction my_dir) @@ -245,6 +246,48 @@ Tuplet_bracket::calc_x_positions (SCM smob) return ly_interval2scm (x_span - me->get_bound (LEFT)->relative_coordinate (commonx, X_AXIS)); } +Bezier +tuplet_slur_shape (Offset l, Offset r, Real h_limit, Real ratio, Direction d) +{ + Real indent; + Real height; + + Real width = (r[X_AXIS] - l[X_AXIS]); + + get_slur_indent_height (&indent, &height, width, h_limit, ratio); + + Bezier curve; + + curve.control_[0] = l; + curve.control_[1] = Offset (l[X_AXIS] + indent, l[Y_AXIS] + height * d); + curve.control_[2] = Offset (r[X_AXIS] - indent, r[Y_AXIS] + height * d); + curve.control_[3] = r; + + return curve; +} + +Stencil +make_tuplet_slur (Grob *me, Offset l, Offset r) +{ + SCM dash_definition = me->get_property ("dash-definition"); + Real lt = me->layout ()->get_dimension (ly_symbol2scm ("line-thickness")); + + Real height_limit = 1.5; + Real ratio = .33; + + Direction dir = get_grob_direction (me); + + Bezier curve = tuplet_slur_shape (l, r, height_limit, ratio, dir); + + Stencil mol (Lookup::slur (curve, lt, lt, dash_definition)); + + Grob *tn = unsmob<Grob> (me->get_object ("tuplet-number")); + Real padding = robust_scm2double (tn->get_property ("padding"), 0.3); + + mol.translate_axis (padding * dir, Y_AXIS); + return mol; +} + /* TODO: @@ -258,6 +301,8 @@ Tuplet_bracket::print (SCM smob) Spanner *me = unsmob<Spanner> (smob); Stencil mol; + bool tuplet_slur = ly_scm2bool (me->get_property ("tuplet-slur")); + extract_grob_set (me, "note-columns", columns); bool equally_long = false; Grob *par_beam = parallel_beam (me, columns, &equally_long); @@ -373,15 +418,19 @@ Tuplet_bracket::print (SCM smob) } } - Stencil brack = make_bracket (me, Y_AXIS, - points[RIGHT] - points[LEFT], - height, - /* - 0.1 = more space at right due to italics - TODO: use italic correction of font. - */ - Interval (-0.5, 0.5) * gap + 0.1, - flare, shorten); + Stencil brack; + if (tuplet_slur) + brack = make_tuplet_slur (me, points[LEFT], points[RIGHT]); + else + brack = make_bracket (me, Y_AXIS, + points[RIGHT] - points[LEFT], + height, + /* + 0.1 = more space at right due to italics + TODO: use italic correction of font. + */ + Interval (-0.5, 0.5) * gap + 0.1, + flare, shorten); for (LEFT_and_RIGHT (d)) { @@ -392,10 +441,13 @@ Tuplet_bracket::print (SCM smob) mol.add_stencil (brack); } - mol.translate (points[LEFT]); + if (!tuplet_slur) + mol.translate (points[LEFT]); + return mol.smobbed_copy (); } + /* should move to lookup? @@ -842,6 +894,7 @@ ADD_INTERFACE (Tuplet_bracket, "note-columns " "padding " "tuplet-number " + "tuplet-slur " "scripts " "shorten-pair " "staff-padding " diff --git a/scm/define-grob-properties.scm b/scm/define-grob-properties.scm index 34450a9..d34a416 100644 --- a/scm/define-grob-properties.scm +++ b/scm/define-grob-properties.scm @@ -1135,6 +1135,8 @@ direction and it is associated with a @code{ScriptColumn} object. @code{0.0} means centered on the note head (the default position of most scripts); @code{1.0} means centered on the stem. Interpolated values are possible.") + (tuplet-slur ,boolean? "Draw a slur instead of a bracket for +tuplets.") (transparent ,boolean? "This makes the grob invisible.") diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm index a04e070..fceb313 100644 --- a/scm/define-grobs.scm +++ b/scm/define-grobs.scm @@ -2611,6 +2611,7 @@ (staff-padding . 0.25) (stencil . ,ly:tuplet-bracket::print) (thickness . 1.6) + (tuplet-slur . #f) (vertical-skylines . ,grob::unpure-vertical-skylines-from-stencil) (X-positions . ,ly:tuplet-bracket::calc-x-positions) -- 2.1.4
\version "2.19.55" #(define tuplet-proc (lambda (grob) (let* ((nc (ly:grob-object grob 'note-columns)) (stem (ly:grob-object (ly:grob-array-ref nc 0) 'stem)) (beam (ly:grob-object stem 'beam))) (if (and (ly:grob? beam) (eqv? (ly:grob-property beam 'direction) DOWN)) (begin (set! (ly:grob-property grob 'bracket-visibility) #t) (set! (ly:grob-property grob 'tuplet-slur) #t)))))) { \override TupletBracket.bracket-visibility = ##t \override TupletBracket.tuplet-slur = ##t \tuplet 3/2 { c''8 d'' e'' } \tuplet 3/2 { c'8 c' c' } \tuplet 3/2 { c'''8 c''' c''' } \tuplet 3/2 { c''8 g'' e' } \tuplet 5/4 { c''16 d'' e'' f'' g'' } \tuplet 5/4 { g''16 f'' e'' d'' c'' } \tuplet 5/4 { c'16 e' g' b' d' } \tuplet 5/4 { f'''16 d''' b'' g'' e'' } } { \override TupletBracket.direction = #UP \override TupletBracket.after-line-breaking = #tuplet-proc \tuplet 3/8 { c'16 d' c' } \tuplet 3/8 { c''16 d'' c'' } \tuplet 3/2 { c''2 c'' c'' } \tuplet 3/2 { c'2 c' c' } }
_______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user