Re: guide finger
Hi pabuhr, On Mon, Aug 20, 2012 at 11:45 PM, pabuhr pab...@fastmail.fm wrote: Thank you so much. However, because rotate performs its rotation around the center of the character I need to make a small adjustment. There is a rotation routine allowing rotation at an arbitrary point but it appears to be solely for music not markups. I suppose you're thinking of ly:stencil-rotate. You can use this in the function, since the result of grob-interpret-markup is a stencil: #(define (gx rotate-guide fingering) (let ((music (make-music 'FingeringEvent)) (finger (ly:music-property fingering 'digit)) (guide-char #x2013)) (set! (ly:music-property music 'tweaks) (acons 'stencil (lambda (grob) (ly:stencil-combine-at-edge (ly:stencil-rotate (grob-interpret-markup grob (markup #:char guide-char)) rotate-guide -1 1) X 1 (grob-interpret-markup grob (number-string finger)) 0)) (ly:music-property music 'tweaks))) music)) I tried the following change using translate but there is no translate-guide routine, which was a guess on my part after looking at the way rotate is used. I have attempted to locate a list of these Scheme routines but been unsuccessful. I even downloaded the GIT source for lilypond and tried to find them there. So I have done due diligence, but I may have done the wrong things. Can someone show me how to make translate move the character? I can do the fine tuning of the position after that. I don't find a list of the make-...-markup formulations, and I just created make-rotate-markup as you made make-translate-markup. To express markups in Scheme in a way that is closer to ordinary input you can use the syntax detailed here (I show this below as an alternative): http://www.lilypond.org/doc/v2.15/Documentation/extending/markup-construction-in-scheme This is how to get the translation to work: #(define (gx rotate-guide fingering) (let ((music (make-music 'FingeringEvent)) (finger (ly:music-property fingering 'digit)) (guide-char #x2013)) (set! (ly:music-property music 'tweaks) (acons 'stencil (lambda (grob) (grob-interpret-markup grob ; EITHER: ;(make-concat-markup ; (list ;(make-translate-markup '(2 . 3) ;(make-rotate-markup rotate-guide (make-char-markup guide-char))) ;(number-string finger) ; OR: (markup #:concat (#:translate '(2 . 3) (#:rotate rotate-guide (#:char guide-char))) (number-string finger (ly:music-property music 'tweaks))) music)) == You might consider upgrading to one of the current development versions if you're interested in writing functions like this. There is now quite a bit more flexibility and power to music functions (thanks to David Kastrup). I am using GNU LilyPond 2.15.41 even though my files still have \version 2.14.2 at the start. Again, I spent some time trying to locate scheme music functions but was wholly unsuccessful. But I may just be searching with the wrong magic phrases. Well, here I was meaning that it was a simple matter to keep your original formulation as a music function and call it from another music function. (See attached. This will cause errors if you try it with 2.14.2.) HTH, David finger-slide.ly Description: Binary data ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: guide finger
I suppose you're thinking of ly:stencil-rotate. Brilliant! Now let me see if I can reward your patience by showing you I have learned something. The rotation needs to be along the right centre (center) so the character appears to rotate in the middle of the finger number, which I figured out. Also, I put in some documentation. And I generalize one step further by allowing the ornamentation character to be passed as an argument. However, I don't know how to write gsc (see below) to pass in a character or unicode to gx. So I still need help. Also, does scheme have optional positional parameters and/or named parameters to possibly allow more generalization, such as the padding size or putting the ornamentation before or after the finger symbol? (Yea, I'm probably getting carried away here. ;-) == \version 2.14.2 #(define (gx slope character fingering) ;; Purpose ;; add ornamentation character before fingering symbol ;; Parameters ;; slope : angle of rotation around right centre ;; character : ornamentation character before fingering ;; fingering : fingering designation for note ;; Examples ;; (gx 0 #x2013 fingering) ;;unicode #x2011 - #x2015 are different length - punctuation (let ((music (make-music 'FingeringEvent)) (finger (ly:music-property fingering 'digit)) (guide-char character)) (set! (ly:music-property music 'tweaks) (acons 'stencil (lambda (grob) (ly:stencil-combine-at-edge (ly:stencil-rotate (grob-interpret-markup grob (markup #:char guide-char)) slope 1 0);; rotate slope around right centre X 1;; combine stencils along X-axis on right (grob-interpret-markup grob (number-string finger)) 0.2)) ;; add padding to move guide slightly left from finger number (ly:music-property music 'tweaks))) music)) % guide-neutral gn = #(define-music-function (parser location fingering) (ly:music?) (gx 0 #x2013 fingering)) % guide-down gd = #(define-music-function (parser location fingering) (ly:music?) (gx 30 #x2013 fingering)) % guide-up gu = #(define-music-function (parser location fingering) (ly:music?) (gx -30 #x2013 fingering)) % guide slope gs = #(define-music-function (parser location slope fingering) (number? ly:music?) (gx slope #x2013 fingering)) % guide slope character gsc = #(define-music-function (parser location slope character fingering) (number? char? ly:music?) (gx slope character fingering)) \relative c' { \override Fingering #'font-size = #-2 \override Fingering #'color = #red \set fingeringOrientations = #'(left) c-\gn-14 c4^\gn^2 c4-\gn-3 c4_\gn_4 \set fingeringOrientations = #'(right) c-\gn-34 r4 c-\gu-14 r4 c4^\gu^2 c4-\gd-3 c4_\gd_4 r4 c-\gs #-15 -14 r4 c4^\gs #15 ^2 c4-\gs #45 -3 c4_\gs #-45 _4 % these don't work % r4 % c-\gsc #-15 ##x2011 -14 % r4 % c4^\gsc #15 ##x2012 ^2 % c4-\gsc #45 ##x2013 -3 % c4_\gsc #-4 ##x2014 _4 % r4 % c-\gsc #-15 '+' -14 % r4 % c4^\gsc #15 '+' ^2 % c4-\gsc #45 '+' -3 % c4_\gsc #-4 '+' _4 } ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: guide finger
Hi pabuhr, On Tue, Aug 21, 2012 at 4:58 PM, pabuhr pab...@fastmail.fm wrote: I suppose you're thinking of ly:stencil-rotate. Brilliant! Now let me see if I can reward your patience by showing you I have learned something. :) The rotation needs to be along the right centre (center) so the character appears to rotate in the middle of the finger number, which I figured out. Also, I put in some documentation. And I generalize one step further by allowing the ornamentation character to be passed as an argument. However, I don't know how to write gsc (see below) to pass in a character or unicode to gx. So I still need help. That was a puzzler :) Turns out, the markup command \char takes an integer (seems obvious in retrospect...). You can see its definition in the file `define-markup-commands.scm'. So you just need to change the type predicate in gsc: % guide slope character gsc = #(define-music-function (parser location slope character fingering) (number? integer? ly:music?) (gx slope character fingering)) In order to pass the '+' character with \gsc you have to convert it to an integer: c4^\gsc #15 #(char-integer #\+) ^2 Also, does scheme have optional positional parameters and/or named parameters to possibly allow more generalization, such as the padding size or putting the ornamentation before or after the finger symbol? (Yea, I'm probably getting carried away here. ;-) Well, you could easily pass the direction in (and whatever else) by adding another argument. You could use conditionals within the function--do this if the direction is -1, etc. (You might also be able to use the direction as a multiplier.) If you decide exactly what extras you want with the function, I'll be glad to help! Best, David ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: guide finger
Thank you so much. However, because rotate performs its rotation around the center of the character I need to make a small adjustment. There is a rotation routine allowing rotation at an arbitrary point but it appears to be solely for music not markups. I tried the following change using translate but there is no translate-guide routine, which was a guess on my part after looking at the way rotate is used. I have attempted to locate a list of these Scheme routines but been unsuccessful. I even downloaded the GIT source for lilypond and tried to find them there. So I have done due diligence, but I may have done the wrong things. Can someone show me how to make translate move the character? I can do the fine tuning of the position after that. #(define (gx rotate-guide fingering) (let ((music (make-music 'FingeringEvent)) (finger (ly:music-property fingering 'digit)) (guide-char #x2013)) (set! (ly:music-property music 'tweaks) (acons 'stencil (lambda (grob) (grob-interpret-markup grob (make-concat-markup (list (make-rotate-markup rotate-guide (make-char-markup guide-char)) ;;(make-translate-markup translate-guide '(2 . 3) (make-rotate-markup rotate-guide (make-char-markup guide-char))) (number-string finger) (ly:music-property music 'tweaks))) music)) == You might consider upgrading to one of the current development versions if you're interested in writing functions like this. There is now quite a bit more flexibility and power to music functions (thanks to David Kastrup). I am using GNU LilyPond 2.15.41 even though my files still have \version 2.14.2 at the start. Again, I spent some time trying to locate scheme music functions but was wholly unsuccessful. But I may just be searching with the wrong magic phrases. ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
guide finger
In *classical* guitar-music, there is a finger augmentation called a guide finger indicating left-hand shifting. Nick Payne uses a mechanism based on the glissando. I found this code written for a finger shift on a violin, which I like because it handles finger location and color, etc. However, for guitar, there are 3 kinds of finger shift: up, neutral and down, corresponding to about 30 degrees up, flat and 30 degrees down for the - character. So I can't make the changes to do what I want. 8-( I have sketched out what I would like, which is 2 default parameters, the guide character and the rotation amount, and to rotate this character before concatenating it with the string number. Any help would be greatly appreciated. \version 2.14.2 gn = #(define-music-function (parser location fingering) (ly:music?) ;; #:properties ((guide-char #x2013) (rotate-guide 0)) (let ((music (make-music 'FingeringEvent)) (finger (ly:music-property fingering 'digit))) (set! (ly:music-property music 'tweaks) (acons 'stencil (lambda (grob) (grob-interpret-markup grob (make-concat-markup (list ;; (rotate rotate-guide (make-char-markup guide-char) ) (make-char-markup #x2013) (number-string finger) (ly:music-property music 'tweaks))) music) ) % gu = \override #'(rotate-guide 30) \gn % gd = \override #'(rotate-guide -30) \gn \relative c' { \override Fingering #'color = #red \set fingeringOrientations = #'(left) c-\gn-34 c4^\gn^3 c4-\gn-3 c4_\gn_3 \set fingeringOrientations = #'(right) c-\gn-34 % c-\gu-34 % c4^\gu^3 % c4-\gu-3 % c4_\gu_3 } ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: guide finger
Hello, On Sun, Aug 19, 2012 at 2:04 PM, pabuhr pab...@fastmail.fm wrote: In *classical* guitar-music, there is a finger augmentation called a guide finger indicating left-hand shifting. Nick Payne uses a mechanism based on the glissando. I found this code written for a finger shift on a violin, which I like because it handles finger location and color, etc. However, for guitar, there are 3 kinds of finger shift: up, neutral and down, corresponding to about 30 degrees up, flat and 30 degrees down for the - character. So I can't make the changes to do what I want. 8-( I have sketched out what I would like, which is 2 default parameters, the guide character and the rotation amount, and to rotate this character before concatenating it with the string number. Any help would be greatly appreciated. With 2.14.2, I come up with the code below. I've added a function which lets you specify the angle. You might consider upgrading to one of the current development versions if you're interested in writing functions like this. There is now quite a bit more flexibility and power to music functions (thanks to David Kastrup). HTH, David %% \version 2.14.2 #(define (gx rotate-guide fingering) (let ((music (make-music 'FingeringEvent)) (finger (ly:music-property fingering 'digit)) (guide-char #x2013)) (set! (ly:music-property music 'tweaks) (acons 'stencil (lambda (grob) (grob-interpret-markup grob (make-concat-markup (list (make-rotate-markup rotate-guide (make-char-markup guide-char)) (number-string finger) (ly:music-property music 'tweaks))) music)) gn = #(define-music-function (parser location fingering) (ly:music?) (gx 0 fingering)) gu = #(define-music-function (parser location fingering) (ly:music?) (gx 30 fingering)) gd = #(define-music-function (parser location fingering) (ly:music?) (gx -30 fingering)) % BONUS! ggg = #(define-music-function (parser location slope fingering) (number? ly:music?) (gx slope fingering)) \relative c' { \override Fingering #'color = #red \set fingeringOrientations = #'(left) c-\gn-3 4 c4^\gn^3 c4-\gn-3 c4_\gn_3 \set fingeringOrientations = #'(right) c-\gn-34 c-\gu-34 c4^\gu^3 c4-\gd-3 c4_\gd_3 c-\ggg #-15 -34 c4^\ggg #15 ^3 c4-\ggg #45 -3 c4_\ggg #-45 _3 } ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user