[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Tuplet number direction
From: |
Richard Shann |
Subject: |
Re: Tuplet number direction |
Date: |
Thu, 14 Apr 2016 18:01:21 +0100 |
This looks very nice, thank you!
I'll have to see how it interacts with the graphical slur shape tweaking
code in Denemo.
Richard
On Thu, 2016-04-14 at 08:20 -0700, tisimst wrote:
> Richard,
>
> On Thu, Apr 14, 2016 at 1:53 AM, Richard Shann-2 [via Lilypond]
> <[hidden email]> wrote:
> On Wed, 2016-04-13 at 23:28 +0200, Thomas Morley wrote:
> > 2016-04-13 15:06 GMT+02:00 Richard Shann <[hidden email]>:
> > > Thanks Abraham, that's most informative.
> > > Thinking about it, I wonder if I've missed something: is
> there a way to
> > > say typeset the tuplet bracket like a slur, with the
> tuplet number
> > > inside?
> >
> > I once made the attached code.
> > Maybe you can adapt it to fit your needs.
>
> Hmm, quite a battle to get that I see! In fact your code does
> something
> extra-fancy compared with the commonplace examples I see in
> old prints,
> namely the tuplet number cuts into the slur. Typically the
> tuplet number
> is inside the slur, which happened by default in LilyPond once
> I set the
> direction. I was hoping it might be possible just to set the
> tuplet
> number direction to be the same as a slur would be - I don't
> mind adding
> the slur manually.
>
>
> Here's a customized variant of Harm's function that does more of what
> you want by moving the slur outside the TupletNumber without cutting
> it in half. Like Simon eluded to, though, it would need some work to
> be robust enough to be incorporated into LilyPond core. Anyway, here's
> the function for your enjoyment:
>
>
> %%%%%%%%%%%%%%%%
>
>
> \version "2.18.2"
>
>
> tupletBracketToSlur = {
> % Use slur-stencil
> \override TupletBracket.stencil = #ly:slur::print
>
> %% Use 'thickness from Slur
> \override TupletBracket.thickness = #1.2
>
> %% 'control-points need to be set
> \override TupletBracket.control-points =
> #(lambda (grob)
> (let* ((x-pos (ly:grob-property grob 'X-positions))
> (pos (ly:grob-property grob 'positions))
> (x-ln (interval-length x-pos))
> (dir (ly:grob-property grob 'direction))
> ;; read out the height of the TupletBracket, maybe
> negative!
> (height (- (cdr pos) (car pos)))
> ;; height-corr is introduced because sometimes the shape
> of the
> ;; slur needs to be adjusted.
> ;; It is used in the 2nd/3rd control-point.
> ;; The value of 0.3 is found by trial and error
> (height-corr (* 0.3 dir height))
> (edge-height (ly:grob-property grob 'edge-height '(0.7 .
> 0.7)))
> (pad 1.0))
>
> (list
> ;; first cp
> (cons
> (+ (car x-pos) 0.5)
> (- (+ (* dir pad) (+ (car pos) (* -1 dir (car
> edge-height))))
> (if (= dir -1)
> (if (> height 3)
> (/ dir 2.0)
> 0.0)
> (if (< height -3)
> (/ dir 2.0)
> 0.0))))
> ;; second cp
> (cons
> (+ (car x-pos) (* x-ln 1/4))
> (+ (* dir pad) (+ (car pos) (* dir (+ 0.5 height-corr)))))
> ;; third cp
> (cons
> (+ (car x-pos) (* x-ln 3/4))
> (+ (* dir pad) (+ (cdr pos) (* dir (- 0.5 height-corr)))))
> ;; fourth cp
> (cons
> (- (cdr x-pos) 0.5)
> (+ (* dir pad) (+ (cdr pos) (* -1 dir (cdr
> edge-height)))))
> )))
>
> \override TupletBracket.staff-padding = #'()
>
> }
>
>
> %%%%%%%%%%%%%%%%%%% Example %%%%%%%%%%%%%%%%%%%%%
>
>
>
> music = \relative c'' {
> \tuplet 3/2 4 { a8 b c a b c' a, b c, a' b, c }
> \tuplet 5/4 2 { a' b c d e a,, b c' d e }
> \tuplet 5/4 2 { a b c, d e a b, c d, e }
> \break
> }
>
>
> \layout {
> indent = 0
> \tupletBracketToSlur
> \omit Staff.TimeSignature
>
> \omit Score.BarNumber
> }
>
>
>
> \score {
> { \music }
> \header { piece = "Default" }
> }
>
>
> \score {
> { \tupletUp \music }
> \header { piece = "TupletBracket forced UP" }
> }
>
>
> \score {
> { \tupletDown \music }
> \header { piece = "TupletBracket forced DOWN" }
> }
>
>
> \score {
>
> { \voiceOne \music }
> \header { piece = "All forced UP (\voiceOne)" }
> }
>
>
> \score {
> { \voiceTwo \music }
> \header { piece = "All forced DOWN (\voiceTwo)" }
> }
>
>
> %%%%%%%%%%%%%%%%
>
>
>
> It does a pretty good job and follows the slope of the stems/beam,
> though there are likely to be cases where the curve is not perfect
> (like one or two in my example).
>
>
> HTH,
> Abraham
>
>
> ______________________________________________________________________
> View this message in context: Re: Tuplet number direction
> Sent from the User mailing list archive at Nabble.com.
> _______________________________________________
> lilypond-user mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/lilypond-user
- Re: Tuplet number direction, (continued)
- Re: Tuplet number direction, Thomas Morley, 2016/04/13
- Re: Tuplet number direction, Simon Albrecht, 2016/04/13
- Re: Tuplet number direction, Thomas Morley, 2016/04/13
- Re: Tuplet number direction, Werner LEMBERG, 2016/04/14
- Re: Tuplet number direction, Simon Albrecht, 2016/04/14
- Re: Tuplet number direction, Richard Shann, 2016/04/14
- Re: Tuplet number direction, tisimst, 2016/04/14
- Re: Tuplet number direction,
Richard Shann <=
- Re: Tuplet number direction, Richard Shann, 2016/04/14
- Re: Tuplet number direction, Thomas Morley, 2016/04/14
- Re: Tuplet number direction, Simon Albrecht, 2016/04/14
- Re: Tuplet number direction, David Kastrup, 2016/04/15
- Re: Tuplet number direction, Phil Holmes, 2016/04/15
- Re: Tuplet number direction, David Kastrup, 2016/04/15
- Re: Tuplet number direction, David Kastrup, 2016/04/15
- Re: Tuplet number direction, Simon Albrecht, 2016/04/15
- Re: Tuplet number direction, David Nalesnik, 2016/04/15
- Re: Tuplet number direction, Thomas Morley, 2016/04/15