lilypond-devel
[Top][All Lists]
Advanced

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

Re: shape and chords


From: Jan-Peter Voigt
Subject: Re: shape and chords
Date: Tue, 26 Jun 2012 10:51:33 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:13.0) Gecko/20120614 Thunderbird/13.0.1

Hi David,

On 25.06.2012 18:23, David Nalesnik wrote:
I tried to fix what was amiss in your adaptation of \shape, but I didn't get very far. This problem seems very complex, and I was only able to get results by "starting from the ground up" -- namely, adding to the function I initially sent. It's awfully compressed. Hopefully, this is another step in the right direction.
it is! Thank you very much!
Your example is working as expected :)

To make it (more) usable, I think, we need wrapper functions, to avoid twiggling with endless listoflistoflistofnumberpairs ;-)

The check, if one offset-list is a list of lists, like in \shape, is IMO not needed here, because it gets more confusing, if we allow leaving the structure: list-of-ties -> list-of-siblings -> list-of-offsets. And the other code is about the flexibility to change between different grobs (Tie,Slur,etc). In this code, we are talking only about TieColumns.

In my short test, I thought of having tie-configuration and shape combined, so that one can set the direction of the ties, before shaping them. The downside is, that using this also needs the staff-positions to be set - so I doubt, this is useful:

--snip--
confShapeTieColumn =
#(define-music-function (parser location conf all-offsets)(list? list?)
   (let ((alb-func (lambda (grob)
(let ((ties (ly:grob-array->list (ly:grob-object grob 'ties))))
                       (for-each
                        (lambda (tie offsets-for-broken-pair)
                          (let* ((orig (ly:grob-original tie))
                                 (siblings (ly:spanner-broken-into orig)))
                            (for-each
                             (lambda (piece offsets-for-piece)
                               (if (pair? offsets-for-piece)
(set! (ly:grob-property piece 'control-points)
                                         (map
(lambda (x y) (coord-translate x y))
(ly:tie::calc-control-points piece)
                                          offsets-for-piece))
                                   ))
                             (if (null? siblings)
                                 (list orig)
                                 siblings)
                             offsets-for-broken-pair)))
                        ties all-offsets)))
           ))
     (make-music 'SequentialMusic
       'elements (list
                  (make-music 'ContextSpeccedMusic
                    'context-type 'Bottom
                    'element (make-music 'OverrideProperty
                               'once #t 'pop-first #t
                               'grob-property-path '(tie-configuration)
                               'grob-value conf 'symbol 'TieColumn))
                  (make-music 'ContextSpeccedMusic
                    'context-type 'Bottom
                    'element (make-music 'OverrideProperty
                               'once #t 'pop-first #t
                               'grob-property-path '(after-line-breaking)
                               'grob-value alb-func 'symbol 'TieColumn))
                  ))
     ))

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{
  <d' e' g' a'>1 ~
  \confShapeTieColumn
  #'( (-6 . 1) (-4 . 1) (-2 . 1) (0 . 1) )
  #'(
     ( ((0 . 0)(0 . 0)(0 . 0)(0 . 0)) )
     )
  q
}
--snip--

For completeness I created drafts for RepeatTieColumns and LaissezVibrerTieColumns. Note that after-line-breaking is reasonably not called, so I used before-line-breaking here:
--snip--

shapeLaissezVibrerTieColumn =
#(define-music-function (parser location all-offsets) (list?)
   #{
     \once \override LaissezVibrerTieColumn #'before-line-breaking =
     #(lambda (grob)
        (let ((ties (ly:grob-array->list (ly:grob-object grob 'ties))))
          (for-each
           (lambda (tie offsets-for-piece)
                  (if (pair? offsets-for-piece)
                      (set! (ly:grob-property tie 'control-points)
                            (map
                             (lambda (x y) (coord-translate x y))
                             (ly:tie::calc-control-points tie)
                             offsets-for-piece))
                      ))
           ties all-offsets)
          #t
          ))
   #})
shapeRepeatTieColumn =
#(define-music-function (parser location all-offsets) (list?)
   #{
     \once \override RepeatTieColumn #'before-line-breaking =
     #(lambda (grob)
        (let ((ties (ly:grob-array->list (ly:grob-object grob 'ties))))
          (for-each
           (lambda (tie offsets-for-piece)
                  (if (pair? offsets-for-piece)
                      (set! (ly:grob-property tie 'control-points)
                            (map
                             (lambda (x y) (coord-translate x y))
                             (ly:tie::calc-control-points tie)
                             offsets-for-piece))
                      ))
           ties all-offsets)
          #t
          ))
   #})
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{
  <d' e' g' a'>1
  \shapeLaissezVibrerTieColumn #'(
                                     ((0 . 0)(2 . 0)(4 . 0)(6 . 0))
                                     ((0 . 0)(2 . 0)(4 . 0)(6 . 0))
                                     ((0 . 0)(2 . 0)(4 . 0)(6 . 0))
                                     ((0 . 0)(2 . 0)(4 . 0)(6 . 0))
                                     )
  q\laissezVibrer
  \shapeRepeatTieColumn #'(
                                     ((-6 . 0)(-4 . 0)(-2 . 0)(0 . 0))
                                     ((-6 . 0)(-4 . 0)(-2 . 0)(0 . 0))
                                     ((-6 . 0)(-4 . 0)(-2 . 0)(0 . 0))
                                     ((-6 . 0)(-4 . 0)(-2 . 0)(0 . 0))
                                     )
  q\repeatTie
}
--snip--


Best, Jan-Peter




reply via email to

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