Re: function to force accidentals on a subset of notes

2023-10-22 Thread Michael Winter via LilyPond user discussion
Thanks Lukas!

This works but also forces the accidental on tied notes.

Best,

Michael

Oct 22, 2023, 10:19 by l...@gmx.de:

>
> Hi Michael,
>
>
> this is easily accomplished with an custom engraver. (I perfectly  
> understand that the terms "easily" and "custom engraver" don't  seem to 
> go well together at first - I thought so for many years as  well -, but 
> after some getting used to it, the concept is actually  quite simple and 
> elegant.)
>
>
>
> \version "2.24.0"
>  
>  forced-accidentals-pitches =
>  #(music-pitches #{ bes b #})
>  
>  #(define (diatonic-pitch-class= p q)
>     (and (= (ly:pitch-notename p) (ly:pitch-notename q))
>      (= (ly:pitch-alteration p) (ly:pitch-alteration q
>  
>  Force_accidentals_engraver =
>  #(lambda (context)
>     (make-engraver
>      (listeners
>   ((note-event engraver event)
>    (if (member (ly:event-property event 'pitch)
>    forced-accidentals-pitches
>    diatonic-pitch-class=)
>    (ly:event-set-property! event 'force-accidental #t))
>  
>  \layout {
>    \context {
>      \Voice
>      \consists #Force_accidentals_engraver
>    }
>  }
>  
>  \transpose a c' \relative
>  {
>    a8 gis g fis g gis a4
>  }
>
>
>
> Lukas
>
> Am 21.10.23 um 11:37 schrieb Michael  Winter via LilyPond user discussion:
>
>> Thanks Jean,
>>
>> I am not sure I completely follow.
>>
>> Lets say I have a music sequence:
>>
>> a b c d e f g a bes c d e f g ...
>>
>> How do I apply what you have written as a functionto only show the 
>> flats and naturals for b and bes. Again. I donot want to apply this 
>> to individual notes.
>>
>> Sorry if I am missing something.
>>
>> Best,
>>
>> Michael
>>
>>
>> Oct 21, 2023, 01:37 by >> j...@abou-samra.fr>> :
>>
>>>
>>> Try
>>>
>>> \displayMusic c'!
>>>
>>> This shows you that the >>> !>>>  syntax corresponds to  setting
>>>   the >>> force-accidental>>>  property to true. Thus, if  you 
>>> have  identified the note events you want to force accidentals  
>>> on, you can do
>>>
>>> (ly:music-set-property! the-note-event 'force-accidental #t)
>>>
>>> on each of them.
>>>
>>>
>>> Best,
>>>
>>>
>>> Jean
>>>
>>>
>>
>>



Re: Y-offset of dynamic text after break

2023-10-22 Thread Jean Abou Samra
Le dimanche 22 octobre 2023 à 13:48 -0700, Knute Snortum a écrit :
> Is it true then that using extra-offset in these situations are the only way
> to move the dynamic text?

No, because there are still limits on how close vertical axis groups can get
even without considering their outlines. Try \tweak Y-offset -6 instead of
\tweak Y-offset -2, you will see that a larger value does have an effect.


signature.asc
Description: This is a digitally signed message part


Re: Y-offset of dynamic text after break

2023-10-22 Thread Knute Snortum
Thanks for the explanation. Is it true then that using extra-offset in
these situations are the only way to move the dynamic text?

--
Knute Snortum



On Sun, Oct 22, 2023 at 12:30 PM Jean Abou Samra  wrote:

> Hi,
>
> The DynamicText's Y-offset controls its position relative to its baseline,
> which is the VerticalAxisGroup of the Dynamics context. Without \break,
> the VerticalAxisGroup contains two dynamics, "f" and "p", with "p" offset
> compared to "f", which forces them to be at different positions. With
> \break, the "p" is alone in its VerticalAxisGroup. It is properly offset
> compared to that baseline, but then the baseline itself has to be spaced
> within the rest, and this spacing cancels the effect of your tweak.
>
> HTH
> Jean
>


Re: Y-offset of dynamic text after break

2023-10-22 Thread Jean Abou Samra
Hi,

The DynamicText's Y-offset controls its position relative to its baseline, 
which is the VerticalAxisGroup of the Dynamics context. Without `\break`, the 
VerticalAxisGroup contains two dynamics, "f" and "p", with "p" offset compared 
to "f", which forces them to be at different positions. With `\break`, the "p" 
is alone in its VerticalAxisGroup. It is properly offset compared to that 
baseline, but then the baseline itself has to be spaced within the rest, and 
this spacing cancels the effect of your tweak.

HTH  
Jean




signature.asc
Description: This is a digitally signed message part


displaying `script-priority`

2023-10-22 Thread Werner LEMBERG

How can I make LilyPond display the actual values of `script-priority`
for a stack of grobs?  Let's assume I have

```
{
  \set strokeFingerOrientations = #'(up)
  \set fingeringOrientations = #'(up)

  
}
```

and I want to position the fingerings for the upper note above the
fingerings of the lower note.  Since the actual `script-priority`
value of a grob depends on both the vertical position of the grob and
its pre-defined `script-priority` value (in `define-grobs.scm` and
`script.scm`), it's not fun to manually test possible values for each
and every chord...

To continue the above example, the default `script-priority` values
for `Fingering` grobs (i.e., left-hand fingering) is 100, and for
`StrokeFinger` grobs (i.e., right-hand fingering) it is 125, and to
get the desired effect I have to say

```
{
  \override Fingering.script-priority = #118
  
}
```

Any value between 118 and 125 (inclusive) will do.

Or maybe there is a more efficient, less error-prone method to handle
such situations?


Werner


Re: Parentheses : optional anacrouse and chords at the end of a score

2023-10-22 Thread Guy Stalnaker

This should get you what you want:

%%%
\version "2.24.0"

startParenthesis = {
  \once \override Parentheses.stencils = #(lambda (grob)
 (let ((par-list 
(parentheses-interface::calc-parenthesis-stencils grob)))

 (list (car par-list) point-stencil )))
}

endParenthesis = {
  \once \override Parentheses.stencils = #(lambda (grob)
    (let ((par-list 
(parentheses-interface::calc-parenthesis-stencils grob)))

    (list point-stencil (cadr par-list
}

% Example:
% {
%  \override Parentheses.font-size = #5
%  \startParenthesis 
%  d' e' f'
%  \endParenthesis \parenthesize g'
% }
%%%

On 10/22/23 10:00, Guy Melançon wrote:

I understand the \parenthesize command applies to a single note.

I would like the parentheses to wrap more tan just one note. Something 
like \parenthesize {c4 d e f} to have a parentheses right before c and 
after f. This would be useful writing a jazz score to include an 
optional anacrouse in the last measure.


I would also be interested in doing the same thing with the chords 
written above the staff.


Any ideas, anyone?

Thanks


--
--

“Happiness is the meaning and the purpose of life, the whole aim and end of 
human existence.”

― Aristotle


Re: Parentheses : optional anacrouse and chords at the end of a score

2023-10-22 Thread Jean Abou Samra
Have a look at https://lsr.di.unimi.it/LSR/Item?id=902 


signature.asc
Description: This is a digitally signed message part


Parentheses : optional anacrouse and chords at the end of a score

2023-10-22 Thread Guy Melançon
I understand the \parenthesize command applies to a single note.

I would like the parentheses to wrap more tan just one note. Something like
\parenthesize {c4 d e f} to have a parentheses right before c and after f.
This would be useful writing a jazz score to include an optional anacrouse
in the last measure.

I would also be interested in doing the same thing with the chords written
above the staff.

Any ideas, anyone?

Thanks


Re: function to force accidentals on a subset of notes

2023-10-22 Thread Lukas-Fabian Moser

Hi Michael,

this is easily accomplished with an custom engraver. (I perfectly 
understand that the terms "easily" and "custom engraver" don't seem to 
go well together at first - I thought so for many years as well -, but 
after some getting used to it, the concept is actually quite simple and 
elegant.)


\version "2.24.0"

forced-accidentals-pitches =
#(music-pitches #{ bes b #})

#(define (diatonic-pitch-class= p q)
   (and (= (ly:pitch-notename p) (ly:pitch-notename q))
    (= (ly:pitch-alteration p) (ly:pitch-alteration q

Force_accidentals_engraver =
#(lambda (context)
   (make-engraver
    (listeners
 ((note-event engraver event)
  (if (member (ly:event-property event 'pitch)
  forced-accidentals-pitches
  diatonic-pitch-class=)
  (ly:event-set-property! event 'force-accidental #t))

\layout {
  \context {
    \Voice
    \consists #Force_accidentals_engraver
  }
}

\transpose a c' \relative
{
  a8 gis g fis g gis a4
}

Lukas

Am 21.10.23 um 11:37 schrieb Michael Winter via LilyPond user discussion:

Thanks Jean,

I am not sure I completely follow.

Lets say I have a music sequence:

a b c d e f g a bes c d e f g ...

How do I apply what you have written as a function to only show the 
flats and naturals for b and bes. Again. I do not want to apply this 
to individual notes.


Sorry if I am missing something.

Best,

Michael


Oct 21, 2023, 01:37 by j...@abou-samra.fr:

Try

|\displayMusic c'! |

This shows you that the |!| syntax corresponds to setting the
|force-accidental| property to true. Thus, if you have identified
the note events you want to force accidentals on, you can do

|(ly:music-set-property! the-note-event 'force-accidental #t) |

on each of them.

Best,

Jean