Re: Multiple instances of same articulation/bowing on one note

2023-02-01 Thread David Kastrup
Valentin Petzel  writes:

> Hello David,
>
> the commit that introduced this was
>
> https://gitlab.com/lilypond/lilypond/-/commit/b480b873c8cc686765c1f188be696636c2018adc[1]
>
> Now, I did not use Lilypond in 2004 so I cannot say for sure,
> but I think this should have worked before that commit.

It seems like a bit of a stretch to still call it a "regression" after
19 years of its existence.

-- 
David Kastrup



Re: Multiple instances of same articulation/bowing on one note

2023-02-01 Thread Valentin Petzel
Hello David,

the commit that introduced this was

https://gitlab.com/lilypond/lilypond/-/commit/b480b873c8cc686765c1f188be696636c2018adc[1]

Now, I did not use Lilypond in 2004 so I cannot say for sure,
but I think this should have worked before that commit.
But I suppose we could try it we somehow manage to get
Lilypond 2.0 to run.

Valentin

Am Mittwoch, 1. Februar 2023, 14:45:41 CET schrieb David Kastrup:
> Valentin Petzel  writes:
> >> Am Mittwoch, 1. Februar 2023, 13:21:49 CET schrieb:
> >>> Ahanu Banerjee  writes:
> >>> > I suppose there are different definitions for what a "bug" is. I said
> >>> > it was not one because it is obviously intended behavior
> >>> 
> >>> More like an unintended side effect of implementing obviously intended
> >>> behavior.
> > 
> > I’d say this is pretty much what we call a regression ...
> 
> To be a regression, it has to have worked at some point of time.
> 
> Did it?




[1] 
https://gitlab.com/lilypond/lilypond/-/commit/b480b873c8cc686765c1f188be696636c2018adc


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


Re: Multiple instances of same articulation/bowing on one note

2023-02-01 Thread David Kastrup
Valentin Petzel  writes:

>> Am Mittwoch, 1. Februar 2023, 13:21:49 CET schrieb:
>>> Ahanu Banerjee  writes:
>>> > I suppose there are different definitions for what a "bug" is. I said
>>> > it was not one because it is obviously intended behavior
>>> 
>>> More like an unintended side effect of implementing obviously intended
>>> behavior.
>
>
> I’d say this is pretty much what we call a regression ...

To be a regression, it has to have worked at some point of time.

Did it?

-- 
David Kastrup



Re: Multiple instances of same articulation/bowing on one note

2023-02-01 Thread Valentin Petzel
I’d say this is pretty much what we call a regression ...

Am Mittwoch, 1. Februar 2023, 13:21:49 CET schrieb David Kastrup:
> Ahanu Banerjee  writes:
> > I suppose there are different definitions for what a "bug" is. I said
> > it was not one because it is obviously intended behavior
> 
> More like an unintended side effect of implementing obviously intended
> behavior.



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


Re: Multiple instances of same articulation/bowing on one note

2023-02-01 Thread David Kastrup
Ahanu Banerjee  writes:

> I suppose there are different definitions for what a "bug" is. I said
> it was not one because it is obviously intended behavior

More like an unintended side effect of implementing obviously intended
behavior.

-- 
David Kastrup



Re: Multiple instances of same articulation/bowing on one note

2023-02-01 Thread Valentin Petzel
Hello Ahanu,

the cleanest way would be if this was fixed in code, but else instead of your 
<< ... >> constructs it suffices to do

\version "2.24.0"
\language "english"
{ 
  g8 \new Voice <>^\upbow g_\upbow g g
}

In fact we can use a little music function to get this done really 
beautifully:

sep =
#(define-music-function (m) (ly:music?)
   #{
 \new Voice <>-$m
   #})

\version "2.24.0"
\language "english"
{
  g8 \sep^\upbow g_\upbow g g
}

But this way of doing this has a little drawback: Positioning will not avoid 
collision with other notes. This can be solved by using an engraver to 
equalise side support elements between such grobs, as shown in the appended 
file.

Cheers,
Valentin

