lilypond-user
[Top][All Lists]
Advanced

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

Re: subito PP


From: Benjamin Tordoff
Subject: Re: subito PP
Date: Sun, 17 Jul 2022 18:14:42 +0100

Thanks David & Jean, both approaches work well and look good. The original indications were left aligned to the note so the alignment adjustment isn't needed in this case. I have no idea if one of these is technically superior to the other, although I suspect the fact I need both sub.P and sub.PP means less code with David's approach.

I wonder if this could be added to the snippet examples about defining new dynamics? I don't think I would have stood any chance of finding either solution without your help, and I suspect I'm not the only one who might need this.

Thanks

Ben

On 17 Jul 2022, at 18:06, David Kastrup <dak@gnu.org> wrote:

Jean Abou Samra <jean@abou-samra.fr> writes:

Le 17/07/2022 à 10:11, Benjamin Tordoff a écrit :
Hi all,

I'm typesetting a score that uses "subito p" and "subito pp" in a couple of places. I've found snippets explaining how to get this to look right (subito in normal italics, the "p" or "pp" in dynamic font), and another snippet showing how to create a custom dynamic that correctly sets the midi volume, but not one that does both. What is the best way to add a text prefix to a dynamic whilst also retaining the dynamic's effect on MIDI output?

\version "2.23.10"
subPP = \markup{ \italic{sub.} \dynamic pp }

\score {
  {
    c'2-\ff c'2-\subPP % Volume should be pp but is still ff
  }
  \layout {}
  \midi {}
}


How about something like this:

\version "2.22.2"

subPPMarkup = \markup { \normal-text \italic { sub. } pp }
subPP = #(make-dynamic-script subPPMarkup)

\midi {
  \context {
    \Score
    dynamicAbsoluteVolumeFunction =
      #(lambda (dyn)
         (if (equal? dyn subPPMarkup)
             0.3
             (default-dynamic-absolute-volume dyn)))
  }
}

It may be more convenient to just tamper with the visuals of a command,
like

\version "2.22.2"

subx = #(define-event-function (fun) (ly:event?)
 #{ -\tweak stencil #(lambda (g)
       (grob-interpret-markup g
#{ \markup \concat { \with-dimensions #'(0 . 0) #'(0 . 0)
                                                    \right-align
     \normal-text \italic "sub. "
     #(ly:grob-property g 'text) }
#}))
    #fun #})

subPP = \subx \pp

\score {
 {
   c'8\pppp\< d'8 e'8 f'8 g'8 a'8 b'8 c''8 |
   c''8\fffff b'8 a'8 g'8 f'8\subPP e'8 d'8 c'8 }
 \layout { }
 \midi { }
}

Note that I put in some effort to stop "sub." from changing the
alignment.  If that's undesired, removing

   \with-dimension #'(0 . 0) #'(0 . 0)

should do the trick.

-- 
David Kastrup


reply via email to

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