Re: Test direction within event-function
Urs Liska writes: > Hi, > > I'm trying to write an event-function that creates both a slur and a > markup on opposite sides. I can do that by manually specifying the > directions: > > \version "2.19.82" > > testDirection = > #(define-event-function ()() >#{ > _( > ^"Text" >#}) > > { > c' \testDirection d' ) > } > > but I have to make it possible to do it both ways (top/bottom and > bottom/top). > I know how to set the directions with an extra (optional) function > argument, but I would prefer if I could extract the direction directly > from within the event-function. You can't. It is set after calling the event-function. You can use tweaks/callbacks for the respective grob functions (most likely "direction") where you use event-cause to get the originating event, get the event direction from there and either use or invert it. Am badly available for a few days. Sister's wedding. -- David Kastrup ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: test if an element occurs in a list exactly once
Urs Liska writes: > Hi, > > I have to validate symbol-lists in various ways. For example if it > must contain exactly two values (in arbitrary order) I can do > > (and (= (length mylist) 2)(memq 'val-a mylist) (memq 'val-b mylist)) > > To test if only certain values are allowed (but may be there multiple > times): > > (every (lambda (elt) (memq elt '(val-a val-b))) mylist) > > Now I have a case where one value must be present once and another > value at least once, so '(a b b) is valid as well as '(a b) but '(a a > b) is invalid. > > I can use (filter) and check if the resulting list has exactly one > element, but is there a "native" function to either check if an > element is in a list exactly once? If "in arbitrary order" is a general feature of your symbol list, there are two obvious ways of preprocessing it depending on whether you are doing bulk verification/processing or partial verification/processing based on particular keys. For bulk processing, you sort the list, then process it in linear order once. Multiple keys will occupy successive places then, not requiring any search. For key-based processing, you convert the list into a hash table, with each symbol mapping to a count. You can then look up each key in that hash table and perform appropriate actions for its multiplicity. -- 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
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
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-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 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
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 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
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
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
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
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 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
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-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
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
Michael Winterwrites: > 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
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 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
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
Re: Test
Looks like it's just taking a while to filter through. -- Phil Holmes - Original Message - From: John Link To: lilypond-user@gnu.org Sent: Sunday, March 11, 2012 7:33 PM Subject: Test This is the third message I've sent to the list. I did not receive the other two despite having specified in my settings that I am to receive copies of messages I send. If anyone can tell me what I need to do I would appreciate it. Thanks, John Link johnl...@nyc.rr.com http://www.cdbaby.com/all/johnlink http://www.myspace.com/johnlinkproject -- ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: test of convert-ly
On Thu 19 May 2011, 18:02 Carl Sorensen wrote: This should probably be an enhancement request -- to have convert-ly ignore lines with comments. We currently don't have any status checking to see if we are in a comment or not. Added as 1659: http://code.google.com/p/lilypond/issues/detail?id=1659 Thank you! -- Dmytro O. Redchuk Bug Squad ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: test of convert-ly
On 5/18/11 11:36 AM, ggit ggit@gmail.com wrote: Hi, I've done some tests with convert-ly. Could be of use for a next improving. (I don't master myself regular expressions). Using tools from Lilypond 2-13-61. Applying conversion from \version 2.13.31 (to 2.13.51). Input file : %%% \version 2.13.31 %% 0 : comment with the words : converted from \version 2.13.31 on may 18th \paper { %% 1 : KO top-system-spacing = #`((space . ,(* 8 mm))(stretchability . 0)(padding . 1)) %% 2 : OK top-system-spacing = #'((space . 8)(stretchability . 0)(padding . 1)) %% 3 : comment with the words : foot-separation is obsolete. %% 4 : comment with the words : foot-separation. %% 5 : comment with this word : foot-separationn %% 6 : comment with this word : foot-separatio } %%% Results : -the line 0 *is* converted to ...2.13.51..., which is bad to me This should probably be an enhancement request -- to have convert-ly ignore lines with comments. We currently don't have any status checking to see if we are in a comment or not. -the line (after) 1 is *not* converted. IIRC, this was a choice to not handle potentially troublesome conversions. But perhaps we should include a NOT_SMART rule, if possible. -the line (after) 2 is converted to correct syntax : top-system-spacing = #'((basic-distance . 8)(stretchability . 0)(padding . 1)) -the lines 3, 4 or 5 (in spite of being comments) cause convert-ly to complain (Not smart enough...) Same as the version string. Line 5 is a limitation in our convert-ly rules for NOT_SMART, because we don't restrict ourselves to whole words only. There is already an issue out for this -- issue 798. -the line 6 is ok (no complain, no conversion) (test after deleting lines 3 and 4) Thanks for the test! Carl ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: test files for musicxml
Laura Conrad wrote: There's a site called http://www.wikifonia.org that has a lot of lead sheets in both PDF and musicxml. The one I looked at first http://www.wikifonia.org/node/847 (Edith Piaf's _La vie en rose_) might show up some problems with the musicxml2ly import of both chords and lyrics. What's most interesting is that the few that I looked at say they were engraved by Lilypond. In my few minutes there I didn't see if we could get the Lily source. Paul Scott ___ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user
Re: test files for musicxml
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Am Freitag, 3. April 2009 schrieb Laura Conrad: There's a site called http://www.wikifonia.org that has a lot of lead sheets in both PDF and musicxml. The one I looked at first http://www.wikifonia.org/node/847 (Edith Piaf's _La vie en rose_) might show up some problems with the musicxml2ly import of both chords and lyrics. Yes, there are some nasty issues, in particular with inserting proper spacing notes and with lyrics on manually beamed notes (which lilypond understands as melisma...) The other problem is that the MusicXML files use the chord type dominant- seventh, which does not exist in MusicXML. The correct chord type would be dominant for the dominant-seventh chord... I've also fixed some other issues (in particular those bar check warnings) with chords. There are still some issues remaining... Cheers, Reinhold - -- - -- Reinhold Kainhofer, reinh...@kainhofer.com, http://reinhold.kainhofer.com/ * Financial Actuarial Math., Vienna Univ. of Technology, Austria * http://www.fam.tuwien.ac.at/, DVR: 0005886 * LilyPond, Music typesetting, http://www.lilypond.org -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (GNU/Linux) iD8DBQFJ1jR/TqjEwhXvPN0RAq4rAJ9eBWUGFFNiqPz6XmtLxJvPiYFZnACffPlW maUpDAdij8A3kVPOKjqkTts= =8/fI -END PGP SIGNATURE- ___ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Test
I've received the test. Cheers, - Graham On Tue, 5 Aug 2008 13:43:25 -0400 Palmer, Ralph [EMAIL PROTECTED] wrote: Greetings - I apologize for the trash, but I've stopped receiving the user list mailings. I changed my subscription, and this is a test. Ralph ___ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user ___ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Test
Sorry for posting this with wrong subject header! I've given it another try! Jonas ___ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user
RE: Test
Could you use a rhythm context and only include it in the midi output? Date: Sat, 18 Aug 2007 10:28:40 +0200From: [EMAIL PROTECTED]: lilypond-user@gnu.org; [EMAIL PROTECTED]: Fwd: TestCC: Hi!Being a Lilypond newbee, I want to check with you if this is possible:I want to create an inivisble sync part with sync noteheads drawn in white. Main reasons: The invisible white noteheads of the sync part should produce clickable links in the output pdf. These links, and their coordinates on the the pdf-page, could be used as a basis for syncing a graphical moving pointer to a wav playback of the example. (I'm using a midi to wav for converting, so I know what the playback position of the notes are in the wav file...) The invisible sync part could produce a metronome click midi track.I would prefer the sync part to NOT affect the x-spacing of the visible parts.Have a look at the jpg file, hopefully it should make things clearer. Best regards!Jonas Nyström _ Connect to the next generation of MSN Messenger http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-ussource=wlmailtagline___ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Test
Hi Ed! That gives me the information for a midi click track, but it doesn't solve the tricky part of calculating the music placement coordinates on the page... The only solution that I can see is using the PDF coordinates for the noteheads... Jonas 2007/8/18, Ed Ardzinski [EMAIL PROTECTED]: Could you use a rhythm context and only include it in the midi output? -- Date: Sat, 18 Aug 2007 10:28:40 +0200 From: [EMAIL PROTECTED] To: lilypond-user@gnu.org; [EMAIL PROTECTED] Subject: Fwd: Test CC: Hi! Being a Lilypond newbee, I want to check with you if this is possible: I want to create an inivisble sync part with sync noteheads drawn in white. Main reasons: 1. The invisible white noteheads of the sync part should produce clickable links in the output pdf. These links, and their coordinates on the the pdf-page, could be used as a basis for syncing a graphical moving pointer to a wav playback of the example. (I'm using a midi to wav for converting, so I know what the playback position of the notes are in the wav file...) 2. The invisible sync part could produce a metronome click midi track. I would prefer the sync part to NOT affect the x-spacing of the visible parts. Have a look at the jpg file, hopefully it should make things clearer. Best regards! Jonas Nyström -- Connect to the next generation of MSN Messenger Get it now! http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-ussource=wlmailtagline ___ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user -- Med vänlig hälsning! Jonas Nyström [EMAIL PROTECTED] 070-670 36 50 ___ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user
Re: test failed (installing error) Mac OSX
Hi, 1) To install Lilypond 2, first configure fink to accept unstable package: in the file : /sw/etc/fink.conf add unstable/main unstable/crypto at the end of the Trees: line and then type: fink install lilypond. 2) X11SDK for MacOS X.2 is no longer available from Apple site and my Mac is not upgradable to Mac OS X.3. I have copied missing library files from another Mac. Hope this helps. Pascal Le dimanche, 23 nov 2003, à 22:50 Europe/Paris, nikolai zinke a écrit : Hello, I guess you've become many dummy questions like these, but your interface lilypond seems to be reaally amazing, so I must insist of getting help with installing and - hopefully - running! I'm using Mac OSX 10.2.8 and have Developer tools installed I unpacked Fink (latest version) and installed it; then I ran the Terminal and tried to install lilypond by typing: fink install lilypond-unstable, but does'nt work, so I typed only: fink install lilypond then many installing routines happened, with updating, compiling etc. - But there was an error while installing after installing: Terminal showed: -- - found apple library - found /usr/X11R6/bin/xterm - found /usr/X11R6/bin/xrdb - found /usr/X11R6/bin/rman - missing /usr/X11R6/lib/libX11.dylib - missing /usr/X11R6/lib/libXpm.dylib - missing /usr/X11R6/lib/libXaw.dylib - missing /usr/X11R6/include/X11/Xlib.h - Apple X11 SDK is missing ** ERROR! ** It appears you have a partially-installed version of the Apple X11 release. To use Apple's X11 with Fink, you must download both the main X11 installer, as well as the SDK (there are actually 2 separate downloads for the Apple X11 release). Please go to http://www.apple.com/macosx/x11/ and download and install the missing files, and re-attempt your install of system-xfree86. dpkg: error processing /sw/fink/dists/stable/main/binary-darwin-powerpc/x11-system/system-xfree86_4.2-13_darwin-powerpc.deb (--install): subprocess pre-installation script returned error exit status 1 Errors were encountered while processing: /sw/fink/dists/stable/main/binary-darwin-powerpc/x11-system/system-xfree86_4.2-13_darwin-powerpc.deb ### execution of dpkg failed, exit code 1 Failed: can't install package system-xfree86-4.2-13 Nevertheless I tried to run lilypond: I typed lilyPond --help but : lilyPond: Command not found. I wonder if you could help me! (Perhaps I do what Terminal says and re-install my X11-System first, but is it enough for correct working ) Thanks a lot for response, best regards, Nikolai Zinke ___ Lilypond-user mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/lilypond-user ___ Lilypond-user mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/lilypond-user
Re: test failed (installing error) Mac OSX
On Nov 24, 2003, at 11:23 AM, Pascal Legris wrote: 2) X11SDK for MacOS X.2 is no longer available from Apple site and my Mac is not upgradable to Mac OS X.3. I have copied missing library files from another Mac. Since X11 is included with Panther to start with, the X11 SDK is now downloadable together with the developer tools, XCode. You should have that on one of the installation cd's. If not you have to download from connect.apple.com Make sure you check that the X11 SDK is checked in the installation. -- Terje Life begins when you can spend your spare time programming instead of watching television. -- Cal Keegan smime.p7s Description: S/MIME cryptographic signature ___ Lilypond-user mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/lilypond-user
Re: test failed (installing error) Mac OSX
On Sun, 23 Nov 2003 22:50:36 +0100 nikolai zinke [EMAIL PROTECTED] wrote: - missing /usr/X11R6/lib/libX11.dylib - missing /usr/X11R6/lib/libXpm.dylib - missing /usr/X11R6/lib/libXaw.dylib - missing /usr/X11R6/include/X11/Xlib.h - Apple X11 SDK is missing * ** ERROR! ** It appears you have a partially-installed version of the Apple X11 release. To use Apple's X11 with Fink, you must download both the main X11 installer, as well as the SDK (there are actually 2 separate downloads for the Apple X11 release). Please go to http://www.apple.com/macosx/x11/ and download and install the missing files, and re-attempt your install of system-xfree86. I wonder if you could help me! (Perhaps I do what Terminal says and re-install my X11-System first, but is it enough for correct working ) Do exactly as it says -- install the SDK for Apple X11. You don't need to reinstall Apple X11; you just need to install that additional package (the SDK). Cheers, - Graham ___ Lilypond-user mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/lilypond-user
Re: Test
So do you get this mail?! Glyn ___ Lilypond-user mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/lilypond-user
Re: Test file
Carter Brey wrote: Hi all, This is one of the files I've tried to compile with Lily 2.0.1, both before and after running it through convert-ly. I only get error messages in either case. If it runs for you, please let me know. It doesn't run for me. convert-ly didn't seem to convert to the new \markup Attached is a version of your file with most of the remaining errors converted to \markup. I left you two things to correct. HTH, Paul Scott #(ly:set-option 'old-relative) #(set! point-and-click line-location) \version 1.9.8 \header{ title = Study in Tango subtitle = For solo Cello composer = Carter Brey dedication = In Memory of Stephen Kates tagline = New York City, July, 2002 copyright = Copyright © 2002 by Carter Brey } \score{ \notes{ \property Staff.midiInstrument = #cello \key d \minor \time 5/4 \clef tenor \property Voice.TupletBracket \override #'padding = #1 \property Voice.TextScript \override #'extra-offset = #'( -3 . 0 ) \property Voice.Hairpin \override #'extra-offset = #'(0 . -1) \relative c'' {a4\sfp-^\markup{ \column \large \bold Introduction \large \italic very free }(^\fermata ~ \property Voice.TextScript \revert #'extra-offset \times 8/7 { a32[\ bes a g a bes a)]} \property Voice.TupletBracket \set #'number-visibility = ##f \times 8/7 { g[( a g f g a g)]} \times 8/7 { f[( g f e f g f)]} \times 8/7 { e[( f e d e f ) e\!]} a,4-0\f \clef bass \property Voice.Hairpin \revert #'extra-offset \times 8/7 { a32[-3\mf\( bes a g a bes a)]} \times 8/7 { g[( a g f g a g)]} \times 8/7 { f[( g f e f g f)]} \times 8/7 { e[^^\markup{ \italic rall. } ( f e d e f ) e\!]} \property Voice.DynamicText \override #'extra-offset = #'(0 . -1.5) bes-- d16\f f-- d-- f-- bes^^^\markup{ \italic accel. } f) d' bes f' d bes' f d' bes f' d \clef treble bes' f d' bes \property Voice.DynamicText \revert #'extra-offset f'4-^\fermata \times 8/7 { e32[(\pp f e d e f e)]} \times 8/7 { d[( e d c d e d)]} \times 8/7 { c[( d c bes c d c)]} \times 8/7 { bes[( c bes a bes c bes)]} \times 8/7 { a[\( bes a g a bes a)]} \times 8/7 { bes[( c bes a bes c bes)]} \times 8/7 { a[( bes a g a bes a)]} \times 8/7 { g[( a g f g a g)]} \times 8/7 { f[( g f e f g ) f\!]} e4\f \clef bass \smalla,,32[_\markup{ \italic dim. } ( cis e a e cis a cis] \clef tenor \times 8/11 { e32[ a cis e cis a cis e a cis e)]} \clef treble \normalsize a4\p^\fermata \clef bass a,,,16[\ff-\markup{ \large \bold Allegro } g)-^ f-^ e-^] \time 10/16 \bar || } \stemUp d, a,[-( f a) d, a,] e, b,[-( g a) e, b,] f, c[- a a] g, d[- a bes] \stemBoth \property Voice.TupletBracket \set #'number-visibility = ##t \times 6/7 {a a32(- bes a gis a bes a)} \times 6/7 {a a(- bes a gis a bes a)} \times 4/5 {a a(- bes a gis a)} \times 4/5 {a a(- bes a gis a)} \stemDown a,_\markup{ \italic simile }( f16[ f d') a, f] c g[( g e') c g] d bes[ bes f'] bes g'[ ees bes] \stemBoth \clef tenor \times 6/7 {e cis' a'32( bes' a' g' a' bes' a')} \times 6/7 {a'( bes' a' g' a' bes' a')} \times 4/5 {a'( bes' a' g' a')} \times 4/5 {a'( bes' a' g' a')} \clef treble \relative c'' { \times 6/8 { d32[( c bes a g f e d)]} \times 6/8 { c'[( bes a g f e d c)]}bes[( c d e f g a bes)] \times 6/7 {e, a( f e d e f e)} \times 6/7 {e a( f e d e f e)} \times 4/5 {e a( f e d e)} \times 4/5 {e a( f e d e)} \clef bass \times 6/8 { d[\mf( c bes a g f e d)]} \times 6/8 { c'[( bes a g f e d c)]}bes[( c d e f g a bes)] \times 6/7 {e, a( f e d e f e)} \times 6/7 {e a( f e d e f e)} e[\( f g a b cis d ) e\!]} \stemDown a f'16[(\f d a) d a] c a[( a e') c a] b, gis[ gis d'] a, e[ e c'] gis, e[( e b) e b] g, e[( e b) e b] fis, d[ d a] fis, d[ d a] \stemBoth \property Voice.TupletBracket \override #'padding = #1.5 \relative c'' { \times 16/17 {a32( g fis e d cis b a g fis e d cis b a g fis)}} \stemUp f, d16[ d a] \stemBoth \relative c'' { \times 16/17 {a32( g f e d c bes a g f e d c bes a g f)}e[( f g f)]} \property Voice.TupletBracket \override #'padding = #1 \stemUp
re: Test file
My thanks to both Paul and Thorkil for their kind replies. I apologize to the for the [spam] header in my last post; my antispam utility (PopFile) is still learning, and I forgot to alter the header before replying. Sic transit cloaca mundi. CB ___ Lilypond-user mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/lilypond-user