Re: test spanner with controlled gradient / dynamic volume curve indicated by grey level

2018-01-31 Thread Michael Winter
I think this is ok. I will be using a proportional notation anyway so I 
think it is fine to set


\override Glissando.after-line-breaking = ##f

Maybe ideally there would be some distribution or only partial 
reiteration (instead of getting all colors again), but I think this will 
work fine.


Now I will try to alter the gradients.


On 01/31/2018 06:35 PM, Thomas Morley wrote:

2018-02-01 1:28 GMT+01:00 Thomas Morley :

2018-01-31 19:02 GMT+01:00 Michael Winter :


I am now curious what you are thinking about the line breaking. Maybe I am
out to lunch here and you have a much better idea. I will wait to hear from
you before I do any heavy lifting.


I'm very busy. My shitty regular job eats far too much time.
So no point in waiting for me. I'll almost surely come back, but I
don't know when.
And well, sometimes I need some leisure time as well ...

Nevertheless, here some thoughts and a new coding.

Line-breaks:
(1)
bound-details are extended with settings for left/right-broken
causing better padding/aligning
(2)
The part on the new line gets all colors again.
One could think of distributing the colors over first and second part,
more complicated though.
(3)
colors now don't rely on the predefined anymore.
You can set arbitrary steps, I tested with 1000.
Well, the result is more fine-grained then my pdf-viewer or my screen
can handle, lol.
(4)
various other changes, ask if not clear.

Here the code:

\version "2.19.65"

