lilypond-user
[Top][All Lists]
Advanced

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

Re: subito PP


From: David Kastrup
Subject: Re: subito PP
Date: Sun, 17 Jul 2022 19:06:22 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

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]