Re: Should \partial accept music instead of duration?

2022-03-19 Thread Aaron Hill

On 2022-03-19 5:46 pm, Thomas Morley wrote:

Am So., 20. März 2022 um 00:02 Uhr schrieb Aaron Hill
:


Here would be a possible refactoring:


\version "2.22.0"

partial =
#(define-music-function (mus) (ly:music?)
   (_i "Make a partial measure.")
   (let* ((mom (ly:music-length mus))
  (dur (make-duration-of-length mom)))
 (make-music 'SequentialMusic
   'elements
   (list (context-spec-music
   (make-music 'PartialSet
   'origin (*location*)
   'duration dur)
   'Timing)
 mus


\fixed c' {
   \time 3/4
   \partial { g8 a4 }
   | g2. \bar "||"
   \partial { \grace { g16 } a8 b }
   | a2. \bar "||"
   \partial \tuplet 3/2 { g8 fis }
   | g2. \bar "|."
}


A convert-ly rule would probably not be possible given the limited 
power

of regular expressions.  As such, \partial might need to support both
duration and music arguments.  Initially I thought this might not be
possible, given that a naked duration can be treated as music; but the
following does seem to work:


\version "2.22.0"

#(define (duration-or-music? arg)
   (or (ly:duration? arg) (ly:music? arg)))

partial =
#(define-music-function (arg) (duration-or-music?)
   (_i "Make a partial measure.")
   (if (ly:duration? arg)
 (context-spec-music
   (make-music 'PartialSet
   'origin (*location*)
   'duration arg)
   'Timing)
 (let* ((mom (ly:music-length arg))
(dur (make-duration-of-length mom)))
   (make-music 'SequentialMusic
 'elements
 (list (context-spec-music
 (make-music 'PartialSet
 'origin (*location*)
 'duration dur)
 'Timing)
   arg)


\fixed c' {
   \time 3/4
   \partial 4. g8 a4 %% Original syntax works.
   | g2. \bar "||"
   \partial { \grace { g16 } a8 b }
   | a2. \bar "||"
   \partial \tuplet 3/2 { g8 fis }
   | g2. \bar "|."
}



-- Aaron Hill


Hi Aaron,

I really like it! Always wondered why we need to specify a duration,
if it can be taken from the music.
I'd suggest to propose it on devel. Preferable the second coding,
because we could nicely deprecate the old syntax for some versions.


*facepalm*  I thought I was sending to devel.  Well, folks on user might 
want to chime in too.



-- Aaron Hill



Re: Should \partial accept music instead of duration?

2022-03-19 Thread Kenneth Wolcott
Hi Aaron;

  I **LIKE** it.

Thanks,
Ken Wolcott

On Sat, Mar 19, 2022 at 5:54 PM Aaron Hill  wrote:
>
> On 2022-03-19 5:46 pm, Thomas Morley wrote:
> > Am So., 20. März 2022 um 00:02 Uhr schrieb Aaron Hill
> > :
> >>
> >> Here would be a possible refactoring:
> >>
> >> 
> >> \version "2.22.0"
> >>
> >> partial =
> >> #(define-music-function (mus) (ly:music?)
> >>(_i "Make a partial measure.")
> >>(let* ((mom (ly:music-length mus))
> >>   (dur (make-duration-of-length mom)))
> >>  (make-music 'SequentialMusic
> >>'elements
> >>(list (context-spec-music
> >>(make-music 'PartialSet
> >>'origin (*location*)
> >>'duration dur)
> >>'Timing)
> >>  mus
> >>
> >>
> >> \fixed c' {
> >>\time 3/4
> >>\partial { g8 a4 }
> >>| g2. \bar "||"
> >>\partial { \grace { g16 } a8 b }
> >>| a2. \bar "||"
> >>\partial \tuplet 3/2 { g8 fis }
> >>| g2. \bar "|."
> >> }
> >> 
> >>
> >> A convert-ly rule would probably not be possible given the limited
> >> power
> >> of regular expressions.  As such, \partial might need to support both
> >> duration and music arguments.  Initially I thought this might not be
> >> possible, given that a naked duration can be treated as music; but the
> >> following does seem to work:
> >>
> >> 
> >> \version "2.22.0"
> >>
> >> #(define (duration-or-music? arg)
> >>(or (ly:duration? arg) (ly:music? arg)))
> >>
> >> partial =
> >> #(define-music-function (arg) (duration-or-music?)
> >>(_i "Make a partial measure.")
> >>(if (ly:duration? arg)
> >>  (context-spec-music
> >>(make-music 'PartialSet
> >>'origin (*location*)
> >>'duration arg)
> >>'Timing)
> >>  (let* ((mom (ly:music-length arg))
> >> (dur (make-duration-of-length mom)))
> >>(make-music 'SequentialMusic
> >>  'elements
> >>  (list (context-spec-music
> >>  (make-music 'PartialSet
> >>  'origin (*location*)
> >>  'duration dur)
> >>  'Timing)
> >>arg)
> >>
> >>
> >> \fixed c' {
> >>\time 3/4
> >>\partial 4. g8 a4 %% Original syntax works.
> >>| g2. \bar "||"
> >>\partial { \grace { g16 } a8 b }
> >>| a2. \bar "||"
> >>\partial \tuplet 3/2 { g8 fis }
> >>| g2. \bar "|."
> >> }
> >> 
> >>
> >>
> >> -- Aaron Hill
> >
> > Hi Aaron,
> >
> > I really like it! Always wondered why we need to specify a duration,
> > if it can be taken from the music.
> > I'd suggest to propose it on devel. Preferable the second coding,
> > because we could nicely deprecate the old syntax for some versions.
>
> *facepalm*  I thought I was sending to devel.  Well, folks on user might
> want to chime in too.
>
>
> -- Aaron Hill
>



Re: Should \partial accept music instead of duration?

2022-03-19 Thread Dan Eble
On Mar 19, 2022, at 20:53, Aaron Hill  wrote:
...
>>> A convert-ly rule would probably not be possible given the limited power
>>> of regular expressions.  As such, \partial might need to support both
>>> duration and music arguments.  Initially I thought this might not be
>>> possible, given that a naked duration can be treated as music; but the
>>> following does seem to work:
...

I wouldn't want to have to explain to users why these turn out different.

\score {
  \fixed c' {
\partial 4. 4.
  }
}

\score {
  \fixed c' {
\partial c4. c4.
  }
}

— 
Dan




Re: Should \partial accept music instead of duration?

2022-03-19 Thread Aaron Hill

On 2022-03-19 7:53 pm, Dan Eble wrote:

On Mar 19, 2022, at 20:53, Aaron Hill  wrote:
...
A convert-ly rule would probably not be possible given the limited 
power
of regular expressions.  As such, \partial might need to support 
both

duration and music arguments.  Initially I thought this might not be
possible, given that a naked duration can be treated as music; but 
the

following does seem to work:

...

I wouldn't want to have to explain to users why these turn out 
different.


\score {
  \fixed c' {
\partial 4. 4.
  }
}

\score {
  \fixed c' {
\partial c4. c4.
  }
}



Fair point, though the intention here would be that backwards 
compatibility would only need to exist for a time.  A warning could be 
issued whenever a user applies the older syntax; this would inform the 
user of the impending breaking change while still allowing existing code 
to compile.  When it is convenient, a future release would only support 
music as the argument.



-- Aaron Hill



Re: Should \partial accept music instead of duration?

2022-03-20 Thread Werner LEMBERG


> A convert-ly rule would probably not be possible given the
> limited power of regular expressions.  As such, \partial might
> need to support both duration and music arguments.  Initially I
> thought this might not be possible, given that a naked duration
> can be treated as music; but the following does seem to work:
>>
>> ...
>> I wouldn't want to have to explain to users why these turn out
>> different.
>> \score {
>>   \fixed c' {
>> \partial 4. 4.
>>   }
>> }
>> \score {
>>   \fixed c' {
>> \partial c4. c4.
>>   }
>> }
>> 
> 
> Fair point, though the intention here would be that backwards
> compatibility would only need to exist for a time.  A warning could
> be issued whenever a user applies the older syntax; this would
> inform the user of the impending breaking change while still
> allowing existing code to compile.  When it is convenient, a future
> release would only support music as the argument.

What about providing a new command `\upbeat` and moving `\partial`
into oblivion?  Compare this to `\tuplet` vs. `\times`.


Werner



Re: Should \partial accept music instead of duration?

2022-03-20 Thread Luca Fascione
What if you rotate them instead?
Rename the current \partial \partialDuration,
convert.ly now is just s/partial/partialDuration/
and \partial always takes music from now on

It's the same as Werner said, but keeps the good name

L

On Sun, 20 Mar 2022, 08:24 Werner LEMBERG,  wrote:

>
> > A convert-ly rule would probably not be possible given the
> > limited power of regular expressions.  As such, \partial might
> > need to support both duration and music arguments.  Initially I
> > thought this might not be possible, given that a naked duration
> > can be treated as music; but the following does seem to work:
> >>
> >> ...
> >> I wouldn't want to have to explain to users why these turn out
> >> different.
> >> \score {
> >>   \fixed c' {
> >> \partial 4. 4.
> >>   }
> >> }
> >> \score {
> >>   \fixed c' {
> >> \partial c4. c4.
> >>   }
> >> }
> >>
> >
> > Fair point, though the intention here would be that backwards
> > compatibility would only need to exist for a time.  A warning could
> > be issued whenever a user applies the older syntax; this would
> > inform the user of the impending breaking change while still
> > allowing existing code to compile.  When it is convenient, a future
> > release would only support music as the argument.
>
> What about providing a new command `\upbeat` and moving `\partial`
> into oblivion?  Compare this to `\tuplet` vs. `\times`.
>
>
> Werner
>
>


Re: Should \partial accept music instead of duration?

2022-03-20 Thread Christopher Heckman
On Sun, Mar 20, 2022 at 12:44 AM  wrote:
>
> Date: Sun, 20 Mar 2022 07:23:30 + (UTC)
> From: Werner LEMBERG 
> [...]
> > Fair point, though the intention here would be that backwards
> > compatibility would only need to exist for a time.  A warning could
> > be issued whenever a user applies the older syntax; this would
> > inform the user of the impending breaking change while still
> > allowing existing code to compile.  When it is convenient, a future
> > release would only support music as the argument.
>
> What about providing a new command `\upbeat` and moving `\partial`
> into oblivion?  Compare this to `\tuplet` vs. `\times`.
>
>
> Werner

... Or you could use the brand new command \upbeat when music follows,
keep \partial, and you don't have to worry about backwards
compatibility.

--- Christopher Heckman



Re: Should \partial accept music instead of duration?

2022-03-20 Thread Lukas-Fabian Moser




What about providing a new command `\upbeat` and moving `\partial`
into oblivion?  Compare this to `\tuplet` vs. `\times`.


 Werner

... Or you could use the brand new command \upbeat when music follows,
keep \partial, and you don't have to worry about backwards
compatibility.


This makes a lot of sense IMHO since, linguistically, it's not the music 
that becomes "partial": it's the measure. The music becomes an upbeat 
(at least in most applications of \partial).


Lukas




Re: Should \partial accept music instead of duration?

2022-03-20 Thread Aaron Hill

On 2022-03-20 1:13 am, Leo Correia de Verdier wrote:

Entirely replacing the actual syntax would not be desirable in my
opinion. Consider the case when it is used in a “global” part/variable
in an orchestral score that usually contains rehearsal marks, tempo,
key and time signature changes and such. As I understand it having
\partial to accept only music as argument would have to move to each
part, which would introduce unnecessary typing and disrupt the logic
of the structure. Sure it can be worked around, but I would see it as
a step backwards. Or have I misunderstood?


All of those things *are* music, as far as LilyPond is concerned.  It is 
just that commands like \tempo have no duration, so the following is 
nonsensical since the music has zero length:


   \partial \tempo 4 = 90

Your "global" variable likely uses spacer rests which are providing the 
length information, so the change to \partial usage ultimately looks 
like this:


   \partial 4 s4   =>   \partial s4

This removes the otherwise redundant specification of the duration.


-- Aaron Hill



Re: Should \partial accept music instead of duration?

2022-03-20 Thread Aaron Hill

On 2022-03-20 1:56 am, Lukas-Fabian Moser wrote:

What about providing a new command `\upbeat` and moving `\partial`
into oblivion?  Compare this to `\tuplet` vs. `\times`.


 Werner

... Or you could use the brand new command \upbeat when music follows,
keep \partial, and you don't have to worry about backwards
compatibility.


This makes a lot of sense IMHO since, linguistically, it's not the
music that becomes "partial": it's the measure. The music becomes an
upbeat (at least in most applications of \partial).


But as you say "most applications".  Partial or incomplete measures are 
not always anacruses.  Hymns nearly always cut the final measure short 
so it logically joins with the partial measure at the start of the tune. 
 You might also find incomplete measures in volta sections when the 
starting repeat mark is mid-measure.


To me, upbeat (opposite the term downbeat) describes 
articulation/emphasis more than it does timing.  \anacrusis or \pickup 
are better options though still too strongly linked to the beginning of 
a piece.  I think the existing \partial is the right word for the job.



-- Aaron Hill



Re: Should \partial accept music instead of duration?

2022-03-20 Thread Lukas-Fabian Moser



But as you say "most applications".  Partial or incomplete measures 
are not always anacruses.  Hymns nearly always cut the final measure 
short so it logically joins with the partial measure at the start of 
the tune.  You might also find incomplete measures in volta sections 
when the starting repeat mark is mid-measure.


Yes, of course you're right, but as far as I can see, I do not need to 
use \partial for these applications:


\relative {
  \repeat volta 2 {
    \partial 4
    c'4
    e e f f
    g4 e8 f g4
  }
  a8 f
  g4 f8 e d4 e
  c2. \bar "|."
}



To me, upbeat (opposite the term downbeat) describes 
articulation/emphasis more than it does timing.  \anacrusis or \pickup 
are better options though still too strongly linked to the beginning 
of a piece.


That's a point where my English music terminology skills a lacking: In 
German, we say "Auftakt" which most often happens at the beginning of a 
piece (a partial measure etc.), but may also refer to actual music in 
mid-piece: In


\relative {
  \partial 8
  g8
  c4 c c r8 d
  e4 e e
}

the piece starts with an "Auftakt", but there's also a (musical) 
"Auftakt" to bar 2. (Common in orchestra rehearsals: "Let's start in bar 
X 'mit Auftakt'".)


I do not know what the precise meanings of the English terms 
upbeat/pickup/anacrusis actually are.


Lukas




Re: Should \partial accept music instead of duration?

2022-03-20 Thread David Kastrup
Aaron Hill  writes:

> On 2022-03-19 7:53 pm, Dan Eble wrote:
>> On Mar 19, 2022, at 20:53, Aaron Hill  wrote:
>> ...
> A convert-ly rule would probably not be possible given the
> limited power
> of regular expressions.  As such, \partial might need to support
> both
> duration and music arguments.  Initially I thought this might not be
> possible, given that a naked duration can be treated as music;
> but the
> following does seem to work:
>> ...
>> I wouldn't want to have to explain to users why these turn out
>> different.
>> \score {
>>   \fixed c' {
>> \partial 4. 4.
>>   }
>> }
>> \score {
>>   \fixed c' {
>> \partial c4. c4.
>>   }
>> }
>> 
>
> Fair point, though the intention here would be that backwards
> compatibility would only need to exist for a time.

I strongly disagree since \partial with a duration is the natural and
proper expression when writing a separate timing track.

> A warning could be issued whenever a user applies the older syntax;
> this would inform the user of the impending breaking change while
> still allowing existing code to compile.  When it is convenient, a
> future release would only support music as the argument.

4. _is_ valid music.

-- 
David Kastrup



Re: Should \partial accept music instead of duration?

2022-03-20 Thread Aaron Hill

On 2022-03-20 3:17 am, David Kastrup wrote:

Aaron Hill  writes:

Fair point, though the intention here would be that backwards
compatibility would only need to exist for a time.


I strongly disagree since \partial with a duration is the natural and
proper expression when writing a separate timing track.


Natural, I can see.  Proper... I would need more information backing 
that claim.  Certainly if there is a technical basis, I would be eager 
to review it.  If sound, then I could retract my proposal and answer the 
email subject with "no".


In my timing/global/structure variables, expressions like \partial 4 s4 
are common.  Certainly \partial 4 would be most succinct, but it creates 
no actual duration in sequential music.  Naturally, the spacer rest is 
used so later commands occur when I need them.  My proposal leads to 
\partial s4 as a reasonable construct that avoids redundancy.  (See 
below regarding NullVoice.)




A warning could be issued whenever a user applies the older syntax;
this would inform the user of the impending breaking change while
still allowing existing code to compile.  When it is convenient, a
future release would only support music as the argument.


4. _is_ valid music.


Yes, and it works with the updated \partial function.  The only side 
effect is that it might produce a visible note (of unspecified pitch), 
because that is what 4. as music means.  If used in a NullVoice context, 
it should work the same as s4. which means we are back to the original 
syntax.  The key difference is that \partial 4. would now have musical 
length.



-- Aaron Hill



Re: Should \partial accept music instead of duration?

2022-03-20 Thread Valentin Petzel
I do not really like the idea that much to be honest. Of course it would be 
cool if we just have to specify the music and no duration, but in the end 
\partial is not really a command about the music, but about the measure 
structure. Binding it to some music would be a bit like having \time take some 
music, even though it does not need it.

This means that filling music into a structure becomes much weirder, requiring 
the use of artificial << ... >> statements to parallelize things. E.g. compare 
these two statements:

{
  \time 6/8 \partial 4.
  \repeat unfold 3 { c'8 e' g' }
}

\new Staff {
  \time 6/8
  <<
\partial s4.
\repeat unfold 3 { c'8 e' g' }
  >>
}

Clearly the second way is absolutely not beautiful, readable or intuitive. 
Additionally \partial will not start a new measure, which leads to potentially 
confusing behaviour.

One the other hand the benefit of this functionality is so minimal that I do 
not think it is worth it. Instead I’d say doing something as Werner proposed 
and have a new function with a self-explanatory name like \upbeat music for 
this would surely be preferable.

Also from a standpoint of efficiency: This would force us to put each partial 
measure into sequential music, which means  writings lots of braces, and at 
least I personally find writing braces less efficient than writing numbers.

Cheers,
Valentin


Am Sonntag, 20. März 2022, 05:35:46 CET schrieb Aaron Hill:
> On 2022-03-19 7:53 pm, Dan Eble wrote:
> > On Mar 19, 2022, at 20:53, Aaron Hill  wrote:
> > ...
> > 
>  A convert-ly rule would probably not be possible given the limited
>  power
>  of regular expressions.  As such, \partial might need to support
>  both
>  duration and music arguments.  Initially I thought this might not be
>  possible, given that a naked duration can be treated as music; but
>  the
> > 
>  following does seem to work:
> > ...
> > 
> > I wouldn't want to have to explain to users why these turn out
> > different.
> > 
> > \score {
> > 
> >   \fixed c' {
> >   
> > \partial 4. 4.
> >   
> >   }
> > 
> > }
> > 
> > \score {
> > 
> >   \fixed c' {
> >   
> > \partial c4. c4.
> >   
> >   }
> > 
> > }
> 
> Fair point, though the intention here would be that backwards
> compatibility would only need to exist for a time.  A warning could be
> issued whenever a user applies the older syntax; this would inform the
> user of the impending breaking change while still allowing existing code
> to compile.  When it is convenient, a future release would only support
> music as the argument.
> 
> 
> -- Aaron Hill



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


Re: Should \partial accept music instead of duration?

2022-03-20 Thread Luca Fascione
What if instead of `\upbeat` (which is weirdly named when used in the
end-of-music/phrase/hymn/passage scenario) this new thing is just called
`\partialMusic`?
It's backward compatible, does something easy to use in some simple
scenarios, leaves everything else in place for more refined use cases,
and it's not weird either end of the music

L


Re: Should \partial accept music instead of duration?

2022-03-20 Thread Leo Correia de Verdier
Entirely replacing the actual syntax would not be desirable in my opinion. 
Consider the case when it is used in a “global” part/variable in an orchestral 
score that usually contains rehearsal marks, tempo, key and time signature 
changes and such. As I understand it having \partial to accept only music as 
argument would have to move to each part, which would introduce unnecessary 
typing and disrupt the logic of the structure. Sure it can be worked around, 
but I would see it as a step backwards. Or have I misunderstood?

> 20 mars 2022 kl. 05:36 skrev Aaron Hill :
> 
> Fair point, though the intention here would be that backwards compatibility 
> would only need to exist for a time.  A warning could be issued whenever a 
> user applies the older syntax; this would inform the user of the impending 
> breaking change while still allowing existing code to compile.  When it is 
> convenient, a future release would only support music as the argument.
> 
> 
> -- Aaron Hill



Re: Should \partial accept music instead of duration?

2022-03-20 Thread Jean Abou Samra

Le 20/03/2022 à 10:01, Aaron Hill a écrit :
All of those things *are* music, as far as LilyPond is concerned.  It 
is just that commands like \tempo have no duration, so the following 
is nonsensical since the music has zero length:


   \partial \tempo 4 = 90

Your "global" variable likely uses spacer rests which are providing 
the length information, so the change to \partial usage ultimately 
looks like this:


   \partial 4 s4   =>   \partial s4

This removes the otherwise redundant specification of the duration.




Took me a while to realize that << \partial { s4 } { ... } >> would 
work. Also, what about injecting \partial into music via \pushToTag, the 
edition engraver or similar?


Generally speaking, \partial is so frequently used that I am decidedly 
wary of breaking it. Like Lukas, I am not seeing clearly on the English 
terminology of "partial", "anacrusis", "upbeat" and "pickup", but it 
seems to me that the choice is broad enough to allow the introduction of 
a separate command. I don't know if I like it. It will be more to learn 
for the same thing, but it might be more convenient for cases where you 
need \partial 1*5/16 and such.


Jean




Re: Should \partial accept music instead of duration?

2022-03-20 Thread Tim's Bitstream



> On Mar 20, 2022, at 2:24 AM, Werner LEMBERG  wrote:
> 
> What about providing a new command `\upbeat` and moving `\partial`
> into oblivion?  Compare this to `\tuplet` vs. `\times`.

Perhaps this is an American jazzism, but we would refer to those as \pickup 
notes.



Re: Should \partial accept music instead of duration?

2022-03-20 Thread Christopher Heckman
On Sun, Mar 20, 2022 at 1:26 AM Christopher Heckman
 wrote:
>
> On Sun, Mar 20, 2022 at 12:44 AM  wrote:
> >
> > Date: Sun, 20 Mar 2022 07:23:30 + (UTC)
> > From: Werner LEMBERG 
> > [...]
> > > Fair point, though the intention here would be that backwards
> > > compatibility would only need to exist for a time.  A warning could
> > > be issued whenever a user applies the older syntax; this would
> > > inform the user of the impending breaking change while still
> > > allowing existing code to compile.  When it is convenient, a future
> > > release would only support music as the argument.
> >
> > What about providing a new command `\upbeat` and moving `\partial`
> > into oblivion?  Compare this to `\tuplet` vs. `\times`.
> >
> >
> > Werner
>
> ... Or you could use the brand new command \upbeat when music follows,
> keep \partial, and you don't have to worry about backwards
> compatibility.

This also seems to be a lot of trouble, because it seems like you
could define a one-line scheme music function and put it in your .ly
file. Something like this ought to work. (I might not have the syntax
100% correct.)

partialMusic =
#(define-music-function (parser location music) (ly:music?)
(let * (musicDur (ly:music-property music 'duration))
(#{ \partial $musicDur $music #})
))

--- Christopher Heckman



Re: Should \partial accept music instead of duration?

2022-03-21 Thread David Kastrup
Tim's Bitstream  writes:

>> On Mar 20, 2022, at 2:24 AM, Werner LEMBERG  wrote:
>> 
>> What about providing a new command `\upbeat` and moving `\partial`
>> into oblivion?  Compare this to `\tuplet` vs. `\times`.
>
> Perhaps this is an American jazzism, but we would refer to those as
> \pickup notes.

\pickup has a reasonable ring to it, fitting it in a reasonable subset
of applications for \partial .  The problem I have is figuring out its
role, though.

With \times/\tuplet we clearly phased out \times for \tuplet
consistently in the documentation.  I am not really on-board with the
same regarding \partial/\pickup : the overlap in semantics is different
in character.

-- 
David Kastrup