R\fermata: How to build a markup in C++?

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

R\fermata: How to build a markup in C++?

Malte Meyn-3
Hi list,

I’m trying to get R\fermata to work as expected by new users. I thought
that it would be easier to make a MultiMeasureRestText with a markup
containing the fermata glyph instead of having something like
MultiMeasureRestScript. For that I have to build such a markup.
Currently, I’m able to get the correct glyph name (ufermata/dfermata and
others for most articulations but not f.e. \staccato). But then I’d have
to build the “\markup \musicglyph” part in C++. Is there a way to do that?

Are there any other ideas how the R\fermata thing could be done?

Attached you can find what I’ve tried as a patch file, below some
LilyPond code for testing.

Cheers,
Malte

\version "2.21.0"

{
    r1\fermata
    r1^\fermata
    r1_\fermata
    << r\fermata \\ r\fermata >>

    \bar "||"

    R1\fermataMarkup
    R1^\fermataMarkup
    R1_\fermataMarkup
    << R\fermataMarkup \\ R\fermataMarkup >>

    \bar "||"

    R1\fermata
    R1^\fermata
    R1_\fermata
    << R\fermata \\ R\fermata >>

    \bar "||"

    R\shortfermata
    R\upbow
    R\lheel
}


_______________________________________________
lilypond-devel mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-devel

