lilypond-user
[Top][All Lists]
Advanced

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

Re: automatically left-aligning custom dynamics


From: David Nalesnik
Subject: Re: automatically left-aligning custom dynamics
Date: Thu, 6 Sep 2012 18:48:49 -0500

Hi James,

On Thu, Sep 6, 2012 at 5:00 PM, james <address@hidden> wrote:
> I don't really understand it, but I can modify the examples of how to create 
> custom dynamics to get what I want.
> I have a document with several examples like:
> rinforzamf = #(
>    make-dynamic-script (
>       markup #:line (
>       #:left-align
>       #:normal-text
>       #:whiteout
>       #:italic "rinforza"
>       #:hspace 0
>       #:whiteout
>       #:dynamic "mf"
>       )
>   )
> )
> And a macro that left-aligns it:
> leftalign = { \once \override Dynamics.DynamicText #'self-alignment-X = #-1 }
>
> Heretofore, I've just been manually adding the \leftalign before the 
> \rinforzamf (for example). Is there a way to get both of these in one command?
>

With the following definitions, you can get what you want with a
single command.  Also, you can define other such combinations.

(BTW, I commented out two lines in the markup definition which I don't
think are needed.)

HTH,
David

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\version "2.17.1"

#(define (rinforza text)
  (let* ((text
        (markup
          #:line (
            ;#:left-align
            #:normal-text
            #:whiteout
            #:italic "rinforza"
            ;#:hspace 0
            #:whiteout
            #:dynamic text)))
        (my-dyn (make-music 'AbsoluteDynamicEvent
                            'text text)))
  (set! (ly:music-property my-dyn 'tweaks)
          (acons 'self-alignment-X -1
                     (ly:music-property my-dyn 'tweaks)))
 my-dyn))

rinforzamf = #(rinforza "mf")
rinforzap = #(rinforza "p")

\score {
  \new Staff <<
  { c'1 d' c' d' }
  \new Dynamics {
    s1*2\rinforzamf
    s1*2\rinforzap
  }
  >>
}



reply via email to

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