Hello, all!
I'm trying to hack an easy way to end hairpins early... Here's what
I've got so far (a variation on the dynamic+text function Nicolas
helped me with):
%% CODE SNIPPET ENDS
\version "2.9.7"
dynNull =
#(define-music-function (parser location width event-chord)
(number? ly:music?)
;; add a null dynamic of desired width to the EventChord
(set! (ly:music-property event-chord 'elements)
(cons (make-music 'AbsoluteDynamicEvent
'text (markup #:hspace width))
(ly:music-property event-chord 'elements)))
;; return the chord with the right-aligned null dynamic attached
(make-music 'SequentialMusic
'elements
(list (make-music 'ContextSpeccedMusic
'property-operations '()
'context-type 'Bottom
'element (make-music 'OverrideProperty
'once #t
'grob-property-path (list 'self-alignment-X)
'grob-value 1
'symbol 'DynamicText
'pop-first #t))
event-chord)))
\relative c'
{
c\> c\! c\> \dynNull #2 c |
c c c c
}
%% CODE SNIPPET ENDS
So, as you can see, you put in the "width" of the blank dynamic you
want, and Lilypond attaches it (right-aligned) to the EventChord,
thus forcing the hairpin to end "early". [OK, it ain't pretty -- but
it's prettier than skipped notes in a separate Voice, or reduction
factors which screw up the MIDI values, etc., for the sake of a
visual adjustment.]
Although this works pretty well, the number isn't a percentage of the
"natural width" of the EventChord, but a hard-coded value (in staff
spaces) -- in other words, this value needs to be modified to adapt
to different layouts/spacing.
Is there any way to make such a function "intelligent" enough that
c\> \shortenHairpin #25 c
would shorten the Hairpin by 25% (of its "natural width") automatically?
Or is there a better way to do what I want, given the current state
of the Dynamics code?
Thanks,
Kieren.
_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel