Dear community,
I have to typeset a piece, that makes use of controlled aleatorism, in the
way like composers as Lutoslaswki have done it.
I have the problem, that the arrow at the end of the textspanner occurs two
times, at the end of the first and at the beginning of the next line.
How can I solve this problem?
Here is the snippet:
begin %%
\version "2.12.2"
#(define (repOn-callback callback)
(define (repOn-stencil grob)
(let* ((dot (ly:font-get-glyph (ly:grob-default-font grob) "dots.dot"))
(s (callback grob))
(sx (cons 0 0))
(sy (cons 0 0))
(dotx (ly:stencil-extent dot 0))
(doty (ly:stencil-extent dot 1))
(yadj (/ (interval-length doty) 2))
(xadj (/ (interval-length dotx) 2)))
(set! s (ly:stencil-add
(ly:stencil-translate dot (cons (- 0 xadj) 0.5))
(ly:stencil-translate dot (cons (- 0 xadj) -0.5))
(ly:make-stencil (list 'draw-line 0.12 -0.5 2 -0.5 -2) '(-0.55
.
0.45) '(2 . -2))
(ly:make-stencil (list 'draw-line 0.12 -0.5 2 0 3) '(-0.55 .
0.45) '(2 . -2))
(ly:make-stencil (list 'draw-line 0.12 -0.5 -2 0 -3) '(-0.55 .
0.45) '(2 . -2))
(ly:make-stencil (list 'draw-line 0.24 -0.88 2 -0.38 3)
'(-0.55 .
0.45) '(2 . -2))
(ly:make-stencil (list 'draw-line 0.24 -0.88 -2 -0.38 -3)
'(-0.55
. 0.45) '(2 . -2))
(ly:make-stencil (list 'round-filled-box 1 -0.76 2 2 0) '(-1 .
-1.1) '(2 . -2))
))
(ly:make-stencil (ly:stencil-expr (ly:stencil-translate s (cons 1 0)) )
sx
sy)
))
repOn-stencil)
#(define (repOff-callback callback)
(define (repOff-stencil grob)
(let* ((dot (ly:font-get-glyph (ly:grob-default-font grob) "dots.dot"))
(s (callback grob))
(sx (cons 0 0))
(sy (cons 0 0))
(dotx (ly:stencil-extent dot 0))
(doty (ly:stencil-extent dot 1))
(yadj (/ (interval-length doty) 2))
(xadj (/ (interval-length dotx) 2)))
(set! s (ly:stencil-add
(ly:stencil-translate dot (cons (- 0 xadj) 0.5))
(ly:stencil-translate dot (cons (- 0 xadj) -0.5))
(ly:make-stencil (list 'draw-line 0.12 0.5 2 0.5 -2) '(-0.55 .
0.45) '(2 . -2))
(ly:make-stencil (list 'draw-line 0.12 0.5 2 0 3) '(-0.55 .
0.45)
'(2 . -2))
(ly:make-stencil (list 'draw-line 0.12 0.5 -2 0 -3) '(-0.55 .
0.45) '(2 . -2))
(ly:make-stencil (list 'draw-line 0.24 0.88 2 0.38 3) '(-0.55
.
0.45) '(2 . -2))
(ly:make-stencil (list 'draw-line 0.24 0.88 -2 0.38 -3)
'(-0.55 .
0.45) '(2 . -2))
(ly:make-stencil (list 'round-filled-box -1 0.76 2 2 0) '(-1 .
-1.1) '(2 . -2))
))
(ly:make-stencil (ly:stencil-expr (ly:stencil-translate s (cons -1 0)) )
sx
sy)
))
repOff-stencil)
aleatorisch = #(define-music-function (parser location x y z )
(ly:music? ly:music? number? )
#{
\override Voice.TextSpanner #'bound-details #'right-broken
#'text = ##t
\override Voice.TextSpanner #'outside-staff-priority = ##f
\override Voice. TextSpanner #'Y-offset = #0
\override Voice.TextSpanner #'bound-padding = #2
\override Voice.TextSpanner #'style = #'line
\override Voice.TextSpanner #'thickness = #3 %dickere Linien
\override Voice.TextSpanner #'(bound-details right arrow) = ##t
\override Voice.TextSpanner #'(bound-details right padding) = $z %this
number defines the distance between the arrow and the following note or rest
\override Voice.TextSpanner #'(bound-details right stencil-align-dir-y) =
#CENTER
\override Voice.TextSpanner #'(bound-details left stencil-align-dir-y) =
#CENTER
\once \override Voice.Rest #'stencil = #(repOn-callback ly:rest::print)
r16
$x %the pattern, that has to repeated
\once \override Voice.NoteColumn #'X-offset = #1.0
\stopStaff
\once \override Voice.Rest #'stencil = #(repOff-callback
ly:rest::print) r16 \startTextSpan
\hideNotes $y %this are the invisible notes, that should follow the
pattern
\unHideNotes s1*0
\revert Voice.TextSpanner #'bound-padding
\revert Voice.TextSpanner #'style
\revert Voice.TextSpanner #'(bound-details right arrow)
\revert Voice.TextSpanner #'(bound-details right padding)
\revert Voice.TextSpanner #'thickness
\revert Voice.TextSpanner #'(bound-details right stencil-align-dir-y)
\revert Voice.TextSpanner #'(bound-details left stencil-align-dir-y)
\revert Voice.TextSpanner #'outside-staff-priority
\revert Voice.TextSpanner #'Y-offset
\revert Voice.TextSpanner #'bound-details #'right-broken
\startStaff
#})
\new Staff {
\cadenzaOn \aleatorisch { r8 cis''-.\p\< fis''-. g''-. e''-.
f''-. fis''-.\mf\> e''-. f''-. c''-.\! }
{ c''8^"repeat the pattern two times, then go on" \repeat
"unfold" 7 { c'' 8}} #1.7
\cadenzaOff \bar""\break
s8 fis'' 8 \stopTextSpa