0001-work-in-progress-how-to-build-a-markup-in-C.patch.txt (3K) Download Attachment
document.png (27K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: R\fermata: How to build a markup in C++?

Dan Eble
On Apr 15, 2019, at 05:55, Malte Meyn <[hidden email]> wrote:
>
>
> Attached you can find what I’ve tried as a patch file, below some LilyPond code for testing.

It would be valuable to consider more cases.
  * multi-measure rests that actually span multiple measures, e.g. R1*8\fermata
  * expanded vs. not expanded vs. church rests
  * with and without measure counts
  * etc.?

Dan


_______________________________________________
lilypond-devel mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|

Re: R\fermata: How to build a markup in C++?

Malte Meyn-3


Am 16.04.19 um 00:24 schrieb Dan Eble:

> On Apr 15, 2019, at 05:55, Malte Meyn <[hidden email]> wrote:
>>
>>
>> Attached you can find what I’ve tried as a patch file, below some LilyPond code for testing.
>
> It would be valuable to consider more cases.
>    * multi-measure rests that actually span multiple measures, e.g. R1*8\fermata
>    * expanded vs. not expanded vs. church rests
>    * with and without measure counts
>    * etc.?

In all these cases \fermata behaves the same as \fermataMarkup, because
both simply create a MultiMeasureRestText. It’s placed on the first
measure of expanded MMRs, outside of MultiMeasureRestNumbers, and inside
of MeasureCounters.


\version "2.21.0"

\new Staff \with {
   \consists Measure_counter_engraver
   \override MultiMeasureRestText.color = #blue
} {
   R1\fermata
   R1\fermataMarkup
   \bar "||"

   R1*3\fermata
   R1*3\fermataMarkup
   \bar "||"

   \compressFullBarRests
   R1*3\fermata
   R1*3\fermataMarkup
   \bar "||"

   R1*12\fermata
   R1*12\fermataMarkup
   \expandFullBarRests
   \bar "||"

   \startMeasureCount
   R1*3\fermata
   \stopMeasureCount
   \startMeasureCount
   R1*3\fermataMarkup
   \stopMeasureCount
}

_______________________________________________
lilypond-devel mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|

Re: R\fermata: How to build a markup in C++?

Neil Puttock
In reply to this post by Malte Meyn-3
Hi Malte,

On Mon, 15 Apr 2019 at 10:55, Malte Meyn <[hidden email]> wrote:

> Are there any other ideas how the R\fermata thing could be done?

Check out scm/lily-syntax-constructors.scm, where there's a
constructor for MM rests:

http://git.savannah.gnu.org/gitweb/?p=lilypond.git;a=blob;f=scm/ly-syntax-constructors.scm;h=256a2ec08aefdf10bd543fe6f8b6b6b8caba8970;hb=HEAD#l199

Cheers,
Neil

_______________________________________________
lilypond-devel mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|

Re: R\fermata: How to build a markup in C++?

Malte Meyn-3


Am 16.04.19 um 13:21 schrieb Neil Puttock:

> Hi Malte,
>
> On Mon, 15 Apr 2019 at 10:55, Malte Meyn <[hidden email]> wrote:
>
>> Are there any other ideas how the R\fermata thing could be done?
>
> Check out scm/lily-syntax-constructors.scm, where there's a
> constructor for MM rests:
>
> http://git.savannah.gnu.org/gitweb/?p=lilypond.git;a=blob;f=scm/ly-syntax-constructors.scm;h=256a2ec08aefdf10bd543fe6f8b6b6b8caba8970;hb=HEAD#l199
>
> Cheers,
> Neil

Thanks for the hint! I had already seen that (only then I realised that
\fermata already creates a MultiMeasureTextEvent and
MultiMeasureRestText grob that just has an 'articulation-type instead of
'text property). But your hint made me look again at that place. Maybe I
could build the 'text from the 'articulation easier in Scheme than in
C++ (i. e. change the definition of script-to-mmrest-text so that it
gives ‘music’ a 'text property before calling make-music).

_______________________________________________
lilypond-devel mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|

Re: R\fermata: How to build a markup in C++?

Neil Puttock
On Tue, 16 Apr 2019 at 12:30, Malte Meyn <[hidden email]> wrote:

> Thanks for the hint! I had already seen that (only then I realised that
> \fermata already creates a MultiMeasureTextEvent and
> MultiMeasureRestText grob that just has an 'articulation-type instead of
> 'text property). But your hint made me look again at that place. Maybe I
> could build the 'text from the 'articulation easier in Scheme than in
> C++ (i. e. change the definition of script-to-mmrest-text so that it
> gives ‘music’ a 'text property before calling make-music).

Yeah.  You should be able to check for an articulation-event and
extract the type to build the markup.

_______________________________________________
lilypond-devel mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|

Re: R\fermata: How to build a markup in C++?

Malte Meyn-3


Am 16.04.19 um 13:38 schrieb Neil Puttock:
> Yeah.  You should be able to check for an articulation-event and
> extract the type to build the markup.

Yes. The only thing that I’m not sure is how to get hold of the context
that has the scriptDefinitions property. My current approach just uses
default-script-alist (from scm/script.scm) which is made the default at
ly/engraver-init.ly.

In C++ I used the function context () without knowing
• what this function does exactly
• where it is defined and
• why it worked.
But hey, it worked! So maybe there’s some similar magic in Scheme?

_______________________________________________
lilypond-devel mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|

Re: R\fermata: How to build a markup in C++?

Malte Meyn-3


Am 16.04.19 um 14:50 schrieb Malte Meyn:

>
>
> Am 16.04.19 um 13:38 schrieb Neil Puttock:
>> Yeah.  You should be able to check for an articulation-event and
>> extract the type to build the markup.
>
> Yes. The only thing that I’m not sure is how to get hold of the context
> that has the scriptDefinitions property. My current approach just uses
> default-script-alist (from scm/script.scm) which is made the default at
> ly/engraver-init.ly.
Those who are interested can find the current approach attached.

> In C++ I used the function context () without knowing
> • what this function does exactly
> • where it is defined and
> • why it worked.
> But hey, it worked! So maybe there’s some similar magic in Scheme?
Can one get the context from the MultiMeasureRestEvent?

_______________________________________________
lilypond-devel mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-devel

0001-WIP-Scheme-version-uses-default-script-alist.-No.patch.txt (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: R\fermata: How to build a markup in C++?

Dan Eble
In reply to this post by Malte Meyn-3
On Apr 16, 2019, at 06:58, Malte Meyn <[hidden email]> wrote:
>
> In all these cases \fermata behaves the same as \fermataMarkup, because both simply create a MultiMeasureRestText. It’s placed on the first measure of expanded MMRs


Is that the most reasonable result or should it be treated as a known issue?  Wouldn’t it be more logical for an expanded R1*3\fermata to be engraved like R1 R1 R1\fermata?

Regards,

Dan


_______________________________________________
lilypond-devel mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|

Re: R\fermata: How to build a markup in C++?

Malte Meyn-3


Am 19.04.19 um 19:50 schrieb Dan Eble:
> On Apr 16, 2019, at 06:58, Malte Meyn <[hidden email]> wrote:
>>
>> In all these cases \fermata behaves the same as \fermataMarkup, because both simply create a MultiMeasureRestText. It’s placed on the first measure of expanded MMRs
>
>
> Is that the most reasonable result or should it be treated as a known issue?  Wouldn’t it be more logical for an expanded R1*3\fermata to be engraved like R1 R1 R1\fermata?

I don’t think that it would be more logical; two thoughts on that:

1. You probably wouldn’t use fermatas on compressed multi-measure rests
but instead spell them out because otherwise the player would not know
which measures are affected:
%%%%%%%% BEGIN %%%%%%%%
{
   \compressFullBarRests

   R1*3\fermata    % IMO unlikely
   R1*2 R1\fermata % clearer
   R1\fermata R1*2 % clearer

   % and a player could even interpret it as
   R1\fermata R\fermata R\fermata
}
%%%%%%%%% END %%%%%%%%%
So if you wouldn’t write R1*3\fermata with compressed rests, why would
you with expanded ones? → The default placement is irrelevant.

2. Texts like “Allegro” or “ritardando” or “change to piccolo” on
compressed multi-measure should be placed on the first measure if expanded:
%%%%%%%% BEGIN %%%%%%%%
{
   R1*3-"ritardando"

   \compressFullBarRests
   R1*3-"ritardando"
}
%%%%%%%%% END %%%%%%%%%
I think that it would be good to have consistent behaviour of scripts
(like \fermata) and text scripts (like -"ritardando"). → The default
placement of MultiMeasureRestScripts should be the same as for
MultiMeasureRestTexts as it currently is.

_______________________________________________
lilypond-devel mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-devel