Crossstaff position tolerance

2019-10-25 Thread Andrew Bernard
What is the position tolerance distance for cross staff stems to work?
Zero? Or is there some wriggle room?

I ask because I have a complex (as always) bit of free form music with
different overlapping tuplet ratios in different voices that is just more
or less 'thrown on the page' by the composer for this small section of a
dozen bars, but there are cross staff stems tying staff objects together
from time to time. Perhaps If I could manually offset the stems by some
amount I could get various stems to line up.

Andrew


Re: Tweaking glissando timing stems

2019-10-25 Thread Leo Correia de Verdier
Brilliant!

I realized that defining the glissando gradient taking the stencil as point of 
departure, rather than the grob properties, makes it work for broken glissandi 
too. It was a quite minimal change. 

(gliss-gradient (/ (+ (- (car stil-y-ext) (cdr stil-y-ext)) (* half-line-thick 
2))
(+ (- (car stil-x-ext) (cdr stil-x-ext)) (* 
half-line-thick 2)) 
(if (> Y-right Y-left) 1 -1)))

Like


glissando-stems-05.ly
Description: Binary data

> 22 okt. 2019 kl. 13:33 skrev Thomas Morley :
> 
> Am Sa., 19. Okt. 2019 um 12:36 Uhr schrieb Thomas Morley
> :
> 
>> Meanwhile I've probably found a method to affect Beams from inside a
>> Glissando.after-line-breaking, but currently it's not mature to say
>> more.
>> Anyway, my goal will be to make Beams parallel to the glissando-line,
>> I don't think doing differnt makes any sense.
> 
> Attached the next iteration.
> Per default all Beams are parallel to the glissando.
> Though, I implemented the possibility to reset their position by using
> the new introduced subproperty beamed-glissando-stem-positions of
> details.
> See examples (with unusual values, just to see it works)
> 
> Broken glissandi are not yet supported, the code will not error, but
> the numerical calculations are not longer correct in this case.
> 
> At any rate, the code becomes a monster lol
> 
> Cheers,
>  Harm
\version "2.19.83"


#(define (make-cross-stencil coords)
  (let ((thick 0.1)
(sz 0.2))
 (ly:stencil-add
   (make-line-stencil 
 thick
 (- (car coords) sz) 
 (- (cdr coords) sz)
 (+ (car coords) sz) 
 (+ (cdr coords) sz))
   (make-line-stencil 
 thick
 (- (car coords) sz) 
 (+ (cdr coords) sz)
 (+ (car coords) sz) 
 (- (cdr coords) sz)
 
#(define (line-gradient x-positions y-positions)
  (/
 (- (cdr y-positions) 
(car y-positions))
 (- (cdr x-positions) 
(car x-positions

  
%% Glissando has no pointer to the covered NoteColumns, because in most 
%% traditional music NoteColumns are *not* skipped.
%% Thus reading those NoteColumns is inconvenient.
#(define (glissando-and-stems pad-y)
  (lambda (grob)
(let* ((layout (ly:grob-layout grob))
   (blot (ly:output-def-lookup layout 'blot-diameter))
   (staff-space (ly:staff-symbol-staff-space grob))
   (half-line-thick (/ (ly:staff-symbol-line-thickness grob) 2))
   (original (ly:grob-original grob))
   (left-bound (ly:spanner-bound original LEFT))
   (right-bound (ly:spanner-bound original RIGHT))
   (left-bound-when (grob::when left-bound))
   (right-bound-when (grob::when right-bound))
   (stil (ly:grob-property grob 'stencil))
   ;(stil (ly:line-spanner::print grob))
   (stil-x-ext (ly:stencil-extent stil X))
   (stil-y-ext (ly:stencil-extent stil Y))
   (left-bound-info (ly:grob-property grob 'left-bound-info))
   (X-left (assoc-get 'X left-bound-info))
   (Y-left (assoc-get 'Y left-bound-info))
   (left-padding (assoc-get 'padding left-bound-info))
   (right-bound-info (ly:grob-property grob 'right-bound-info))
   (X-right (assoc-get 'X right-bound-info))
   (Y-right (assoc-get 'Y right-bound-info))
   (gliss-gradient (/ (- Y-right Y-left) (- X-right X-left)))
   (sys (ly:grob-system grob))
   (sys-elts-array (ly:grob-object sys 'all-elements))
   (ncs 
 (filter
   (lambda (elt)
 (let (;; Going for `ly:grob-relative-coordinate´ disturbs
   ;; vertical spacing, thus we sort/filter using
   ;; `grob::when´
   (elt-when (grob::when elt)))
   (and
 (grob::has-interface elt 'note-column-interface)
 (ly:grob-property elt 'glissando-skip #f)
 (ly:grob-array? (ly:grob-object elt 'note-heads))
 (ly:momentlist sys-elts-array)))
   ;; Stems from all NoteColumns covered by the Glissando
   (stems
 (map
   (lambda (nc) (ly:grob-object nc 'stem))
   ncs))
   ;; Mmhh, why do we need that?
   (stem-begin-positions
 (map
   (lambda (stem)
 (ly:grob-property stem 'stem-begin-position))
   stems))
   (stem-x-coord-proc
 (lambda (nc)
   (ly:grob-relative-coordinate (ly:grob-object nc 'stem) sys X)))
   (stems-x-coords
 (map stem-x-coord-proc ncs))
   ;; TODO for broken glissandi this is not exact
   (gliss-stem-intersections
 (map
   (lambda (stem-x-coord)
 (cons
   ;; TODO do we need the x-value at all?
   (+
  (- stem-x-coord X-left)
  

Arpeggio misbehaviour?

2019-10-25 Thread Federico Sarudiansky
Hello,

I'm typesetting a work which includes this single measure (here as a MWE)
in a PianoStaff.

\version "2.19.83"

\score {
 \new PianoStaff {
   \set PianoStaff.connectArpeggios = ##t
   <<
 \new Staff \with { \consists "Span_arpeggio_engraver" } \relative c''
{ \clef treble \time 6/8 b4. 8 \arpeggio r r}
 \new Staff \with { \consists "Span_arpeggio_engraver" } {
   <<
   \new Voice {  \voiceOne \relative c' {aes4( g8) s4.}}
   \new Voice {  \voiceTwo \relative c, { \clef bass \time 6/8 f4. 8 \arpeggio \oneVoice r r }}
   >>
   }
   >>
 }
}

Without tweaking anything, the arpeggio symbol is mispositioned. Is this a
bug? I'm missing something? What do you think is the best workaround for
this? I tried overriding Arpeggio.padding and (somewhat more brute-force)
NoteColumn.X-offset but I feel there is a better solution for this.

Thanks in advance!

F.
\version "2.19.83"

\score {
 \new PianoStaff {
   \set PianoStaff.connectArpeggios = ##t
   <<
 \new Staff \with { \consists "Span_arpeggio_engraver" } \relative c'' { \clef treble \time 6/8 b4. 8 \arpeggio r r}
 \new Staff \with { \consists "Span_arpeggio_engraver" } {
   <<
   \new Voice {  \voiceOne \relative c' {aes4( g8) s4.}}
   \new Voice {  \voiceTwo \relative c, { \clef bass \time 6/8 f4. 8 \arpeggio \oneVoice r r }}
   >>
   }
   >>
 }
}