Re: subito PP

2022-07-17 Thread Xavier Scheuer
On Sun, 17 Jul 2022 at 10:12, Benjamin Tordoff  wrote:
>
> 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?
>

Hello,

You could adapt Graham's "make-dynamic-extra" into a  "make-extra-dynamic".
https://lists.gnu.org/archive/html/lilypond-user/2011-06/msg00335.html

IIRC the alignment was correct (dynamic part was aligned on note head ) and
it was correctly recognized for MIDI generation.
https://lists.gnu.org/archive/html/lilypond-user/2017-08/msg00381.html

Cheers,
Xavier

-- 
Xavier Scheuer 


Re: subito PP

2022-07-17 Thread David Kastrup
Jean Abou Samra  writes:

> Le 17/07/2022 à 19:14, Benjamin Tordoff a écrit :
>> 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.
>
>
> Well, I don't like documenting stuff that I would like to see improved
> in the first place. It would make a lot more sense to carry the volume
> in the event so you could implement a function used like
>
> subPP = \dynamic #0.5 \markup { sub. \dynamic pp }

Agreed.  Incidentally, my approach doesn't care just how the MIDI volume
is derived and would continue to work even after such a change of
implementation.

-- 
David Kastrup



Re: subito PP

2022-07-17 Thread Jean Abou Samra




Le 17/07/2022 à 19:14, Benjamin Tordoff a écrit :
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.



Well, I don't like documenting stuff that I would like to see improved 
in the first place. It would make a lot more sense to carry the volume 
in the event so you could implement a function used like


subPP = \dynamic #0.5 \markup { sub. \dynamic pp }

Jean




Re: subito PP

2022-07-17 Thread Benjamin Tordoff
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  wrote:
> 
> Jean Abou Samra mailto:j...@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\\< d'8 e'8 f'8 g'8 a'8 b'8 c''8 |
>c''8\f 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



Re: subito PP

2022-07-17 Thread David Kastrup
David Kastrup  writes:

> Jean Abou Samra  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\\< d'8 e'8 f'8 g'8 a'8 b'8 c''8 |
> c''8\f 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.

Actually it might make more sense to name this \subito rather than \subx
as you can perfectly well just write \subito \pp in the score without
defining an extra command for it.

-- 
David Kastrup



Re: subito PP

2022-07-17 Thread David Kastrup
Jean Abou Samra  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\\< d'8 e'8 f'8 g'8 a'8 b'8 c''8 |
c''8\f 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


Re: subito PP

2022-07-17 Thread Jean Abou Samra

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)))
  }
}

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


See also the snippet"Creating custom dynamics in MIDI output"
at

https://lilypond.org/doc/v2.22/Documentation/notation/controlling-midi-dynamics.html

Best,
Jean





Re: subito PP

2022-07-17 Thread Benjamin Tordoff
Thanks for the suggestion. Unless I'm doing something wrong this still seems to 
leave the volume unchanged (I put a normal \pp in the subsequent bar to check 
and playing the midi back in GarageBand I only hear the volume change on the 
\pp not the \subPP).

Any further suggestions? Is there a way to manually insert a volume change as a 
workaround (i.e. do an invisible \pp)?

Thanks

Ben

> On 17 Jul 2022, at 14:43, Eef Weenink  wrote:
> 
> try this; 
> 
> \version "2.23.10"
> 
> subPP =
> #(make-dynamic-script
>   (markup #:line
>   (#:normal-text
>#:italic "sub."
>#:dynamic "pp")))
> 
> \score {
>  {
>c'2-\ff c'2-\subPP % Volume should be pp but is still ff
>  }
>  \layout {}
>  \midi {}
> }
> 
> 
> 
> 
>> Op 17 jul. 2022, om 10:11 heeft Benjamin Tordoff > > het volgende geschreven:
>> 
>> \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 {}
>> }
> 



Re: subito PP

2022-07-17 Thread Eef Weenink
try this;

\version "2.23.10"

subPP =
#(make-dynamic-script
  (markup #:line
  (#:normal-text
   #:italic "sub."
   #:dynamic "pp")))

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




Op 17 jul. 2022, om 10:11 heeft Benjamin Tordoff 
mailto:ben.tord...@me.com>> het volgende geschreven:

\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 {}
}



subito PP

2022-07-17 Thread Benjamin Tordoff
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 {}
}

Thanks

Ben