Am Mittwoch, 1. Februar 2023, 03:21:42 CET schrieb Ahanu Banerjee:
> I'm trying to put the same articulation both above and below one note. (My
> document has one set of bowings above the staff and an alternate set below
> the staff, and occasionally they both need the same marking.)
> 
> The workaround I currently have is creating a second voice, which is a bit
> of a pain. Are there better solutions? Code below.
> 
> \version "2.24.0"
> \language "english"
> { g8 g_\upbow ^\upbow g g % fails
>   g8 g_\upbow ^\downbow g g % works
>   % desired output:
>   << { g8 g_\upbow g g } \\ { s s ^\upbow } >> }
> 
> Thanks,
> -Ahanu

#(define (equalise-articulations-engraver context)
   (let ((scripts '()))
  (make-engraver
   (acknowledgers
((script-interface eng grob source-eng)
 (let* ((cause (ly:grob-property grob 'cause))
(type (ly:event-property cause 'articulation-type))
(prev (assoc-get type scripts '(
   (set! scripts (assoc-set! scripts type (cons grob prev
 ))
   ((process-acknowledged engraver)
(for-each
 (lambda (x)
   (let* ((grobs (cdr x))
  (side-supports (map (lambda (grob) (ly:grob-object grob 'side-support-elements)) grobs))
  (side-supports (filter ly:grob-array? side-supports))
  (side-supports (map ly:grob-array->list side-supports))
  (side-supports (apply append side-supports))
  (side-supports (ly:grob-list->grob-array side-supports)))
 (for-each
  (lambda (y) (ly:grob-set-object! y 'side-support-elements side-supports))
  grobs)))
 scripts)
(set! scripts '())

sep =
#(define-music-function (m) (ly:music?)
   #{
 \new Voice <>-$m
   #})

mus = {
  g8 \sep^\upbow g_\upbow g g
  g8 \sep_\upbow g^\upbow g g
}

\version "2.24.0"
\language "english"

\new Staff \mus
\new Staff \with { \consists #equalise-articulations-engraver } \mus

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


Re: Multiple instances of same articulation/bowing on one note

2023-01-31 Thread Michael Werner
On Tue, Jan 31, 2023 at 9:49 PM Ahanu Banerjee 
wrote:

> That's certainly an interesting approach. Reminds me of the old SCORE
> system. But unless I misunderstood your suggestion, it becomes rather
> inconvenient and inefficient for larger scores, particularly if changes
> have to be made to the notes later down the line, i.e., having to modify
> multiple sets of music just to change a few notes..
>

A fair point. I'm basically just a copyist, I guess would be the term. I'm
not a musician - I just produce cleaned up and sometimes somewhat altered
sheet music for others based on already existing sources.. So generally the
changes have already been sorted out by the time I get my hands on it. Also
the pieces I'm working with tend to be relatively short (more than 3 or 4
pages is uncommon), so if more changes are needed it's generally not too
much of a hassle.


Re: Multiple instances of same articulation/bowing on one note

2023-01-31 Thread Michael Werner
On Tue, Jan 31, 2023 at 9:41 PM Michael Werner  wrote:

> ...
> \version "2.24.0"
> \language "english"
>
> music = { g8 g g g }
> upArticulation = { g8 g-\upbow g g }
> downArticulation = { g8 g-\upbow g g }
>
> <<
> \new Dynamics
> \upArticulation
> \new Staff
> \music
> \new Dynamics
> \downArticulation
> >>
>

I goofed in my code. It doesn't make any allowance for articulations that
change direction depending on whether they're above or below the staff
(fermata, for example). So a bit of a change is in order:

 \version "2.24.0"
\language "english"

music = { g8 g g g }
upArticulation = { g8 g-\upbow g-\fermata g }
downArticulation = { g8 g-\upbow g-\fermata g }

<<
\new Dynamics \with {
  \override Script.direction = #UP }
{ \upArticulation }
\new Staff
\music
\new Dynamics \with {
  \override Script.direction = #DOWN }
{ \downArticulation }
>>

An alternative would be to explicitly declare the direction by changing:

upArticulation = { g8 g-\upbow g-\fermata g }
downArticulation = { g8 g-\upbow g-\fermata g }

to:

upArticulation = { g8 g^\upbow g^\fermata g }
downArticulation = { g8 g_\upbow g_\fermata g }


Re: Multiple instances of same articulation/bowing on one note

2023-01-31 Thread Ahanu Banerjee
I suppose there are different definitions for what a "bug" is. I said it
was not one because it is obviously intended behavior—I figured my use case
is a bit unusual so was not surprised by this. But if it can be treated as
a bug and additional functionality can be added in a future version, that
would be great!

Jean, thanks for the workaround. I could certainly not have come up with
that myself. I'll give it a try tomorrow.

-Ahanu

On Tue, Jan 31, 2023, 22:07 Jean Abou Samra  wrote:

> On 01/02/2023 03:51, Ahanu Banerjee wrote:
> > It's obviously not a bug. Jean, thanks for pointing out where the
> relevant instruction is.
> >
> > What would be the easiest way to modify this behavior for a single
> score?
>
>
> It's a bit of a weird thing to do, but you could consider
>
> \version "2.24.0"
>
> allowMultipleArticulations =
> #(define-music-function (mus) (ly:music?)
>(let ((syms '()))
>  (for-each
>   (lambda (art)
> (let* ((sym (ly:music-property art 'articulation-type))
>(fresh (make-symbol "unique-articulation")))
>   (set! syms (acons fresh sym syms))
>   (ly:music-set-property! art 'articulation-type fresh)))
>   (extract-typed-music mus 'articulation-event))
>  #{
>\context Bottom \applyContext
>  #(lambda (context)
> (let* ((defs (ly:context-property context 'scriptDefinitions))
>(defs-hash ((@ (ice-9 hash-table) alist->hashq-table)
>defs))
>(new-defs (append (map (lambda (p)
> (cons (car p)
>   (hashq-ref defs-hash
> (cdr p
>   syms)
>  defs)))
>   (ly:context-set-property! context 'scriptDefinitions
> new-defs)))
>#mus
>  #}))
>
> \language "english"
>
> \allowMultipleArticulations
> { g8 g_\upbow ^\upbow g g % fails
>   g8 g_\upbow ^\downbow g g % works
> }
>
>
>
> If you have several voices, you must apply the function to each of them
> separately.
>
> Jean
>
>
>


Re: Multiple instances of same articulation/bowing on one note

2023-01-31 Thread Jean Abou Samra
On 01/02/2023 03:51, Ahanu Banerjee wrote:
> It's obviously not a bug. Jean, thanks for pointing out where the relevant 
> instruction is.
> 
> What would be the easiest way to modify this behavior for a single score? 


It's a bit of a weird thing to do, but you could consider

\version "2.24.0"

allowMultipleArticulations =
#(define-music-function (mus) (ly:music?)
   (let ((syms '()))
 (for-each
  (lambda (art)
(let* ((sym (ly:music-property art 'articulation-type))
   (fresh (make-symbol "unique-articulation")))
  (set! syms (acons fresh sym syms))
  (ly:music-set-property! art 'articulation-type fresh)))
  (extract-typed-music mus 'articulation-event))
 #{
   \context Bottom \applyContext
 #(lambda (context)
(let* ((defs (ly:context-property context 'scriptDefinitions))
   (defs-hash ((@ (ice-9 hash-table) alist->hashq-table)
   defs))
   (new-defs (append (map (lambda (p)
(cons (car p)
  (hashq-ref defs-hash (cdr 
p
  syms)
 defs)))
  (ly:context-set-property! context 'scriptDefinitions new-defs)))
   #mus
 #}))

\language "english"

\allowMultipleArticulations
{ g8 g_\upbow ^\upbow g g % fails
  g8 g_\upbow ^\downbow g g % works
}



If you have several voices, you must apply the function to each of them
separately.

Jean




OpenPGP_signature
Description: OpenPGP digital signature


Re: Multiple instances of same articulation/bowing on one note

2023-01-31 Thread Jean Abou Samra
On 01/02/2023 03:59, kie...@kierenmacmillan.info wrote:
> Hi all,
> 
>> I would personally consider that a bug!
>> script-engraver.cc:
>>
>> void
>> Script_engraver::listen_articulation (Stream_event *ev)
>> {
>>   /* Discard double articulations for part-combining.  */
>>   for (vsize i = 0; i < scripts_.size (); i++)
>>     if (scm_is_eq (get_property (scripts_[i].event_, "articulation-type"),
>>                    get_property (ev, "articulation-type")))
>>       return;
>>
>>
>> Umm...
>  
> The fact that it's coded doesn’t make it not a bug… ;)
>  
> Should this be stripped down to a single markup without warning?
>  
> { g_\markup "umm…" ^\markup "umm…" }
>  
> If the user intentionally doubles anything — be it articulation, markup, 
> dynamic, or whatever — I consider it a bug it it’s stripped from the output. 
> 


Sorry, I was too oblique: I didn't mean to say it wasn't a bug.
Just that it's not a matter of simply removing that behavior,
because there is a reason for it in the first place.



OpenPGP_signature
Description: OpenPGP digital signature


Re: Multiple instances of same articulation/bowing on one note

2023-01-31 Thread kieren



Hi all,


I would personally consider that a bug!
script-engraver.cc:

void
Script_engraver::listen_articulation (Stream_event *ev)
{
/* Discard double articulations for part-combining.  */
for (vsize i = 0; i < scripts_.size (); i++)
if (scm_is_eq (get_property (scripts_[i].event_, "articulation-type"),
get_property (ev, "articulation-type")))
return;

Umm...


The fact that it's coded doesn't make it not a bug… ;)

Should this be stripped down to a single markup without warning?

{ g_\markup "umm…" ^\markup "umm…" }

If the user intentionally doubles anything -- be it articulation, 
markup, dynamic, or whatever -- I consider it a bug it it's stripped 
from the output. 


Kieren.

Re: Multiple instances of same articulation/bowing on one note

2023-01-31 Thread Ahanu Banerjee
It's obviously not a bug. Jean, thanks for pointing out where the relevant
instruction is.

What would be the easiest way to modify this behavior for a single score?

Thanks,
-Ahanu

On Tue, Jan 31, 2023, 21:37 Jean Abou Samra  wrote:

> On 01/02/2023 03:34, kie...@kierenmacmillan.info wrote:
> > Hi Ahanu,
> >
> >> g_\upbow ^\upbow g g % fails
> >
> > I would personally consider that a bug!
>
> script-engraver.cc:
>
> void
> Script_engraver::listen_articulation (Stream_event *ev)
> {
>   /* Discard double articulations for part-combining.  */
>   for (vsize i = 0; i < scripts_.size (); i++)
> if (scm_is_eq (get_property (scripts_[i].event_, "articulation-type"),
>get_property (ev, "articulation-type")))
>   return;
>
>
> Umm...
>
>
>


Re: Multiple instances of same articulation/bowing on one note

2023-01-31 Thread Ahanu Banerjee
That's certainly an interesting approach. Reminds me of the old SCORE
system. But unless I misunderstood your suggestion, it becomes rather
inconvenient and inefficient for larger scores, particularly if changes
have to be made to the notes later down the line, i.e., having to modify
multiple sets of music just to change a few notes..

On Tue, Jan 31, 2023, 21:42 Michael Werner  wrote:

> Hi Ahanu,
>
> I would split things out into some variables, and put the articulations
> into separate contexts. I find it makes things much easier to keep track
> of. For example:
>
> \version "2.24.0"
> \language "english"
>
> music = { g8 g g g }
> upArticulation = { g8 g-\upbow g g }
> downArticulation = { g8 g-\upbow g g }
>
> <<
> \new Dynamics
> \upArticulation
> \new Staff
> \music
> \new Dynamics
> \downArticulation
> >>
>
> In a Dynamics context the entered music gives the durations, but the note
> heads aren't printed. So once the music is entered and checked, it can just
> be pasted into a new variable and the articulations added as needed.
>
> On Tue, Jan 31, 2023 at 9:22 PM Ahanu Banerjee 
> wrote:
>
>> I'm trying to put the same articulation both above and below one note.
>> (My document has one set of bowings above the staff and an alternate set
>> below the staff, and occasionally they both need the same marking.)
>>
>> The workaround I currently have is creating a second voice, which is a
>> bit of a pain. Are there better solutions? Code below.
>>
>> \version "2.24.0"
>> \language "english"
>> { g8 g_\upbow ^\upbow g g % fails
>>   g8 g_\upbow ^\downbow g g % works
>>   % desired output:
>>   << { g8 g_\upbow g g } \\ { s s ^\upbow } >> }
>>
>> Thanks,
>> -Ahanu
>>
>


Re: Multiple instances of same articulation/bowing on one note

2023-01-31 Thread Michael Werner
Hi Ahanu,

I would split things out into some variables, and put the articulations
into separate contexts. I find it makes things much easier to keep track
of. For example:

\version "2.24.0"
\language "english"

music = { g8 g g g }
upArticulation = { g8 g-\upbow g g }
downArticulation = { g8 g-\upbow g g }

<<
\new Dynamics
\upArticulation
\new Staff
\music
\new Dynamics
\downArticulation
>>

In a Dynamics context the entered music gives the durations, but the note
heads aren't printed. So once the music is entered and checked, it can just
be pasted into a new variable and the articulations added as needed.

On Tue, Jan 31, 2023 at 9:22 PM Ahanu Banerjee 
wrote:

> I'm trying to put the same articulation both above and below one note. (My
> document has one set of bowings above the staff and an alternate set below
> the staff, and occasionally they both need the same marking.)
>
> The workaround I currently have is creating a second voice, which is a bit
> of a pain. Are there better solutions? Code below.
>
> \version "2.24.0"
> \language "english"
> { g8 g_\upbow ^\upbow g g % fails
>   g8 g_\upbow ^\downbow g g % works
>   % desired output:
>   << { g8 g_\upbow g g } \\ { s s ^\upbow } >> }
>
> Thanks,
> -Ahanu
>


Re: Multiple instances of same articulation/bowing on one note

2023-01-31 Thread H. S. Teoh
On Wed, Feb 01, 2023 at 03:37:47AM +0100, Jean Abou Samra wrote:
> On 01/02/2023 03:34, kie...@kierenmacmillan.info wrote:
> > Hi Ahanu,
> > 
> >> g_\upbow ^\upbow g g % fails
> >  
> > I would personally consider that a bug!
> 
> script-engraver.cc:
> 
> void
> Script_engraver::listen_articulation (Stream_event *ev)
> {
>   /* Discard double articulations for part-combining.  */
>   for (vsize i = 0; i < scripts_.size (); i++)
> if (scm_is_eq (get_property (scripts_[i].event_, "articulation-type"),
>get_property (ev, "articulation-type")))
>   return;
[...]

Hmm. Shouldn't this be done only in the case of part combining? I.e.,
only when \partCombineXxx is being used.  But I'm not sure how practical
it is to implement this, though, if part combining is done very early in
the process and relies on later stages to de-duplicate articulations.

Maybe somehow attach an internal mark to notes that result from part
combining, so that the above code can be conditioned on this mark?


T

-- 
Ignorance is bliss... until you suffer the consequences!



Re: Multiple instances of same articulation/bowing on one note

2023-01-31 Thread Jean Abou Samra
On 01/02/2023 03:34, kie...@kierenmacmillan.info wrote:
> Hi Ahanu,
> 
>> g_\upbow ^\upbow g g % fails
>  
> I would personally consider that a bug!

script-engraver.cc:

void
Script_engraver::listen_articulation (Stream_event *ev)
{
  /* Discard double articulations for part-combining.  */
  for (vsize i = 0; i < scripts_.size (); i++)
if (scm_is_eq (get_property (scripts_[i].event_, "articulation-type"),
   get_property (ev, "articulation-type")))
  return;


Umm...




OpenPGP_signature
Description: OpenPGP digital signature


Re: Multiple instances of same articulation/bowing on one note

2023-01-31 Thread kieren



Hi Ahanu,


g_\upbow ^\upbow g g % fails


I would personally consider that a bug!

As for a "solution",  what about this?

<< g_\upbow \\ <>^\upbow >>

Not *that* much better than your hack… but maybe a little better?

Kieren.

Multiple instances of same articulation/bowing on one note

2023-01-31 Thread Ahanu Banerjee
I'm trying to put the same articulation both above and below one note. (My
document has one set of bowings above the staff and an alternate set below
the staff, and occasionally they both need the same marking.)

The workaround I currently have is creating a second voice, which is a bit
of a pain. Are there better solutions? Code below.

\version "2.24.0"
\language "english"
{ g8 g_\upbow ^\upbow g g % fails
  g8 g_\upbow ^\downbow g g % works
  % desired output:
  << { g8 g_\upbow g g } \\ { s s ^\upbow } >> }

Thanks,
-Ahanu