|
From: | Aaron Hill |
Subject: | Re: Making espressivo longer |
Date: | Tue, 22 Jan 2019 19:07:43 -0800 |
User-agent: | Roundcube Webmail/1.3.8 |
On 2019-01-22 5:30 pm, Andrew Bernard wrote:
Hi Ben, Yes this is the code in the list archives that I was referring to in myinitial mail. My question was actually not so much how to achieve this, butwhether a technique for this has been incorporated into lilypond morerecently, similar to how hairpins can now be adjusted with the shorten-pairtechnique common to other objects.The problem I have with this code is that, finding that it works, I alteredit to allow scaling in the vertical axis as well, but that is highlyunsatisfactory as the line width gets scaled as well - perhaps why the codeomitted that feature to begin with.Espressivo marks are just hairpin-like objects, and I suppose I can justrevert to using hairpins, but it's a bit annoying as you have to make aseparate voice for the hairpins to start and finish on non-existent notes.
Would the following help you? %%%% \version "2.19.82" #(define (assoc-list? arg) (and (list? arg) (every pair? arg))) espressivoII = #(define-event-function (args) (assoc-list?) (define (make-espressivo-stencil thick width height gap) (let* ((inner (/ gap 2)) (outer (+ width inner)) (middle (/ height 2))) (ly:stencil-add (make-line-stencil thick (- inner) 0 (- outer) middle) (make-line-stencil thick (- outer) middle (- inner) height) (make-line-stencil thick inner 0 outer middle) (make-line-stencil thick outer middle inner height)))) (let ((thick (ly:assoc-get 'thick args 0.12)) (width (ly:assoc-get 'width args 1.7)) (height (ly:assoc-get 'height args 0.9)) (gap (ly:assoc-get 'gap args 0.35))) #{ \tweak stencil #(lambda (grob) (make-espressivo-stencil thick width height gap)) \espressivo #})) { b'4 \espressivo b'4 \espressivoII #'() b'4 \espressivoII #'((width . 3.4)) b'4 \espressivoII #'((thick . 0.24)(gap . 0.7)) } %%%%I followed the pattern of \shape and \shapeII for the naming, but I opted for an association list for the arguments. It is more verbose, but it makes it easy to support default values for those that are not specified.
The MetaFont code for the 'scripts.espr' glyph was a little tedious to reverse engineer. So, I tried my best to match the original glyph with the default values provided. I am sure there could be some improvements.
NOTE: I could not find a predicate for an association list, so I provided one here. If I overlooked something that already exists, then we should swap out the predicate for that one.
-- Aaron Hill
espressivo.cropped.png
Description: PNG image
[Prev in Thread] | Current Thread | [Next in Thread] |