lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: shortened Hairpin hack; how to get "width" of current ChordEvent?


From: Anthony Youngman
Subject: RE: shortened Hairpin hack; how to get "width" of current ChordEvent?
Date: Tue, 6 Jun 2006 10:16:14 +0100

What I did (I'm now switching to the "hidden note" that Han Wen
suggested for gliss's, and am going to play with s notes for
(de)crescendi, because I don't need midi or anything like that) was

<<
        {g1}
        {s2\> s4\! s}
>>

I agree it's still a bit messy, but there's a good chance my suggestion
either does exactly what you want, or can be tweaked until it does.

Cheers,
Wol

-----Original Message-----
From:
address@hidden
[mailto:address@hidden
u.org] On Behalf Of Kieren MacMillan
Sent: 05 June 2006 23:14
To: address@hidden
Subject: shortened Hairpin hack; how to get "width" of current
ChordEvent?

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
address@hidden
http://lists.gnu.org/mailman/listinfo/lilypond-devel

* ************************************************************************ *

This transmission is intended for the named recipient only. It may contain 
private and confidential information. If this has come to you in error you must 
not act on anything disclosed in it, nor must you copy it, modify it, 
disseminate it in any way, or show it to anyone. Please e-mail the sender to 
inform us of the transmission error or telephone ECA International immediately 
and delete the e-mail from your information system.

Telephone numbers for ECA International offices are: Sydney +61 (0)2 8272 5300, 
Hong Kong + 852 2121 2388, London +44 (0)20 7351 5000 and New York +1 212 582 
2333.

* ************************************************************************ *




reply via email to

[Prev in Thread] Current Thread [Next in Thread]