I have struggling for a while with few measures and I am currently a bit
frustrated. I use the great fancy glissando from LSR 1066
(http://lsr.di.unimi.it/LSR/Item?id=1066) to write some chaotic
glissandi. The players should start one after the other. For that
purpose the composer used a triplet as then notation.

I think I got a acceptable result in the score. The starting points of
the glissando lines are a bit too far from the note heads though.

But it's hard to generate the parts. I tried \keepWithTag for the first
time to get just one item of the triplet. But now I get even more
unexpected results. The first part has a double glissando surprisingly.
The line ends not before but inside the terminating chord. The second
part has an additional gap between the starting chord and the begin of
the glissando line.

How can this be fixed (double line terminating x position in 1st part)
and improved (distance in 2nd and 3rd part)?

The example is not very minimal. But I hope it's short enough. The file
from the LSR is attached as file because I don't think that's in
question. The score in question is below.


Best regards,
Helge


\version "2.19.81"
\language "deutsch"

\include "FancyGliss.ily"


scoreDUpperHarpI = \relative c'' {
  \override Glissando.cross-staff = ##t
  \fancy-gliss
        #'(
         (.5 -2)
         (1 -0.5)
         (1.5 -3)
         (2 0)
         (2.5 -12)
         (3 0)
         )

    \tag #'partiture {
       \hideNotes e'8*16\glissando  \unHideNotes
    < h h'>4 r
    }
    \tag #'partI {
      \tuplet 3/2 { <cis, d a' es'>8\glissando
                    \temporary \override NoteColumn.glissando-skip = ##t
                    r r }
      s8*14

    \revert NoteColumn.glissando-skip
    < h h'>4 r
    }
}

scoreDLowerHarpI = \relative c' {
  \time 2/4
   s2 s s s
   r4 r
}

scoreDUpperHarpII = \relative c'' {
    \tag #'partII {
      \tuplet 3/2 { r8 <cis d a' es'>8 r
      }
      \override Glissando.cross-staff = ##t
      \fancy-gliss
        #'(
         (0.8 -14)
         (2.4 2)
         )
      \hideNotes g'8*14\glissando  \unHideNotes
      \revert NoteColumn.glissando-skip
      < h h'>4 r
    }
    \tag #'partiture
    {
      s8
      \override Glissando.cross-staff = ##t
      \fancy-gliss
        #'(
         (0.8 -14)
         (2.4 2)
         )
      \hideNotes e8*15\glissando  \unHideNotes
      < h h'>4 r
    }
}

scoreDLowerHarpII = \relative c' {
   \time 2/4
   s2 s s s
   r4 r
}

scoreDUpperHarpIII = \relative c'' {
  |
    \tuplet 3/2 {
      \tag #'partiture {
        \voiceTwo
        \change Staff=upperI <cis d a' es'>8
        \change Staff=upperII <cis d a' es'>
        \change Staff=upperIII <cis d a' es'>
      }
      \tag #'partIII {
        r8 r <cis d a' es'>

      }
    }
    \override Glissando.cross-staff = ##t
    \fancy-gliss
        #'(
         (.1 -4)
         (.6 -2.5)
         (1.4 -5)
         (1.6 -2.5)
         (2.1 -14)
         (2.6 0)
         )
     \stemNeutral
    \hideNotes e8*14\glissando  \unHideNotes
    < h' h'>4 r
}

scoreDLowerHarpIII = \relative c' {
  \time 2/4
  s2 s s s
  r4 r
}


%% =========================================================
scoreDHarpIPart = \new PianoStaff <<
  \new Staff = "upperI"  <<  \scoreDUpperHarpI >>
  \new Staff = "lowerI"  { \clef bass \scoreDLowerHarpI }
>>

scoreDHarpIIPart = \new PianoStaff <<
  \new Staff = "upperII"  << \scoreDUpperHarpII >>
  \new Staff = "lowerII"  { \clef bass \scoreDLowerHarpII }
>>

scoreDHarpIIIPart = \new PianoStaff <<
  \new Staff = "upperIII"  << \scoreDUpperHarpIII >>
  \new Staff = "lowerIII"  { \clef bass \scoreDLowerHarpIII }
>>

\book {
    \bookpart {
    \score {
      \keepWithTag #'partiture
      <<
        \scoreDHarpIPart
        \scoreDHarpIIPart
        \scoreDHarpIIIPart
      >>
    }

    \score { \keepWithTag #'partI  \scoreDHarpIPart }
    \score { \keepWithTag #'partII \scoreDHarpIIPart }
    \score { \keepWithTag #'partIII \scoreDHarpIIIPart }
  }
}
lengthen-gliss =
#(define-music-function (parser loation nmbr)(number?)
#{
  \once \override Glissando.springs-and-rods = #ly:spanner::set-spacing-rods
  \once \override Glissando.minimum-length = #nmbr
#})

fancy-gliss =
#(define-music-function (parser location pts-list)(list?)
#{
 \once \override Glissando.after-line-breaking =
  #(lambda (grob)
    (let ((stil (ly:line-spanner::print grob)))
     (if (ly:stencil? stil)
         (let*
           ((left-bound-info (ly:grob-property grob 'left-bound-info))
            (left-bound (ly:spanner-bound grob LEFT))
            (y-off (assoc-get 'Y left-bound-info))
            (padding (assoc-get 'padding left-bound-info))
            (note-column (ly:grob-parent left-bound X))
            (note-heads (ly:grob-object note-column 'note-heads))
            (ext-X
              (if (null? note-heads)
                  '(0 . 0)
                  (ly:relative-group-extent note-heads grob X)))
            (dot-column (ly:note-column-dot-column note-column))
            (dots
              (if (null? dot-column)
                  '()
                  (ly:grob-object dot-column 'dots)))
            (dots-ext-X
              (if (null? dots)
                  '(0 . 0)
                  (ly:relative-group-extent dots grob X)))
            (factor
              (/ (interval-length (ly:stencil-extent stil X))
                 (car (take-right (last pts-list) 2))))
            (new-stil
              (make-connected-path-stencil
                (map
                  (lambda (e)
                    (cond ((= (length e) 2)
                           (cons (* (car e) factor) (cdr e)))
                          ((= (length e) 6)
                           (list
                             (* (car e) factor)
                             (cadr e)
                             (* (third e) factor)
                             (fourth e)
                             (* (fifth e) factor)
                             (sixth e)))
                          (else
                            (ly:error
                              "Some element(s) of the given list do not fit"))))
                  pts-list)
                (layout-line-thickness grob) ;line-width
                1   ;scaling
                1   ;scaling
                #f
                #f)))
         (ly:grob-set-property! grob 'stencil
           (ly:stencil-translate
            new-stil
            (cons (+ (interval-length ext-X)
                     (interval-length dots-ext-X)
                     padding)
                  y-off))))
       (begin
         (ly:warning
           "Cannot find stencil. Please set 'minimum-length accordingly")
         #f))))
#})

%% comment me
%#(display "\n\tLimitations:
%\t-Does not work with line-break
%\t-dotted notes with glissando may return a warning for unknown reasons,
%\t strange things may happen, if contexts die prematurely")
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to