Autor Thema: Haltestriche die Zweite  (Gelesen 1673 mal)

chf

  • Member
Haltestriche die Zweite
« am: Donnerstag, 10. September 2015, 18:48 »
Liebe Freunde,

harms großartiges Glissando
https://liarchiv.joonet.de/index.php?topic=1717.msg9504#msg9504
würde ich gerne so anwenden, dass alle Töne bis zum letzten Ton der Figur dauern und dass die Abstände der Noten innerhalb der Figur gleich erscheinen...

Über Hilfe freut sich
mit Gruß chf



harm6

  • Member
Re: Haltestriche die Zweite
« Antwort #1 am: Freitag, 11. September 2015, 01:59 »
Hallo,

zu müde für viel Text...

Das Grundproblem scheint zu sein, daß keine multiplen Glissandi von verschiedenen Startpunkten akzeptiert werden.

Insoweit 2. und 3. Stimme erforderlich.

Schau mal, ob Du mit dem code klar kommst, die scheme-Sachen sind unverändert.
Allerdings habe ich Dein Beispiel minimalisiert ;)

\version "2.18.2"

#(define get-grob-name
  (lambda (x) (if (ly:grob? x) (assq-ref (ly:grob-property x 'meta) 'name))))

#(define (get-grob-most-left-relative-coordinate ref-point)
  (lambda (grob)
      (cond
        ((eq? (get-grob-name grob) 'NoteColumn)
           (let* ((note-heads-array (ly:grob-object grob 'note-heads))
                  (note-heads-grobs
                    (if (not (null? note-heads-array))
                        (ly:grob-array->list note-heads-array)
                        '()))
                  (note-heads-refpoints
                    (map
                      (lambda (nh)
                        (ly:grob-relative-coordinate nh ref-point X))
                      note-heads-grobs))
                  (sorted-note-heads-refpoints (sort note-heads-refpoints <)))
            (if (not (null? sorted-note-heads-refpoints))
                (car sorted-note-heads-refpoints))))
         ((eq? (get-grob-name grob) 'AccidentalPlacement)
            (let* ((acc-list (ly:grob-object grob 'accidental-grobs))
                   (acc-refpoints
                     (map
                       (lambda (acc)
                         (ly:grob-relative-coordinate (cadr acc) ref-point X))
                       acc-list))
                   (sorted-acc-refpoints (sort acc-refpoints <)))
             (if (not (null? sorted-acc-refpoints))
                 (car sorted-acc-refpoints))))
         (else
           (if (ly:grob? grob)
               (ly:grob-relative-coordinate grob ref-point X))))))
               
#(define* (duration-line #:optional (equal-start? #f))
   (lambda (grob)
     (let* ((line-thickness (ly:staff-symbol-line-thickness grob))
            (staff-space (ly:staff-symbol-staff-space grob))
            (refp (ly:grob-system grob))
            (note-head? (lambda (x) (eq? (get-grob-name x) 'NoteHead)))
            (half-gliss-thick (- (/ staff-space 2) line-thickness))
            (thickness
              ;; (- half-gliss-thick 0.23) is my personal taste
              ;; If other value wanted, use common 'thickness override
              (ly:grob-property grob 'thickness (- half-gliss-thick 0.23)))
            (blot-diameter
              (ly:output-def-lookup (ly:grob-layout grob) 'blot-diameter))
       ;;;; left NoteColumn
            (left-Y (assoc-get 'Y (ly:grob-property grob 'left-bound-info)))
            (left-bound (ly:spanner-bound grob LEFT))
            (left-note-column (ly:grob-parent left-bound X))
            (left-note-col-X-ext
              (ly:grob-extent left-note-column left-note-column X))
            (left-note-column-coord
              (ly:grob-relative-coordinate left-note-column refp X))
       ;;;; DotColumn of left NoteColumn
            (dot-column-left (ly:note-column-dot-column left-note-column))
            (dot-column-left-X-extent
              (if (ly:grob? dot-column-left)
                  (ly:grob-extent dot-column-left dot-column-left X)
                  '(0 . 0)))
       ;;;; right NoteColumn
            (right-bound (ly:spanner-bound grob RIGHT))
            (right-bound-info (ly:grob-property grob 'right-bound-info))
            (right-note-column (ly:grob-parent right-bound X))
            (most-left-note-head-coord
             ((get-grob-most-left-relative-coordinate refp) right-note-column))
       ;;;; AccidentalPlacement of right NoteColumn
            (acc-placement (ly:note-column-accidentals right-note-column))
            (most-left-note-acc-coord
             ((get-grob-most-left-relative-coordinate refp) acc-placement))
       ;;;; Arpeggio of right NoteColumn
            (arpeggio (ly:grob-object right-note-column 'arpeggio))
            (arpeggio-coord
              (if (ly:grob? arpeggio)
                  (ly:grob-relative-coordinate arpeggio refp X)))
       ;;;; calculate most right left-bound coord
            (most-right-left-bound-coord
              (+ left-note-column-coord
                (cdr left-note-col-X-ext)
                (cdr dot-column-left-X-extent)))
       ;;;; catch most left right-bound coord
            (right-bound-coords-lst
              (list
                arpeggio-coord
                most-left-note-acc-coord
                most-left-note-head-coord))
            (cleared-right-bound-coords-lst
                (sort
                  (remove (lambda (x) (not (number? x))) right-bound-coords-lst)
                  <)))

    ;; create a flat glissando
    (ly:grob-set-nested-property! grob '(right-bound-info Y) left-Y)
   
    ;; Let all glissandi start at the same vertical position
    (if (and (note-head? left-bound) equal-start?)
        (ly:grob-set-nested-property!
          grob
          '(left-bound-info X)
          most-right-left-bound-coord))
       
    ;; Let all glissandi end at the same vertical position
    (if (note-head? right-bound)
        (ly:grob-set-nested-property!
          grob
          '(right-bound-info X)
          (car cleared-right-bound-coords-lst)))

    ;; print new stencil
    (let* ((stencil (ly:line-spanner::print grob))
           (stencil-x-ext
             (if (ly:stencil? stencil)
                 (ly:stencil-extent stencil X)
                 '(0 . 0)))
           (new-stencil
             (ly:round-filled-box
                stencil-x-ext
                (interval-widen (cons left-Y left-Y) thickness)
                blot-diameter)))
     new-stencil))))
     
gliss-length =
#(define-music-function (parser location lngth)(number?)
#{
  \once \override Glissando.minimum-length = #lngth
#})
     
durationLine =
#(define-music-function (parser location equal-start? left-right-padding)
   ((boolean? #f) pair?)
#{
  \override Glissando.stencil = #(duration-line equal-start?)
  \override Glissando.bound-details.left.padding = #(car left-right-padding)
  \override Glissando.bound-details.right.padding = #(cdr left-right-padding)
  \override Glissando.bound-details.left-broken.padding = #0.5
  \override Glissando.bound-details.right-broken.padding = #0.3   
#})

durationLineSettings = {
  \durationLine #'(-0.5 . 0.6)
  %% For equal glissando-start with little padding use:
  % \durationLine ##t #'(0.5 . 0.6)
 
  %% other possible settings
  %\override Glissando.thickness = #0.2
  \override Glissando.breakable = ##t
  \override Glissando.after-line-breaking = ##t
  \override Glissando.springs-and-rods = #ly:spanner::set-spacing-rods
 
  %% construction helpers, DELETE ME
  %\override Glissando.layer = #20
  %\override Glissando.color = #red
}

\new Staff <<
  \new Voice
    \with {
      \durationLine #'(-0.5 . -0.6)
    }
    \relative c' {
      \cadenzaOn
      \gliss-length #20
      g8[\glissando
      \override NoteColumn.glissando-skip = ##t
      fis'
      fis
      a
      a
      \revert NoteColumn.glissando-skip
      bes']
    }
  \new Voice
    \with {
      \override Stem.stencil = #point-stencil
      \override Flag.stencil = #point-stencil
      \durationLine #'(-0.5 . -0.6)
    }
    \relative {
        \voiceTwo
        s4
        fis'8\glissando
        s4
        bes'8
    }
  \new Voice
    \with {
      \override Stem.stencil = #point-stencil
      \override Flag.stencil = #point-stencil
      \override NoteHead.stencil = #point-stencil
      \durationLine #'(-0.5 . -0.6)
    }
    \relative {
        \voiceThree
        s2
        a'8\glissando
        bes'8
    }
       
>>

\layout {
  \durationLineSettings
}


HTH,
  Harm

chf

  • Member
Re: Haltestriche die Zweite
« Antwort #2 am: Montag, 14. September 2015, 17:58 »
Hallo Harm,

es hat geholfen! Danke!