\paper { ragged-right = ##f }

\layout {
   \context {
   \Staff
   \override StaffSymbol.line-count = #1
   \omit Clef
   }
   \context {
   \Voice
   \override Glissando.minimum-length = #0
   %% construction-helper, delete-me
   \override Glissando.layer = 500
   %% n.b. line-breaks are TODO
   \override Glissando.breakable = ##t
   \override Glissando.after-line-breaking = ##t
 \override Glissando.bound-details =
 #'((right
  (attach-dir . -1)
  (end-on-accidental . #f)
  (padding . 0))
(right-broken
  (padding . 0.5))
(left-broken
  (padding . 0.5)
  (attach-dir . 1))
(left
  (attach-dir . -1)
  (padding . 0)
  (start-at-dot . #f)))
 }
}

#(define (make-grey-filled-box-stencil-list x-coords colors half-thick rl)
   (if (null? (cdr x-coords))
   rl
   (make-grey-filled-box-stencil-list
 (cdr x-coords)
 (cdr colors)
 half-thick
 (cons
   (stencil-with-color
 (make-filled-box-stencil
   (interval-widen (cons (car x-coords) (cadr x-coords)) 0.1)
   (cons (- half-thick) half-thick))
 (car colors))
   rl

#(define my-gliss
   (lambda (grob)
 (if (ly:stencil? (ly:line-spanner::print grob))
 (let* ((stencil (ly:line-spanner::print grob))
(X-ext (ly:stencil-extent stencil X))
(Y-ext (ly:stencil-extent stencil Y))
(Y-length (- (cdr Y-ext) (car Y-ext)))
(left-bound-info (ly:grob-property grob 'left-bound-info))
(left-Y (assoc-get 'Y left-bound-info))
(thick
  (assoc-get 'thickness (ly:grob-property grob 'details) 0.5))
(layout (ly:grob-layout grob))
(blot (ly:output-def-lookup layout 'blot-diameter))
(right-bound (ly:spanner-bound grob RIGHT))
(right-par (ly:grob-parent right-bound X))
(stem
  (if (grob::has-interface right-par 'note-column-interface)
  (ly:grob-object right-par 'stem)
  '()))
(stem-stencil
  (if (ly:grob? stem)
  (ly:grob-property stem 'stencil)
  #f))
(stem-thick
  (if (ly:stencil? stem-stencil)
  (interval-length (ly:stencil-extent stem-stencil X))
  0))
(corr-delta-X (- (interval-length X-ext)
 Y-length
 blot
 stem-thick
 ;; mmh, why this value??
 -0.01))
(steps
  (assoc-get 'color-steps (ly:grob-property grob 'details) 100))
(raw-colors
  (map
(lambda (e)
  (make-list 3 e))
  (iota (abs steps) 0 (/ 1.0 (abs steps)
(colors
  (if (negative? steps)
  (reverse raw-colors)
  raw-colors))
(raw-x-coords
  (iota (1+ (abs steps)) 0 (/ corr-delta-X (abs steps
(x-coords
  (map
(lambda (e)
  (+ (car X-ext) Y-length 

Re: test spanner with controlled gradient / dynamic volume curve indicated by grey level

2018-01-31 Thread Michael Winter
Thanks. You have gone far and above the call of duty. I will post 
questions if I have any, but wont shed tears if you cannot get around to it.


Best,

Michael


On 01/31/2018 06:28 PM, Thomas Morley wrote:

2018-01-31 19:02 GMT+01:00 Michael Winter :


I am now curious what you are thinking about the line breaking. Maybe I am
out to lunch here and you have a much better idea. I will wait to hear from
you before I do any heavy lifting.


I'm very busy. My shitty regular job eats far too much time.
So no point in waiting for me. I'll almost surely come back, but I
don't know when.
And well, sometimes I need some leisure time as well ...

Nevertheless, here some thoughts and a new coding.

Line-breaks:
(1)
bound-details are extended with settings for left/right-broken
causing better padding/aligning
(2)
The part on the new line gets all colors again.
One could think of distributing the colors over first and second part,
more complicated though.
(3)
colors now don't rely on the predefined anymore.
You can set arbitrary steps, I tested with 1000.
Well, the result is more fine-grained then my pdf-viewer or my screen
can handle, lol.
(4)
various other changes, ask if not clear.

Here the code:

\version "2.19.65"

\paper { ragged-right = ##f }

\layout {
   \context {
   \Staff
   \override StaffSymbol.line-count = #1
   \omit Clef
   }
   \context {
   \Voice
   \override Glissando.minimum-length = #0
   %% construction-helper, delete-me
   \override Glissando.layer = 500
   %% n.b. line-breaks are TODO
   \override Glissando.breakable = ##t
   \override Glissando.after-line-breaking = ##t
 \override Glissando.bound-details =
 #'((right
  (attach-dir . -1)
  (end-on-accidental . #f)
  (padding . 0))
(right-broken
  (padding . 0.5))
(left-broken
  (padding . 0.5)
  (attach-dir . 1))
(left
  (attach-dir . -1)
  (padding . 0)
  (start-at-dot . #f)))
 }
}

#(define (make-grey-filled-box-stencil-list x-coords colors half-thick rl)
   (if (null? (cdr x-coords))
   rl
   (make-grey-filled-box-stencil-list
 (cdr x-coords)
 (cdr colors)
 half-thick
 (cons
   (stencil-with-color
 (make-filled-box-stencil
   (interval-widen (cons (car x-coords) (cadr x-coords)) 0.1)
   (cons (- half-thick) half-thick))
 (car colors))
   rl

#(define my-gliss
   (lambda (grob)
 (if (ly:stencil? (ly:line-spanner::print grob))
 (let* ((stencil (ly:line-spanner::print grob))
(X-ext (ly:stencil-extent stencil X))
(Y-ext (ly:stencil-extent stencil Y))
(Y-length (- (cdr Y-ext) (car Y-ext)))
(left-bound-info (ly:grob-property grob 'left-bound-info))
(left-Y (assoc-get 'Y left-bound-info))
(thick
  (assoc-get 'thickness (ly:grob-property grob 'details) 0.5))
(layout (ly:grob-layout grob))
(blot (ly:output-def-lookup layout 'blot-diameter))
(right-bound (ly:spanner-bound grob RIGHT))
(right-par (ly:grob-parent right-bound X))
(stem
  (if (grob::has-interface right-par 'note-column-interface)
  (ly:grob-object right-par 'stem)
  '()))
(stem-stencil
  (if (ly:grob? stem)
  (ly:grob-property stem 'stencil)
  #f))
(stem-thick
  (if (ly:stencil? stem-stencil)
  (interval-length (ly:stencil-extent stem-stencil X))
  0))
(corr-delta-X (- (interval-length X-ext)
 Y-length
 blot
 stem-thick
 ;; mmh, why this value??
 -0.01))
(steps
  (assoc-get 'color-steps (ly:grob-property grob 'details) 100))
(raw-colors
  (map
(lambda (e)
  (make-list 3 e))
  (iota (abs steps) 0 (/ 1.0 (abs steps)
(colors
  (if (negative? steps)
  (reverse raw-colors)
  raw-colors))
(raw-x-coords
  (iota (1+ (abs steps)) 0 (/ corr-delta-X (abs steps
(x-coords
  (map
(lambda (e)
  (+ (car X-ext) Y-length blot e))
raw-x-coords)))

   ;; create a flat glissando
   (ly:grob-set-nested-property! grob '(right-bound-info Y) left-Y)

   ;; return the stencil of added boxes
   

Re: test spanner with controlled gradient / dynamic volume curve indicated by grey level

2018-01-31 Thread Thomas Morley
2018-02-01 1:28 GMT+01:00 Thomas Morley :
> 2018-01-31 19:02 GMT+01:00 Michael Winter :
>
>> I am now curious what you are thinking about the line breaking. Maybe I am
>> out to lunch here and you have a much better idea. I will wait to hear from
>> you before I do any heavy lifting.
>
>
> I'm very busy. My shitty regular job eats far too much time.
> So no point in waiting for me. I'll almost surely come back, but I
> don't know when.
> And well, sometimes I need some leisure time as well ...
>
> Nevertheless, here some thoughts and a new coding.
>
> Line-breaks:
> (1)
> bound-details are extended with settings for left/right-broken
> causing better padding/aligning
> (2)
> The part on the new line gets all colors again.
> One could think of distributing the colors over first and second part,
> more complicated though.
> (3)
> colors now don't rely on the predefined anymore.
> You can set arbitrary steps, I tested with 1000.
> Well, the result is more fine-grained then my pdf-viewer or my screen
> can handle, lol.
> (4)
> various other changes, ask if not clear.
>
> Here the code:
>
> \version "2.19.65"
>
> \paper { ragged-right = ##f }
>
> \layout {
>   \context {
>   \Staff
>   \override StaffSymbol.line-count = #1
>   \omit Clef
>   }
>   \context {
>   \Voice
>   \override Glissando.minimum-length = #0
>   %% construction-helper, delete-me
>   \override Glissando.layer = 500
>   %% n.b. line-breaks are TODO
>   \override Glissando.breakable = ##t
>   \override Glissando.after-line-breaking = ##t
> \override Glissando.bound-details =
> #'((right
>  (attach-dir . -1)
>  (end-on-accidental . #f)
>  (padding . 0))
>(right-broken
>  (padding . 0.5))
>(left-broken
>  (padding . 0.5)
>  (attach-dir . 1))
>(left
>  (attach-dir . -1)
>  (padding . 0)
>  (start-at-dot . #f)))
> }
> }
>
> #(define (make-grey-filled-box-stencil-list x-coords colors half-thick rl)
>   (if (null? (cdr x-coords))
>   rl
>   (make-grey-filled-box-stencil-list
> (cdr x-coords)
> (cdr colors)
> half-thick
> (cons
>   (stencil-with-color
> (make-filled-box-stencil
>   (interval-widen (cons (car x-coords) (cadr x-coords)) 0.1)
>   (cons (- half-thick) half-thick))
> (car colors))
>   rl
>
> #(define my-gliss
>   (lambda (grob)
> (if (ly:stencil? (ly:line-spanner::print grob))
> (let* ((stencil (ly:line-spanner::print grob))
>(X-ext (ly:stencil-extent stencil X))
>(Y-ext (ly:stencil-extent stencil Y))
>(Y-length (- (cdr Y-ext) (car Y-ext)))
>(left-bound-info (ly:grob-property grob 'left-bound-info))
>(left-Y (assoc-get 'Y left-bound-info))
>(thick
>  (assoc-get 'thickness (ly:grob-property grob 'details) 0.5))
>(layout (ly:grob-layout grob))
>(blot (ly:output-def-lookup layout 'blot-diameter))
>(right-bound (ly:spanner-bound grob RIGHT))
>(right-par (ly:grob-parent right-bound X))
>(stem
>  (if (grob::has-interface right-par 'note-column-interface)
>  (ly:grob-object right-par 'stem)
>  '()))
>(stem-stencil
>  (if (ly:grob? stem)
>  (ly:grob-property stem 'stencil)
>  #f))
>(stem-thick
>  (if (ly:stencil? stem-stencil)
>  (interval-length (ly:stencil-extent stem-stencil X))
>  0))
>(corr-delta-X (- (interval-length X-ext)
> Y-length
> blot
> stem-thick
> ;; mmh, why this value??
> -0.01))
>(steps
>  (assoc-get 'color-steps (ly:grob-property grob 'details) 
> 100))
>(raw-colors
>  (map
>(lambda (e)
>  (make-list 3 e))
>  (iota (abs steps) 0 (/ 1.0 (abs steps)
>(colors
>  (if (negative? steps)
>  (reverse raw-colors)
>  raw-colors))
>(raw-x-coords
>  (iota (1+ (abs steps)) 0 (/ corr-delta-X (abs steps
>(x-coords
>  (map
>(lambda (e)
>  (+ (car X-ext) Y-length blot e))
>raw-x-coords)))
>
>   ;; create a flat glissando
>   (ly:grob-set-nested-property! grob '(right-bound-info Y) left-Y)
>
>   ;; return the stencil of added boxes
>  

Re: test spanner with controlled gradient / dynamic volume curve indicated by grey level

2018-01-31 Thread Thomas Morley
2018-01-31 19:02 GMT+01:00 Michael Winter :

> I am now curious what you are thinking about the line breaking. Maybe I am
> out to lunch here and you have a much better idea. I will wait to hear from
> you before I do any heavy lifting.


I'm very busy. My shitty regular job eats far too much time.
So no point in waiting for me. I'll almost surely come back, but I
don't know when.
And well, sometimes I need some leisure time as well ...

Nevertheless, here some thoughts and a new coding.

Line-breaks:
(1)
bound-details are extended with settings for left/right-broken
causing better padding/aligning
(2)
The part on the new line gets all colors again.
One could think of distributing the colors over first and second part,
more complicated though.
(3)
colors now don't rely on the predefined anymore.
You can set arbitrary steps, I tested with 1000.
Well, the result is more fine-grained then my pdf-viewer or my screen
can handle, lol.
(4)
various other changes, ask if not clear.

Here the code:

\version "2.19.65"

\paper { ragged-right = ##f }

\layout {
  \context {
  \Staff
  \override StaffSymbol.line-count = #1
  \omit Clef
  }
  \context {
  \Voice
  \override Glissando.minimum-length = #0
  %% construction-helper, delete-me
  \override Glissando.layer = 500
  %% n.b. line-breaks are TODO
  \override Glissando.breakable = ##t
  \override Glissando.after-line-breaking = ##t
\override Glissando.bound-details =
#'((right
 (attach-dir . -1)
 (end-on-accidental . #f)
 (padding . 0))
   (right-broken
 (padding . 0.5))
   (left-broken
 (padding . 0.5)
 (attach-dir . 1))
   (left
 (attach-dir . -1)
 (padding . 0)
 (start-at-dot . #f)))
}
}

#(define (make-grey-filled-box-stencil-list x-coords colors half-thick rl)
  (if (null? (cdr x-coords))
  rl
  (make-grey-filled-box-stencil-list
(cdr x-coords)
(cdr colors)
half-thick
(cons
  (stencil-with-color
(make-filled-box-stencil
  (interval-widen (cons (car x-coords) (cadr x-coords)) 0.1)
  (cons (- half-thick) half-thick))
(car colors))
  rl

#(define my-gliss
  (lambda (grob)
(if (ly:stencil? (ly:line-spanner::print grob))
(let* ((stencil (ly:line-spanner::print grob))
   (X-ext (ly:stencil-extent stencil X))
   (Y-ext (ly:stencil-extent stencil Y))
   (Y-length (- (cdr Y-ext) (car Y-ext)))
   (left-bound-info (ly:grob-property grob 'left-bound-info))
   (left-Y (assoc-get 'Y left-bound-info))
   (thick
 (assoc-get 'thickness (ly:grob-property grob 'details) 0.5))
   (layout (ly:grob-layout grob))
   (blot (ly:output-def-lookup layout 'blot-diameter))
   (right-bound (ly:spanner-bound grob RIGHT))
   (right-par (ly:grob-parent right-bound X))
   (stem
 (if (grob::has-interface right-par 'note-column-interface)
 (ly:grob-object right-par 'stem)
 '()))
   (stem-stencil
 (if (ly:grob? stem)
 (ly:grob-property stem 'stencil)
 #f))
   (stem-thick
 (if (ly:stencil? stem-stencil)
 (interval-length (ly:stencil-extent stem-stencil X))
 0))
   (corr-delta-X (- (interval-length X-ext)
Y-length
blot
stem-thick
;; mmh, why this value??
-0.01))
   (steps
 (assoc-get 'color-steps (ly:grob-property grob 'details) 100))
   (raw-colors
 (map
   (lambda (e)
 (make-list 3 e))
 (iota (abs steps) 0 (/ 1.0 (abs steps)
   (colors
 (if (negative? steps)
 (reverse raw-colors)
 raw-colors))
   (raw-x-coords
 (iota (1+ (abs steps)) 0 (/ corr-delta-X (abs steps
   (x-coords
 (map
   (lambda (e)
 (+ (car X-ext) Y-length blot e))
   raw-x-coords)))

  ;; create a flat glissando
  (ly:grob-set-nested-property! grob '(right-bound-info Y) left-Y)

  ;; return the stencil of added boxes
  (ly:stencil-translate-axis
 (apply
   ly:stencil-add
   (make-grey-filled-box-stencil-list
 x-coords
 colors
 thick
 '()))
;; the actual offset is TODO, hardcoded here
  -5
Y))
 

Re: test spanner with controlled gradient / dynamic volume curve indicated by grey level

2018-01-31 Thread Michael Winter
ah. ok. somehow I though it broke all together. So perhaps you are 
having the same problem as me. Well... at least I got my feet a bit more 
wet with scheme. Not sure if by "how the broken part should look" if you 
are asking a question. But admittedly, I do not have a solid idea, I 
just want everything to align / be accurate to start.


Best,

Michael

On 01/31/2018 06:15 PM, Thomas Morley wrote:

2018-01-31 18:37 GMT+01:00 Michael Winter :

As for linebreaking. That is indeed a showstopper at the moment. Is that
because you are using filled box stencil?

No, I was not clear enough, though.
Line-breaks worked, but they were not nice.
One reason was bad padding etc, another problem is _how_the broken
parts should look.

See my later post.

Cheers,
   Harm




___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: test spanner with controlled gradient / dynamic volume curve indicated by grey level

2018-01-31 Thread Thomas Morley
2018-01-31 18:37 GMT+01:00 Michael Winter :
> As for linebreaking. That is indeed a showstopper at the moment. Is that
> because you are using filled box stencil?

No, I was not clear enough, though.
Line-breaks worked, but they were not nice.
One reason was bad padding etc, another problem is _how_the broken
parts should look.

See my later post.

Cheers,
  Harm

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: test spanner with controlled gradient / dynamic volume curve indicated by grey level

2018-01-31 Thread Michael Winter

almost. something seems to be not quite right about the alignment...


On 01/31/2018 03:30 PM, Michael Winter wrote:
ok. I have learned a tremendous amount with your help. I went ahead 
and hacked away replacing your function with line markups and now it 
seems to work with line breaks. let me know if you see anything wrong 
with this.


Best,

Michael

---



\version "2.18"

\paper { ragged-right = ##f }

\layout {
  \context {
  \Staff
  \override StaffSymbol.line-count = #1
  \remove "Clef_engraver"
  \remove "Time_signature_engraver"
  }
  \context {
  \Voice
  \override Glissando.minimum-length = #0
  %% n.b. line-breaks are TODO
  \override Glissando.breakable = ##t
  \override Glissando.after-line-breaking = ##t
  \override Glissando.bound-details =
    #'((right
 (attach-dir . 0)
 (end-on-accidental . #f)
 (padding . 0.))
   (left
 (attach-dir . 0)
 (padding . 0.)))
    }
}

#(define (make-grey-filled-path-list x-coords color-steps half-thick)
  (if (null? (cdr x-coords))
  (markup )
  (make-combine-markup

   (make-override-markup
   (cons (quote line-cap-style) (quote square))
   (make-with-color-markup
    (x11-color
  (string->symbol (format #f "grey~a" (car color-steps
         (make-path-markup half-thick
          (list (list 'moveto (car x-coords) 0)
            (list 'lineto (cadr x-coords) 0)

  (make-grey-filled-path-list
    (cdr x-coords)
    (cdr color-steps)
    half-thick
   

#(define my-gliss
  (lambda (grob)
    (if (ly:stencil? (ly:line-spanner::print grob))
    (let* ((stencil (ly:line-spanner::print grob))
   (X-ext (ly:stencil-extent stencil X))
   (left-bound-info (ly:grob-property grob 'left-bound-info))
   (left-Y (assoc-get 'Y left-bound-info))
   (left-X (interval-start X-ext))
   (right-bound-info (ly:grob-property grob 
'right-bound-info))

   (right-X (interval-length X-ext))
   (thick (ly:grob-property grob 'thickness 0.5))
   (delta-X (- right-X left-X))
   (steps
 (assoc-get 'color-steps (ly:grob-property grob 
'details) 100))

   (raw-color-steps
 (iota (abs steps) 0 (round (/ 100 (min 100 (abs 
steps))

   (color-steps
 (if (negative? steps)
 (reverse raw-color-steps)
 raw-color-steps))
   (x-coords (iota (1+ (abs steps)) 0 (/ delta-X (abs 
steps)

  ;; create a flat glissando
  (ly:grob-set-nested-property! grob '(right-bound-info Y) 
left-Y)


  ;; return the stencil of added boxes
  (ly:stencil-translate-axis

   (grob-interpret-markup grob
      (markup
         (make-grey-filled-path-list
          x-coords
          color-steps
          thick)))

    ;; the actual offset is TODO, hardcoded here
    3
    Y))
 #f)))

#(define (add-gliss m)
   (case (ly:music-property m 'name)
 ((NoteEvent)
  (set! (ly:music-property m 'articulations)
    (append
  (ly:music-property m 'articulations)
  (list (make-music 'GlissandoEvent
  m)
 (else #f)))

addGliss =
#(define-music-function (parser location music)
  (ly:music?)
  (map-some-music add-gliss music))

%
%% EXAMPLE
%

mus =
  {
    \time 2/4
    \addGliss {
  \override Glissando.stencil = #my-gliss
  b'16 b'16 b'8 b'4 \break
  \override Staff.Beam.color = #(x11-color 'grey60)
  b'8 b'16 b'16 ~
    }
    %% n.b. If glissando-skip is #t \addGliss needs to be interrupted
    %% otherwise a programming error occurs
    \once \override NoteColumn.glissando-skip = ##t
    b'16
    \addGliss {
  b'16 b'8
    }
    %% a final target for the last glissando needs to be present, 
otherwise

    %% lily complains about unterminated glissando
    b'8
  }

\new Score
<<
\new Staff \mus

\new Staff {
  %% negative value reverses colors
  \override Glissando.details.color-steps = -100
  %% thicker
  \override Glissando.thickness = 2
  \mus
}

\new Staff {
  %% less steps, default (and max) is 100
  \override Glissando.details.color-steps = 5
  %% thinner
  \override Glissando.thickness = 0.2
  \mus
}
>>






On 01/31/2018 12:02 PM, Michael Winter wrote:
Another option for the line breading is to give the target final note 
for a system, hide it (basically the last note in your example). then 
in the next system. do the same with the starting note on the left 
side and hide it. Kind of a hack, but could actually look nice 
because you would see the full extent of the gradient on both the end 
of one system and the beginning of the next. See below a quick mockup.


I am now 

Re: test spanner with controlled gradient / dynamic volume curve indicated by grey level

2018-01-31 Thread Michael Winter
ok. I have learned a tremendous amount with your help. I went ahead and 
hacked away replacing your function with line markups and now it seems 
to work with line breaks. let me know if you see anything wrong with this.


Best,

Michael

---



\version "2.18"

\paper { ragged-right = ##f }

\layout {
  \context {
  \Staff
  \override StaffSymbol.line-count = #1
  \remove "Clef_engraver"
  \remove "Time_signature_engraver"
  }
  \context {
  \Voice
  \override Glissando.minimum-length = #0
  %% n.b. line-breaks are TODO
  \override Glissando.breakable = ##t
  \override Glissando.after-line-breaking = ##t
  \override Glissando.bound-details =
    #'((right
 (attach-dir . 0)
 (end-on-accidental . #f)
 (padding . 0.))
   (left
 (attach-dir . 0)
 (padding . 0.)))
    }
}

#(define (make-grey-filled-path-list x-coords color-steps half-thick)
  (if (null? (cdr x-coords))
  (markup )
  (make-combine-markup

   (make-override-markup
   (cons (quote line-cap-style) (quote square))
   (make-with-color-markup
    (x11-color
  (string->symbol (format #f "grey~a" (car color-steps
         (make-path-markup half-thick
          (list (list 'moveto (car x-coords) 0)
            (list 'lineto (cadr x-coords) 0)

  (make-grey-filled-path-list
    (cdr x-coords)
    (cdr color-steps)
    half-thick
   

#(define my-gliss
  (lambda (grob)
    (if (ly:stencil? (ly:line-spanner::print grob))
    (let* ((stencil (ly:line-spanner::print grob))
   (X-ext (ly:stencil-extent stencil X))
   (left-bound-info (ly:grob-property grob 'left-bound-info))
   (left-Y (assoc-get 'Y left-bound-info))
   (left-X (interval-start X-ext))
   (right-bound-info (ly:grob-property grob 'right-bound-info))
   (right-X (interval-length X-ext))
   (thick (ly:grob-property grob 'thickness 0.5))
   (delta-X (- right-X left-X))
   (steps
 (assoc-get 'color-steps (ly:grob-property grob 
'details) 100))

   (raw-color-steps
 (iota (abs steps) 0 (round (/ 100 (min 100 (abs 
steps))

   (color-steps
 (if (negative? steps)
 (reverse raw-color-steps)
 raw-color-steps))
   (x-coords (iota (1+ (abs steps)) 0 (/ delta-X (abs 
steps)

  ;; create a flat glissando
  (ly:grob-set-nested-property! grob '(right-bound-info Y) left-Y)

  ;; return the stencil of added boxes
  (ly:stencil-translate-axis

   (grob-interpret-markup grob
      (markup
         (make-grey-filled-path-list
          x-coords
          color-steps
          thick)))

    ;; the actual offset is TODO, hardcoded here
    3
    Y))
 #f)))

#(define (add-gliss m)
   (case (ly:music-property m 'name)
 ((NoteEvent)
  (set! (ly:music-property m 'articulations)
    (append
  (ly:music-property m 'articulations)
  (list (make-music 'GlissandoEvent
  m)
 (else #f)))

addGliss =
#(define-music-function (parser location music)
  (ly:music?)
  (map-some-music add-gliss music))

%
%% EXAMPLE
%

mus =
  {
    \time 2/4
    \addGliss {
  \override Glissando.stencil = #my-gliss
  b'16 b'16 b'8 b'4 \break
  \override Staff.Beam.color = #(x11-color 'grey60)
  b'8 b'16 b'16 ~
    }
    %% n.b. If glissando-skip is #t \addGliss needs to be interrupted
    %% otherwise a programming error occurs
    \once \override NoteColumn.glissando-skip = ##t
    b'16
    \addGliss {
  b'16 b'8
    }
    %% a final target for the last glissando needs to be present, otherwise
    %% lily complains about unterminated glissando
    b'8
  }

\new Score
<<
\new Staff \mus

\new Staff {
  %% negative value reverses colors
  \override Glissando.details.color-steps = -100
  %% thicker
  \override Glissando.thickness = 2
  \mus
}

\new Staff {
  %% less steps, default (and max) is 100
  \override Glissando.details.color-steps = 5
  %% thinner
  \override Glissando.thickness = 0.2
  \mus
}
>>






On 01/31/2018 12:02 PM, Michael Winter wrote:
Another option for the line breading is to give the target final note 
for a system, hide it (basically the last note in your example). then 
in the next system. do the same with the starting note on the left 
side and hide it. Kind of a hack, but could actually look nice because 
you would see the full extent of the gradient on both the end of one 
system and the beginning of the next. See below a quick mockup.


I am now curious what you are thinking about the line breaking. Maybe 
I am out to lunch here and you have a much better idea. I will 

Re: test spanner with controlled gradient / dynamic volume curve indicated by grey level

2018-01-31 Thread Michael Winter
Another option for the line breading is to give the target final note 
for a system, hide it (basically the last note in your example). then in 
the next system. do the same with the starting note on the left side and 
hide it. Kind of a hack, but could actually look nice because you would 
see the full extent of the gradient on both the end of one system and 
the beginning of the next. See below a quick mockup.


I am now curious what you are thinking about the line breaking. Maybe I 
am out to lunch here and you have a much better idea. I will wait to 
hear from you before I do any heavy lifting.


Best,

Michael

--

\version "2.18"

\paper { ragged-right = ##f }

\layout {
  \context {
  \Staff
  \override StaffSymbol.line-count = #1
  \remove "Clef_engraver"
  \remove "Time_signature_engraver"
  }
  \context {
  \Voice
  \override Glissando.minimum-length = #0
  %% n.b. line-breaks are TODO
  \override Glissando.breakable = ##t
  \override Glissando.after-line-breaking = ##t
  \override Glissando.bound-details =
    #'((right
 (attach-dir . 0)
 (end-on-accidental . #f)
 (padding . 0.))
   (left
 (attach-dir . 0)
 (padding . 0.)))
    }
}

#(define (make-grey-filled-box-stencil-list x-coords color-steps 
half-thick rl)

  (if (null? (cdr x-coords))
  rl
  (make-grey-filled-box-stencil-list
    (cdr x-coords)
    (cdr color-steps)
    half-thick
    (cons
  (stencil-with-color
    (make-filled-box-stencil
  (interval-widen (cons (car x-coords) (cadr x-coords)) 0.1)
  (cons (- half-thick) half-thick))
    (x11-color
  (string->symbol (format #f "grey~a" (car color-steps)
  rl

#(define my-gliss
  (lambda (grob)
    (if (ly:stencil? (ly:line-spanner::print grob))
    (let* ((stencil (ly:line-spanner::print grob))
   (X-ext (ly:stencil-extent stencil X))
   (left-bound-info (ly:grob-property grob 'left-bound-info))
   (left-Y (assoc-get 'Y left-bound-info))
   (left-X (interval-start X-ext))
   (right-bound-info (ly:grob-property grob 'right-bound-info))
   (right-X (interval-length X-ext))
   (thick (ly:grob-property grob 'thickness 0.5))
   (delta-X (- right-X left-X))
   (steps
 (assoc-get 'color-steps (ly:grob-property grob 
'details) 100))

   (raw-color-steps
 (iota (abs steps) 0 (round (/ 100 (min 100 (abs 
steps))

   (color-steps
 (if (negative? steps)
 (reverse raw-color-steps)
 raw-color-steps))
   (x-coords (iota (1+ (abs steps)) 0 (/ delta-X (abs 
steps)


  ;; create a flat glissando
  (ly:grob-set-nested-property! grob '(right-bound-info Y) left-Y)

  ;; return the stencil of added boxes
  (ly:stencil-translate-axis
    (apply
  ly:stencil-add
  (make-grey-filled-box-stencil-list
    x-coords
    color-steps
    thick
    '()))
    ;; the actual offset is TODO, hardcoded here
    -8
    Y))
 #f)))

#(define (add-gliss m)
   (case (ly:music-property m 'name)
 ((NoteEvent)
  (set! (ly:music-property m 'articulations)
    (append
  (ly:music-property m 'articulations)
  (list (make-music 'GlissandoEvent
  m)
 (else #f)))

addGliss =
#(define-music-function (parser location music)
  (ly:music?)
  (map-some-music add-gliss music))

%
%% EXAMPLE
%

mus =
  {
    \addGliss {
  \override Glissando.stencil = #my-gliss
  b'16 b'16 b'8 b'4
  \override Staff.Beam.color = #(x11-color 'grey60)
  b'8 b'16 b'16 ~
    }
    %% n.b. If glissando-skip is #t \addGliss needs to be interrupted
    %% otherwise a programming error occurs
    \once \override NoteColumn.glissando-skip = ##t
    b'16
    \addGliss {
  b'16 b'8
    }
    %% a final target for the last glissando needs to be present, otherwise
    %% lily complains about unterminated glissando
    \time 1/8  \stopStaff \hide Stem \hide b'8 \break

    \addGliss {
  \override Glissando.stencil = #my-gliss
  \hide Stem \hide b'8 \startStaff \time 4/4
  b'16 b'16 b'8 b'4
  \override Staff.Beam.color = #(x11-color 'grey60)
  b'8 b'16 b'16 ~
    }
    %% n.b. If glissando-skip is #t \addGliss needs to be interrupted
    %% otherwise a programming error occurs
    \once \override NoteColumn.glissando-skip = ##t
    b'16
    \addGliss {
  b'16 b'8
    }
    %% a final target for the last glissando needs to be present, otherwise
    %% lily complains about unterminated glissando
    \time 1/8  \stopStaff 

Re: test spanner with controlled gradient / dynamic volume curve indicated by grey level

2018-01-31 Thread Michael Winter
Hmmm... I made the change to use the stencil extent and that seems to be 
fine. I am not sure what you are saying about the visibility of the 
final stencil.


As for linebreaking. That is indeed a showstopper at the moment. Is that 
because you are using filled box stencil? When I was using a path 
directive with a line, the breaking seemed to work / break fine. I will 
see if I can make the switch unless you have another idea.


Best,

Michael


On 01/31/2018 03:41 AM, Thomas Morley wrote:

2018-01-31 3:46 GMT+01:00 Michael Winter :

On first glance. This looks ideal. THANK YOU

I am a bit brain dead at the moment, so will dig in tomorrow and let you
know if I have any further questions / thoughts / ideas.


Glad you like it.
I've found a weakness, though: the stencils overlap. Visible, if you
apply box-stencil to the final stencil.
Probably one should go for stencil-extent to get the extension in
X-axis and not for 'X from left/right-bound-info.
Will have a look in the evening.
Also, linebreaks are not yet working.

Cheers,
   Harm




___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: test spanner with controlled gradient / dynamic volume curve indicated by grey level

2018-01-31 Thread Thomas Morley
2018-01-31 3:46 GMT+01:00 Michael Winter :
> On first glance. This looks ideal. THANK YOU
>
> I am a bit brain dead at the moment, so will dig in tomorrow and let you
> know if I have any further questions / thoughts / ideas.


Glad you like it.
I've found a weakness, though: the stencils overlap. Visible, if you
apply box-stencil to the final stencil.
Probably one should go for stencil-extent to get the extension in
X-axis and not for 'X from left/right-bound-info.
Will have a look in the evening.
Also, linebreaks are not yet working.

Cheers,
  Harm

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: test spanner with controlled gradient / dynamic volume curve indicated by grey level

2018-01-30 Thread Michael Winter

On first glance. This looks ideal. THANK YOU

I am a bit brain dead at the moment, so will dig in tomorrow and let you 
know if I have any further questions / thoughts / ideas.


Very kind indeed.

Best,

Michael


On 01/30/2018 07:35 PM, Thomas Morley wrote:

2018-01-31 0:00 GMT+01:00 Michael Winter :

That is really beautiful. Thank you. I have been giving myself a crash
course in scheme and was also getting somewhat closer to a solution using a
glissando event. Then the internet went down. And low and behold it woke up
to your response.

So this is almost what I want. And I need to dissect your code a bit more
(again, still wrapping my head around scheme). Maybe I can adapt it. My
ultimate goal is to specify the gradient within the given note length (as
opposed to giving a new color directive for every note. This is where it
gets tricky. In my current attempt (drowning in the deep end), it is a bit
tricky because you cannot change colors in the middle of a path directive.
So you need to combine several markups (as in my original example). I was
piecing together stuff I found on LSR and in the user archive and was also
having a huge problem with alignment. My current code is pasted below. It is
a mess, but getting there. I just was reading about returning markup
definitions in hopes that I could iterate through the gradient and build the
markup that way.

En fin, I will study your code. Like I said, it is almost exactly what I
want except I want the gradient within the note length. Of course, any help
in that direction will be much appreciated.

Best,

Michael

How about below then:

\version "2.19.65"

\paper { ragged-right = ##f }

\layout {
   \context {
   \Staff
   \override StaffSymbol.line-count = #1
   }
   \context {
   \Voice
   \override Glissando.minimum-length = #0
   %% n.b. line-breaks are TODO
   \override Glissando.breakable = ##t
   \override Glissando.after-line-breaking = ##t
   \override Glissando.bound-details =
 #'((right
  (attach-dir . 0)
  (end-on-accidental . #f)
  (padding . 0.))
(left
  (attach-dir . 0)
  (padding . 0.)))
 }
}

#(define (make-grey-filled-box-stencil-list x-coords color-steps half-thick rl)
   (if (null? (cdr x-coords))
   rl
   (make-grey-filled-box-stencil-list
 (cdr x-coords)
 (cdr color-steps)
 half-thick
 (cons
   (stencil-with-color
 (make-filled-box-stencil
   (interval-widen (cons (car x-coords) (cadr x-coords)) 0.1)
   (cons (- half-thick) half-thick))
 (x11-color
   (string->symbol (format #f "grey~a" (car color-steps)
   rl

#(define my-gliss
   (lambda (grob)
 (if (ly:stencil? (ly:line-spanner::print grob))
 (let* ((left-bound-info (ly:grob-property grob 'left-bound-info))
(left-Y (assoc-get 'Y left-bound-info))
(left-X (assoc-get 'X left-bound-info))
(right-bound-info (ly:grob-property grob 'right-bound-info))
(right-X (assoc-get 'X right-bound-info))
(thick (ly:grob-property grob 'thickness 0.5))
(delta-X (- right-X left-X))
(steps
  (assoc-get 'color-steps (ly:grob-property grob 'details) 100))
(raw-color-steps
  (iota (abs steps) 0 (round (/ 100 (min 100 (abs steps))
(color-steps
  (if (negative? steps)
  (reverse raw-color-steps)
  raw-color-steps))
(x-coords (iota (1+ (abs steps)) 0 (/ delta-X (abs steps)

   ;; create a flat glissando
   (ly:grob-set-nested-property! grob '(right-bound-info Y) left-Y)

   ;; return the stencil of added boxes
   (ly:stencil-translate-axis
 (apply
   ly:stencil-add
   (make-grey-filled-box-stencil-list
 x-coords
 color-steps
 thick
 '()))
 ;; the actual offset is TODO, hardcoded here
 -8
 Y))
  #f)))

#(define (add-gliss m)
(case (ly:music-property m 'name)
  ((NoteEvent)
   (set! (ly:music-property m 'articulations)
 (append
   (ly:music-property m 'articulations)
   (list (make-music 'GlissandoEvent
   m)
  (else #f)))

addGliss =
#(define-music-function (music)
   (ly:music?)
   (map-some-music add-gliss music))

%
%% EXAMPLE
%

mus =
   {
 \addGliss {
   \override Glissando.stencil = #my-gliss
   b'16 b'16 b'8 b'4
   \override Staff.Beam.color = #(x11-color 'grey60)
   b'8 b'16 b'16 ~
 }
 %% n.b. If glissando-skip is #t \addGliss needs to be interrupted
 %% otherwise a 

Re: test spanner with controlled gradient / dynamic volume curve indicated by grey level

2018-01-30 Thread Thomas Morley
2018-01-31 0:00 GMT+01:00 Michael Winter :
> That is really beautiful. Thank you. I have been giving myself a crash
> course in scheme and was also getting somewhat closer to a solution using a
> glissando event. Then the internet went down. And low and behold it woke up
> to your response.
>
> So this is almost what I want. And I need to dissect your code a bit more
> (again, still wrapping my head around scheme). Maybe I can adapt it. My
> ultimate goal is to specify the gradient within the given note length (as
> opposed to giving a new color directive for every note. This is where it
> gets tricky. In my current attempt (drowning in the deep end), it is a bit
> tricky because you cannot change colors in the middle of a path directive.
> So you need to combine several markups (as in my original example). I was
> piecing together stuff I found on LSR and in the user archive and was also
> having a huge problem with alignment. My current code is pasted below. It is
> a mess, but getting there. I just was reading about returning markup
> definitions in hopes that I could iterate through the gradient and build the
> markup that way.
>
> En fin, I will study your code. Like I said, it is almost exactly what I
> want except I want the gradient within the note length. Of course, any help
> in that direction will be much appreciated.
>
> Best,
>
> Michael

How about below then:

\version "2.19.65"

\paper { ragged-right = ##f }

\layout {
  \context {
  \Staff
  \override StaffSymbol.line-count = #1
  }
  \context {
  \Voice
  \override Glissando.minimum-length = #0
  %% n.b. line-breaks are TODO
  \override Glissando.breakable = ##t
  \override Glissando.after-line-breaking = ##t
  \override Glissando.bound-details =
#'((right
 (attach-dir . 0)
 (end-on-accidental . #f)
 (padding . 0.))
   (left
 (attach-dir . 0)
 (padding . 0.)))
}
}

#(define (make-grey-filled-box-stencil-list x-coords color-steps half-thick rl)
  (if (null? (cdr x-coords))
  rl
  (make-grey-filled-box-stencil-list
(cdr x-coords)
(cdr color-steps)
half-thick
(cons
  (stencil-with-color
(make-filled-box-stencil
  (interval-widen (cons (car x-coords) (cadr x-coords)) 0.1)
  (cons (- half-thick) half-thick))
(x11-color
  (string->symbol (format #f "grey~a" (car color-steps)
  rl

#(define my-gliss
  (lambda (grob)
(if (ly:stencil? (ly:line-spanner::print grob))
(let* ((left-bound-info (ly:grob-property grob 'left-bound-info))
   (left-Y (assoc-get 'Y left-bound-info))
   (left-X (assoc-get 'X left-bound-info))
   (right-bound-info (ly:grob-property grob 'right-bound-info))
   (right-X (assoc-get 'X right-bound-info))
   (thick (ly:grob-property grob 'thickness 0.5))
   (delta-X (- right-X left-X))
   (steps
 (assoc-get 'color-steps (ly:grob-property grob 'details) 100))
   (raw-color-steps
 (iota (abs steps) 0 (round (/ 100 (min 100 (abs steps))
   (color-steps
 (if (negative? steps)
 (reverse raw-color-steps)
 raw-color-steps))
   (x-coords (iota (1+ (abs steps)) 0 (/ delta-X (abs steps)

  ;; create a flat glissando
  (ly:grob-set-nested-property! grob '(right-bound-info Y) left-Y)

  ;; return the stencil of added boxes
  (ly:stencil-translate-axis
(apply
  ly:stencil-add
  (make-grey-filled-box-stencil-list
x-coords
color-steps
thick
'()))
;; the actual offset is TODO, hardcoded here
-8
Y))
 #f)))

#(define (add-gliss m)
   (case (ly:music-property m 'name)
 ((NoteEvent)
  (set! (ly:music-property m 'articulations)
(append
  (ly:music-property m 'articulations)
  (list (make-music 'GlissandoEvent
  m)
 (else #f)))

addGliss =
#(define-music-function (music)
  (ly:music?)
  (map-some-music add-gliss music))

%
%% EXAMPLE
%

mus =
  {
\addGliss {
  \override Glissando.stencil = #my-gliss
  b'16 b'16 b'8 b'4
  \override Staff.Beam.color = #(x11-color 'grey60)
  b'8 b'16 b'16 ~
}
%% n.b. If glissando-skip is #t \addGliss needs to be interrupted
%% otherwise a programming error occurs
\once \override NoteColumn.glissando-skip = ##t
b'16
\addGliss {
  b'16 b'8
}
%% a final target for the last glissando needs to be present, otherwise
%% lily complains about unterminated glissando
b'8
  }

\new Staff \mus

\new Staff {
  %% 

Re: test spanner with controlled gradient / dynamic volume curve indicated by grey level

2018-01-30 Thread Karlin High

On 1/30/2018 5:00 PM, Michael Winter wrote:
I will study your code. Like I said, it is almost exactly what I want 
except I want the gradient within the note length. Of course, any help 
in that direction will be much appreciated.


Only brainstorming here:

How about writing a loop that moves from the desired gradient's start 
point to its end point, drawing small rectangles of progressively 
changing color?


Or maybe that's what Thomas Morley's code does. Or maybe that's not how 
Scheme works. I really have no idea what I'm asking, I'll stop now.

--
Karlin High
Missouri, USA

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: test spanner with controlled gradient / dynamic volume curve indicated by grey level

2018-01-30 Thread David Kastrup
Michael Winter  writes:

> That is really beautiful. Thank you. I have been giving myself a crash
> course in scheme and was also getting somewhat closer to a solution
> using a glissando event. Then the internet went down.

Now _that's_ what a I call a crash course.

-- 
David Kastrup

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: test spanner with controlled gradient / dynamic volume curve indicated by grey level

2018-01-30 Thread Michael Winter
That is really beautiful. Thank you. I have been giving myself a crash 
course in scheme and was also getting somewhat closer to a solution 
using a glissando event. Then the internet went down. And low and behold 
it woke up to your response.


So this is almost what I want. And I need to dissect your code a bit 
more (again, still wrapping my head around scheme). Maybe I can adapt 
it. My ultimate goal is to specify the gradient within the given note 
length (as opposed to giving a new color directive for every note. This 
is where it gets tricky. In my current attempt (drowning in the deep 
end), it is a bit tricky because you cannot change colors in the middle 
of a path directive. So you need to combine several markups (as in my 
original example). I was piecing together stuff I found on LSR and in 
the user archive and was also having a huge problem with alignment. My 
current code is pasted below. It is a mess, but getting there. I just 
was reading about returning markup definitions in hopes that I could 
iterate through the gradient and build the markup that way.


En fin, I will study your code. Like I said, it is almost exactly what I 
want except I want the gradient within the note length. Of course, any 
help in that direction will be much appreciated.


Best,

Michael


#(set-global-staff-size 16)

\layout {
  indent = 0.0\cm
  \context {
  \Staff
  % \override NoteHead.transparent =##t
  \override StaffSymbol.line-count = #1
  \override Glissando.minimum-length = #0
  \override Glissando #'bound-details = #'((right (attach-dir . 0) 
(end-on-accidental . #f) (padding . 0.)) (left (attach-dir . 0) (padding 
. 0.)))


  \remove "Clef_engraver"
  \remove "Time_signature_engraver"
   \stemDown
    }
    \context {
  \Voice
  \consists "Horizontal_bracket_engraver"
    }
}

glissWidth = #1 %<< global variable for glissando width

#(define (path-gliss handle)
  (lambda (grob)
    (if (ly:stencil? (ly:line-spanner::print grob))
    (let* ((stencil (ly:line-spanner::print grob))
      (X-ext (ly:stencil-extent stencil X))
      (Y-ext (ly:stencil-extent stencil Y))
      (width (interval-length X-ext))
      (height (interval-length Y-ext))
      (lefty (cdr (assoc 'Y (ly:grob-property grob 'left-bound-info
      (righty (cdr (assoc 'Y (ly:grob-property grob 
'right-bound-info

      (deltay (- righty lefty))
      (dir (if (> deltay 0) 1 -1)))

      (ly:stencil-translate
        (grob-interpret-markup grob
      (markup
            ;(#: tiny (format "~a" (ly:grob-properties grob)))
                ;(format "~a" (cdr (assoc 'Y (ly:grob-property grob 
'left-bound-info

                ;(#: tiny (format "~a" handle))
        (#:combine
         (#:override
   (cons (quote line-cap-style) (quote square))
         (#:path glissWidth
          (list (list 'moveto 0 -5)
            (list 'lineto (* (- width 1.1) 0.5) -5

         (#:override
   (cons (quote line-cap-style) (quote square))
   (#:with-color
          (list 0.5 0.5 0.5)
          (#:path glissWidth
          (list (list 'moveto (* (- width 0.1) 0.5) -5)
            (list 'lineto (- (* width 1) 1.1) -5)
         (#:override
   (cons (quote line-cap-style) (quote square))
   (#:with-color
          (list 0.8 0.5 0.5)
          (#:path glissWidth
          (list (list 'moveto 0 1)
            (list 'lineto (* width 0.5) 1)

         )))
        (if (> dir 0)
           (cons (interval-start X-ext) (+ (interval-start Y-ext) 0.1))
           (cons (interval-start X-ext) (+ (interval-start Y-ext) 
height)

     #f)))


#(define (add-gliss m)
   (case (ly:music-property m 'name)
 ((NoteEvent) (set! (ly:music-property m 'articulations)
  (append (ly:music-property m 'articulations)
 (list (make-music (quote GlissandoEvent)
   m)
 (else #f)))

addGliss = #(define-music-function (parser location music)
 (ly:music?)
   (map-some-music add-gliss music))



\new Score
  \with {
    %proportionalNotationDuration = #(ly:make-moment 1/16)
    %\override SpacingSpanner.strict-note-spacing = ##t
    %\override SpacingSpanner.uniform-stretching = ##t
  }
  <<

  \new Staff
  <<
   \repeat unfold 32 { \repeat unfold 63 { s16 \noBreak } s16 \break }
    {\time 4/4 \override Glissando.breakable = ##t
  \override Glissando.after-line-breaking = ##t
  \addGliss {

 \override Glissando #'stencil = #(path-gliss '(0 0))
 b'16 b'16 b'8 b'4 \override Staff.Beam.color = 
#(x11-color 'grey60) b'8 b'16 b'16 ~ \once \override 
NoteColumn.glissando-skip = ##t b'16 b'16 b'8

    }}
  >>

  >>


On 01/30/2018 03:32 PM, Thomas Morley wrote:

2018-01-30 6:19 GMT+01:00 Michael Winter :

A bit more here. I think I can fake this in a markup... See example pasted

Re: test spanner with controlled gradient / dynamic volume curve indicated by grey level

2018-01-30 Thread Thomas Morley
2018-01-30 6:19 GMT+01:00 Michael Winter :
> A bit more here. I think I can fake this in a markup... See example pasted
> below. My scheme skilz are minimal. I would like yo do this interpolating
> between the x position of adjacent notes. So maybe I can do this as a custom
> beam stencil. or some kind of spanner. Basically I want a scheme function
> that will give me the position of a given note and the next note... Thanks!
>
> \relative c'' {
>   s64
>   -\markup {
> \combine
> \override #'(line-join-style . miter)
> \with-color #(x11-color 'grey60)
> \path #2
> #'((moveto 0 0)
>  (lineto 0.3 0)
>  (closepath)
>  )
>
>\combine
> \override #'(line-join-style . miter)
> \with-color #(x11-color 'grey40)
> \path #2
> #'((moveto 0.3 0)
>  (lineto 0.6 0)
>  (closepath))
>
> \override #'(line-join-style . miter)
> \with-color #(x11-color 'grey20)
> \path #2
> #'((moveto 0.6 0)
>  (lineto 0.9 0)
>  (closepath))
>
>   }
>
>
> }
>
>
> On 01/29/2018 06:27 PM, Michael Winter wrote:
>>
>> Hello...
>>
>> I have tried quite a few hacks, but nothing really suitable.
>>
>> What I really want is to simple draw a line beneath the staff that has a
>> grey scale gradient such that for each note, I give a target value.
>>
>> Most of what I have tried involves doing this in increments with
>> overlapping spanners, I also tried the code in this thread:
>> https://lists.nongnu.org/archive/html/lilypond-user/2016-10/msg00097.html
>>
>> I think the answer is doing this with svg directives since in the svg
>> documentation there are directives for linear gradients, but I do not know
>> how to build the function to use svg directives and such that the target
>> greyscale value is reached at the x-position of a given notehead.
>>
>> Also, ideally I would be able to use spacer rests to give intermediary
>> values along the way, since the curve is actually not linear.
>>
>> Thanks in advance and my apologies if I have been unclear.
>>
>> Best,
>> Michael



Hi Michael,

not sure I've got you right.

Probably the quick hack below may give you a starting point.
It will not work with spacers though, because they don't cause a NoteColumn.

Cheers,
  Harm

#(define (make-filled-box-stencil-list x-coords half-thick colors rl)
  (if (null? (cdr x-coords))
  rl
  (make-filled-box-stencil-list
(cdr x-coords)
half-thick
(cdr colors)
(cons
  (stencil-with-color
(make-filled-box-stencil
  (cons (car x-coords) (cadr x-coords))
  (cons (- half-thick) half-thick))
(car colors))
  rl

\version "2.19.65"

foo =
\override TextSpanner.stencil =
  #(lambda (grob)
(let* ((ncs (ly:grob-object grob 'note-columns))
   (nc-ls
 (if (ly:grob-array? ncs)
 (ly:grob-array->list ncs)
 '()))
   (sys (ly:grob-system grob))
   (nc-exts
 (map
   (lambda (nc)
 (ly:grob-extent nc sys X))
   nc-ls))
   (left-info
 (ly:grob-property grob 'left-bound-info))
   (right-info
 (ly:grob-property grob 'right-bound-info))
   (thick (ly:grob-property grob 'thickness 1))
   (x-coords
 (map
   (lambda (e)
 (- e (assoc-get 'X left-info)))
   `(
 ,(assoc-get 'X left-info)
 ,@(map
   interval-center
   (drop-right (drop nc-exts 1) 1))
 ,(assoc-get 'X right-info
  (ls (iota (1- (length x-coords)) 20 20))
  (color-gradient
(assoc-get 'color-gradient (ly:grob-property grob 'details) '(1)))
  ;; overkill below ...
  (safe-color-gradient-ls
(append
  color-gradient
  (make-list (length x-coords) (last color-gradient
  (color
(assoc-get 'color (ly:grob-property grob 'details)))
  (colors
(map
  (lambda (n)
(x11-color (string->symbol (format #f "~a~a" (or color
'grey) n
  safe-color-gradient-ls)))
(apply
  ly:stencil-add
  (make-filled-box-stencil-list x-coords thick colors '()

{
\override TextSpanner.thickness = 0.5
%% make sure color and it's gradient exists, otherwise all's black
\override TextSpanner.details.color = #'grey
\override TextSpanner.details.color-gradient = #'(60 40 20)
\foo
c''2\startTextSpan
d''
e''
f''\stopTextSpan
}

{
\override TextSpanner.thickness = 0.5
\override TextSpanner.details.color = #'LightCyan
\override TextSpanner.details.color-gradient = #'(2 3 4)
\foo
c''2\startTextSpan
d''
e''
f''\stopTextSpan
}
___
lilypond-user mailing list

Re: test spanner with controlled gradient / dynamic volume curve indicated by grey level

2018-01-30 Thread Michael Winter
A bit more here. I think I can fake this in a markup... See example 
pasted below. My scheme skilz are minimal. I would like yo do this 
interpolating between the x position of adjacent notes. So maybe I can 
do this as a custom beam stencil. or some kind of spanner. Basically I 
want a scheme function that will give me the position of a given note 
and the next note... Thanks!


\relative c'' {
  s64
  -\markup {
    \combine
    \override #'(line-join-style . miter)
    \with-color #(x11-color 'grey60)
    \path #2
    #'((moveto 0 0)
 (lineto 0.3 0)
 (closepath)
 )

   \combine
    \override #'(line-join-style . miter)
    \with-color #(x11-color 'grey40)
    \path #2
    #'((moveto 0.3 0)
 (lineto 0.6 0)
 (closepath))

    \override #'(line-join-style . miter)
    \with-color #(x11-color 'grey20)
    \path #2
    #'((moveto 0.6 0)
 (lineto 0.9 0)
 (closepath))
  }


}


On 01/29/2018 06:27 PM, Michael Winter wrote:

Hello...

I have tried quite a few hacks, but nothing really suitable.

What I really want is to simple draw a line beneath the staff that has 
a grey scale gradient such that for each note, I give a target value.


Most of what I have tried involves doing this in increments with 
overlapping spanners, I also tried the code in this thread:

https://lists.nongnu.org/archive/html/lilypond-user/2016-10/msg00097.html

I think the answer is doing this with svg directives since in the svg 
documentation there are directives for linear gradients, but I do not 
know how to build the function to use svg directives and such that the 
target greyscale value is reached at the x-position of a given notehead.


Also, ideally I would be able to use spacer rests to give intermediary 
values along the way, since the curve is actually not linear.


Thanks in advance and my apologies if I have been unclear.

Best,
Michael




___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user