lilypond-user
[Top][All Lists]
Advanced

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

Re: Tie settings question


From: David Nalesnik
Subject: Re: Tie settings question
Date: Tue, 25 Oct 2016 10:37:32 -0500

Hi Karol,

On Tue, Oct 25, 2016 at 9:35 AM, Karol Majewski <address@hidden> wrote:
> OK, I'm trying to write something like this in scheme:
>
> if (stem-direction == UP && tie-direction == UP && note-has-a-dot == true)
> {
>   \once \override Tie.details.skyline-padding = #5
>   \once \override Tie.Y-offset = #-0.25
> }
>
> Please, David or Harm, correct my mistakes. So far I've got this:
>
> raiseTie =
> #(lambda
>   (grob)
>   (let*
>     ((ties
>         (ly:grob-array->list
>           (ly:grob-object grob 'ties)))

"tie" is not a defined variable.  When you bind "tie-dir" to a
procedure, it will be evaluated, so "tie" has to be defined.

>       (tie-dir
>         (ly:grob-property tie 'direction))
>       (notehead
>         (ly:spanner-bound
>           (car ties) LEFT))
>       (stem
>         (ly:grob-object notehead 'stem))
>       (stem-dir
>         (ly:grob-property stem 'direction))
>       (flag
>         (ly:grob-object stem 'flag))

grob = TieColumn.  TieColumn grobs store no reference to augmentation
dots.  'dot is a part of the rhythmic-head-interface
(http://lilypond.org/doc/v2.19/Documentation/internals/rhythmic_002dhead_002dinterface)
which is supported by NoteHead.

>       (dot (ly:grob-object grob 'dot)))
>     (if

Again, "tie" is not defined.

>       (and (= stem-dir 1) (= tie-dir 1) (ly:grob? dot))
>       (begin

"tie" is bound locally here.  It is only usable within the lambda expression.

>         (for-each
>           (lambda
>             (tie)
>             (ly:grob-set-nested-property! tie '(details skyline-padding) 5)) 
> ties)
>         (for-each
>           (lambda
>             (tie)
>             (ly:grob-set-property! tie 'Y-offset -0.25)) ties)))))
>
> \layout {
>   \context {
>     \Score
>     \override TieColumn.before-line-breaking = #raiseTie
>   }
> }
>
>

Try this:
raiseTie =
#(lambda (grob)
   (let* ((ties (ly:grob-array->list (ly:grob-object grob 'ties)))
          (notehead (ly:spanner-bound (car ties) LEFT))
          (stem (ly:grob-object notehead 'stem))
          (stem-dir (ly:grob-property stem 'direction))
          (flag (ly:grob-object stem 'flag))
          (dot (ly:grob-object notehead 'dot)))
     (if (and (= stem-dir 1)(ly:grob? dot))
         (for-each
          (lambda (tie)
            (let ((tie-dir (ly:grob-property tie 'direction)))
              (if (= tie-dir 1)
                  (begin
                   (ly:grob-set-nested-property! tie '(details
skyline-padding) 5)
                   (ly:grob-set-property! tie 'Y-offset -0.25)))))
          ties))))

\layout {
  \context {
    \Score
    \override TieColumn.before-line-breaking = #raiseTie
  }
}

{
  \time 3/8 \voiceOne
  g'4~ g'8~
  g'4~ g'8~
  g'4.~
  g'4~ g'8
}

%%%%

I hope this helps.  You'll probably need to retool it to incorporate
the features you began the thread with, but this should give you an
idea of the principles involved.

David



reply via email to

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