Re: override stencil question
Good! I appreciate it, Nathan. It works like a charming, now. -- View this message in context: http://lilypond.1069038.n5.nabble.com/how-to-create-lines-between-all-consecutive-notes-tp142126p177490.html Sent from the User mailing list archive at Nabble.com. ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: override stencil question
Sorry, Nathan. I will try to make my point clearer. *Firstly*, I got the code developed earlier in this thread and altered the numbers of handles of path-gliss to four -- the original version came with the values (list 'curveto 0 0 (first handle) (second handle)). Here's my version of the code: \version 2.18.2 glissWidth = #0.175 % 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)) (#:path glissWidth (list (list 'moveto 0 0) (list 'curveto (first handle) (second handle) (third handle) (fourth handle) width (* height dir)) (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)) \relative c' { \numericTimeSignature \tempo 4=52 \override NoteHead.font-size = #-1.5 $(add-grace-property 'Voice 'NoteHead 'font-size -4.5) \time 5/8 \override Score.GraceSpacing.spacing-increment = #7 \once \override Glissando #'bound-details = #'((right (attach-dir . -2) (end-on-accidental . #f) (padding . 1)) (left (attach-dir . 0) (padding . 0.))) \addGliss { \once \override Glissando #'stencil = #(path-gliss '(7 1 0 4)) \grace b16 a''4.~-} \tuplet 5/4 { a16 gis fis, e'- a,~ } \time 3/8 } With that, i am able to get that (missing only the arrowhead to get what I want): http://lilypond.1069038.n5.nabble.com/file/n177488/example1.png --- Then, I got your useful version and was able to get that: \version 2.18.2 arc = #(list 0 0) % global variable to bezier curve handle glissWidth = #0.2 % global variable for glissando width #(define (set-arc x y) (set! arc (list x y))) #(define (get-arc) arc) #(define (radians-degrees theta) (* theta (/ 180 PI))) #(define (path-gliss 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)) (handle (get-arc))) ;- getting the handle value here (ly:stencil-translate (ly:stencil-add (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)) (#:path glissWidth (list (list 'moveto 0 0) (list 'curveto 0 0 (first handle) (second handle) width (* height dir)) (ly:stencil-translate ; the \rotate markup command doesn't let us pick a rotation center, so we resort to the stencil command (ly:stencil-rotate (grob-interpret-markup grob (markup #:arrow-head X RIGHT #t)) (radians-degrees
Re: override stencil question
Hi, I'm just new to Lilypond, not a programing knower, but just trying to follow some instructions on the forum so I can finally achieve really beautiful scores in a not-too-easy but definitely intelligent way. I wanted to make a curved glissando between two notes and this thread helped me a lot with that. I am able to redraw the curve to fit my intents but by now I am just missing an arrow at the end of it pointing to the second note's notehead. http://lilypond.1069038.n5.nabble.com/file/n177481/Screen_Shot_2015-06-04_at_14.png I've been trying hard to do that by inserting arrow-head markup inside what you coded. But I am just not able to do that. When I get closer, the gliss curve is gone and I have only the arrow-head attached to the grace note of the example. Do you guys have any idea how I could implement this inside this code. Or maybe it would be a simpler solution for this also. Thanks! Paulo -- View this message in context: http://lilypond.1069038.n5.nabble.com/how-to-create-lines-between-all-consecutive-notes-tp142126p177481.html Sent from the User mailing list archive at Nabble.com. ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: override stencil question
Hey Nathan This is just the code developed in the thread plus more adjustable handles for curveto: % \version 2.17.13 glissWidth = #0.175 % 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)) (#:path glissWidth (list (list 'moveto 0 0) (list 'curveto (first handle) (second handle) (third handle) (fourth handle) width (* height dir)) (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)) and in the score: \relative c' { %... \time 5/8 { \override Score.GraceSpacing.spacing-increment = #7 \addGliss { \once \override Glissando #'bound-details = #'((right(attach-dir . -0.5) (end-on-accidental . #t) (padding . 0.5)) (left (attach-dir . 2) (padding . -0.1))) \once \override Glissando #'stencil = #(path-gliss '(4 0 1.5 5)) \s \snh \grace b16^(} a'' \single \voz-ef c, 4.~-) \override Stem.details.beamed-lengths = #'(6 6 6) \tuplet 5/4 { 16 gis fis, e'- a,~ } \revert Stem.details | \revert Score.GraceSpacing.spacing-increment } \time 3/8 } - To insert the arrow-heads, I tried to implement some lines of the code discussed in the next link: http://lilypond.1069038.n5.nabble.com/arpeggio-line-td57703.html http://lilypond.1069038.n5.nabble.com/arpeggio-line-td57703.html I tried to adapt that and insert in the glissando code, but that I was not able to do. -- View this message in context: http://lilypond.1069038.n5.nabble.com/how-to-create-lines-between-all-consecutive-notes-tp142126p177483.html Sent from the User mailing list archive at Nabble.com. ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: override stencil question
Thanks a lot, Nathan! This will really works fine. I just have one question now. I would very much appreciate if you could help me with that. I would like to have local control upon all the four variables of list 'curveto. With the set-arc function you created, I have control only upon the two last variables. I tried to substitute the line (list 'curveto 0 0 (first handle) (second handle) width (* height dir)) for: (list 'curveto (first handle) (second handle) (third handle) (fourth handle) width (* height dir)) and the lines ($atan2 (- (* height dir) (second handle)) (- width (first handle 1 0) for: ($atan2 (- (* height dir) (fourth handle)) (- width (third handle 1 0) ...but was not successful. Would you help me with that? Thank you again! Best, Paulo -- View this message in context: http://lilypond.1069038.n5.nabble.com/how-to-create-lines-between-all-consecutive-notes-tp142126p177485.html Sent from the User mailing list archive at Nabble.com. ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user