Shorthand for "once override"?

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

Shorthand for "once override"?

Alasdair McAndrew
In my attempt to typeset some early 18th century French music for viola da gamba, I'm trying to keep to the original notation as closely as possible.  Thus I'm using a breath mark to indicate a trill, and a sans-serif x for a mordent.  So for example, I have

mx = \markup {\teeny \sans x}

But to put this symbol next to its note (where it belongs), I have to write something like

 \once \override TextScript #'extra-offset = #'(1.5 . -1.5) f4.^\mx

to ensure it goes in the right place.  Is there any way of simplifying this?  Ideally, it'd be nice to be able to write something like

f4.^{\mx 1.5 -1.5}

and leave all the once override stuff out of the score itself.  Or is there another way of placing a symbol where I want it?

Thanks,
Reply | Threaded
Open this post in threaded view
|

Re: Shorthand for "once override"?

Martín Rincón Botero
Hi Alasdair,

what about

mx = \markup { \translate #'(1.5 . -1.5) \teeny \sans x }
 \score {
f4^\mx
}

Regards,
Martín.

Am Mi., 2. Sept. 2020 um 08:00 Uhr schrieb Alasdair McAndrew <[hidden email]>:
In my attempt to typeset some early 18th century French music for viola da gamba, I'm trying to keep to the original notation as closely as possible.  Thus I'm using a breath mark to indicate a trill, and a sans-serif x for a mordent.  So for example, I have

mx = \markup {\teeny \sans x}

But to put this symbol next to its note (where it belongs), I have to write something like

 \once \override TextScript #'extra-offset = #'(1.5 . -1.5) f4.^\mx

to ensure it goes in the right place.  Is there any way of simplifying this?  Ideally, it'd be nice to be able to write something like

f4.^{\mx 1.5 -1.5}

and leave all the once override stuff out of the score itself.  Or is there another way of placing a symbol where I want it?

Thanks,


--
Reply | Threaded
Open this post in threaded view
|

Re: Shorthand for "once override"?

Andrew Bernard
In reply to this post by Alasdair McAndrew
Didn't we already have this conversation? You can make an engraver  to
do all the French ornaments. The outline is on Scores of Beauty. I can
help you do it if you like. Anything like what you have suggested is a
just a sort of hack. Even though you can force it to work, it is
suboptimal. It can be done nicely. Admittedly doing it the good way is
advanced lilypond, but there are lots of people here with deep skills.

And this thread title is incorrect - we need to start a new distinct
one. It's hijacked another thread (thread hijacking is a common
problem). I'll leave it to you to initiate a new topic thread.


Andrew




Reply | Threaded
Open this post in threaded view
|

Re: Shorthand for "once override"?

Andrew Bernard
Oh sorry - you were actually asking about \once \override. SORRY!
there's a huge discussion about the abbreviation of this on the
development list and I had that in mind.

Andrew



Reply | Threaded
Open this post in threaded view
|

Re: Shorthand for "once override"?

David Kastrup
In reply to this post by Alasdair McAndrew
Alasdair McAndrew <[hidden email]> writes:

> In my attempt to typeset some early 18th century French music for viola da
> gamba, I'm trying to keep to the original notation as closely as possible.
> Thus I'm using a breath mark to indicate a trill, and a sans-serif x for a
> mordent.  So for example, I have
>
> mx = \markup {\teeny \sans x}
>
> But to put this symbol next to its note (where it belongs), I have to write
> something like
>
>  \once \override TextScript #'extra-offset = #'(1.5 . -1.5) f4.^\mx
>
> to ensure it goes in the right place.  Is there any way of simplifying
> this?  Ideally, it'd be nice to be able to write something like
>
> f4.^{\mx 1.5 -1.5}
>
> and leave all the once override stuff out of the score itself.  Or is there
> another way of placing a symbol where I want it?

Why wouldn't you use a tweak rather than an override?

--
David Kastrup

Reply | Threaded
Open this post in threaded view
|

Re: Shorthand for "once override"?

Alasdair McAndrew
Errr... because I don't know enough about Lilypond to distinguish between an override and a tweak.  I just happened to have found a Lilypond score (admittedly an old one) which uses overrides to place special symbols next to notes, and I'm doing that because I can see that it works.  But if tweaking is the better option, I'll do that instead!  

Thank you for the suggestion.

On Wed, Sep 2, 2020 at 8:08 PM David Kastrup <[hidden email]> wrote:
Alasdair McAndrew <[hidden email]> writes:

> In my attempt to typeset some early 18th century French music for viola da
> gamba, I'm trying to keep to the original notation as closely as possible.
> Thus I'm using a breath mark to indicate a trill, and a sans-serif x for a
> mordent.  So for example, I have
>
> mx = \markup {\teeny \sans x}
>
> But to put this symbol next to its note (where it belongs), I have to write
> something like
>
>  \once \override TextScript #'extra-offset = #'(1.5 . -1.5) f4.^\mx
>
> to ensure it goes in the right place.  Is there any way of simplifying
> this?  Ideally, it'd be nice to be able to write something like
>
> f4.^{\mx 1.5 -1.5}
>
> and leave all the once override stuff out of the score itself.  Or is there
> another way of placing a symbol where I want it?

Why wouldn't you use a tweak rather than an override?

--
David Kastrup


--
Reply | Threaded
Open this post in threaded view
|

Re: Shorthand for "once override"?

Alasdair McAndrew
In reply to this post by Martín Rincón Botero
Thanks, Martin - that would be a great suggestion except that the numbers will change depending on the position of the note on the staff, and its surrounds - even including the direction of the stem.  Every time the symbol appears it will need to be carefully placed by hand, so to speak, to ensure it's in the right place.

cheers,
Alasdair

On Wed, Sep 2, 2020 at 4:41 PM Martín Rincón Botero <[hidden email]> wrote:
Hi Alasdair,

what about

mx = \markup { \translate #'(1.5 . -1.5) \teeny \sans x }
 \score {
f4^\mx
}

Regards,
Martín.

Am Mi., 2. Sept. 2020 um 08:00 Uhr schrieb Alasdair McAndrew <[hidden email]>:
In my attempt to typeset some early 18th century French music for viola da gamba, I'm trying to keep to the original notation as closely as possible.  Thus I'm using a breath mark to indicate a trill, and a sans-serif x for a mordent.  So for example, I have

mx = \markup {\teeny \sans x}

But to put this symbol next to its note (where it belongs), I have to write something like

 \once \override TextScript #'extra-offset = #'(1.5 . -1.5) f4.^\mx

to ensure it goes in the right place.  Is there any way of simplifying this?  Ideally, it'd be nice to be able to write something like

f4.^{\mx 1.5 -1.5}

and leave all the once override stuff out of the score itself.  Or is there another way of placing a symbol where I want it?

Thanks,


--


--
Reply | Threaded
Open this post in threaded view
|

Re: Shorthand for "once override"?

Leo Correia de Verdier
You can have an event function like:

\version "2.20.0"

mx = #(define-event-function (placement) (pair?)
        #{
         -\tweak extra-offset #placement
         -\markup { \teeny \sans x }
        #} )

{ f4 -\mx #'(1.6 . 1.4)
f' -\mx #'(1.5 . 1.43)
f'' -\mx #'(1.5 . 4.93)
f''' -\mx #'(1.5 . 8.53)
}

But if possible I would still follow Andrews suggestion go for a way where you don’t have to place each ornament by hand. Its quite advanced but as he said there is help to be gotten. Here is the first blog post he wrote about:

https://lilypondblog.org/2013/08/adding-ornamentations-to-note-heads-part-1/


> 3 sep. 2020 kl. 01:11 skrev Alasdair McAndrew <[hidden email]>:
>
> Thanks, Martin - that would be a great suggestion except that the numbers will change depending on the position of the note on the staff, and its surrounds - even including the direction of the stem.  Every time the symbol appears it will need to be carefully placed by hand, so to speak, to ensure it's in the right place.
>
> cheers,
> Alasdair
>
> On Wed, Sep 2, 2020 at 4:41 PM Martín Rincón Botero <[hidden email]> wrote:
> Hi Alasdair,
>
> what about
>
> mx = \markup { \translate #'(1.5 . -1.5) \teeny \sans x }
>  \score {
> f4^\mx
> }
>
> Regards,
> Martín.
>
> Am Mi., 2. Sept. 2020 um 08:00 Uhr schrieb Alasdair McAndrew <[hidden email]>:
> In my attempt to typeset some early 18th century French music for viola da gamba, I'm trying to keep to the original notation as closely as possible.  Thus I'm using a breath mark to indicate a trill, and a sans-serif x for a mordent.  So for example, I have
>
> mx = \markup {\teeny \sans x}
>
> But to put this symbol next to its note (where it belongs), I have to write something like
>
>  \once \override TextScript #'extra-offset = #'(1.5 . -1.5) f4.^\mx
>
> to ensure it goes in the right place.  Is there any way of simplifying this?  Ideally, it'd be nice to be able to write something like
>
> f4.^{\mx 1.5 -1.5}
>
> and leave all the once override stuff out of the score itself.  Or is there another way of placing a symbol where I want it?
>
> Thanks,
> Alasdair
>
> --
> https://numbersandshapes.net
>
>
> --
> www.martinrinconbotero.com
>
>
> --
> https://numbersandshapes.net


Reply | Threaded
Open this post in threaded view
|

Re: Shorthand for "once override"?

Alasdair McAndrew
Many thanks, both for the event function, and to the blog post.  The latter looks quite tricky, but when I feel brave enough I'll give it a go.  Meanwhile, I'll experiment with the event function - which might in fact be preferable given that some of the marks are going to have to be individually tweaked anyway.  

I wonder why Lilypond does not have some sort of simple system - which doesn't require lines of complex Scheme code - for creating a new accidental (or other expressive mark) to be attached to a note-head.

Alasdair

On Thu, Sep 3, 2020 at 10:28 PM Leo Correia de Verdier <[hidden email]> wrote:
You can have an event function like:

\version "2.20.0"

mx = #(define-event-function (placement) (pair?)
        #{
         -\tweak extra-offset #placement
         -\markup { \teeny \sans x }
        #} )

{ f4 -\mx #'(1.6 . 1.4)
f' -\mx #'(1.5 . 1.43)
f'' -\mx #'(1.5 . 4.93)
f''' -\mx #'(1.5 . 8.53)
}

But if possible I would still follow Andrews suggestion go for a way where you don’t have to place each ornament by hand. Its quite advanced but as he said there is help to be gotten. Here is the first blog post he wrote about:

https://lilypondblog.org/2013/08/adding-ornamentations-to-note-heads-part-1/


> 3 sep. 2020 kl. 01:11 skrev Alasdair McAndrew <[hidden email]>:
>
> Thanks, Martin - that would be a great suggestion except that the numbers will change depending on the position of the note on the staff, and its surrounds - even including the direction of the stem.  Every time the symbol appears it will need to be carefully placed by hand, so to speak, to ensure it's in the right place.
>
> cheers,
> Alasdair
>
> On Wed, Sep 2, 2020 at 4:41 PM Martín Rincón Botero <[hidden email]> wrote:
> Hi Alasdair,
>
> what about
>
> mx = \markup { \translate #'(1.5 . -1.5) \teeny \sans x }
>  \score {
> f4^\mx
> }
>
> Regards,
> Martín.
>
> Am Mi., 2. Sept. 2020 um 08:00 Uhr schrieb Alasdair McAndrew <[hidden email]>:
> In my attempt to typeset some early 18th century French music for viola da gamba, I'm trying to keep to the original notation as closely as possible.  Thus I'm using a breath mark to indicate a trill, and a sans-serif x for a mordent.  So for example, I have
>
> mx = \markup {\teeny \sans x}
>
> But to put this symbol next to its note (where it belongs), I have to write something like
>
>  \once \override TextScript #'extra-offset = #'(1.5 . -1.5) f4.^\mx
>
> to ensure it goes in the right place.  Is there any way of simplifying this?  Ideally, it'd be nice to be able to write something like
>
> f4.^{\mx 1.5 -1.5}
>
> and leave all the once override stuff out of the score itself.  Or is there another way of placing a symbol where I want it?
>
> Thanks,
> Alasdair
>
> --
> https://numbersandshapes.net
>
>
> --
> www.martinrinconbotero.com
>
>
> --
> https://numbersandshapes.net



--
Reply | Threaded
Open this post in threaded view
|

Re: Shorthand for "once override"?

Aaron Hill
On 2020-09-03 5:22 pm, Alasdair McAndrew wrote:
> Many thanks, both for the event function, and to the blog post.  The
> latter
> looks quite tricky, but when I feel brave enough I'll give it a go.
> Meanwhile, I'll experiment with the event function - which might in
> fact be
> preferable given that some of the marks are going to have to be
> individually tweaked anyway.

Something to consider is whether a Fingering grob is a better fit than
TextScript for your custom ornamentation.  With a little logic, you can
automatically align the child to its parent:

%%%%
\version "2.20.0"

makeRightOrnament =
#(define-scheme-function
   (text)
   (markup?)
   (define (relative-extent grob source axis)
     (ly:grob-robust-relative-extent
       grob
       (ly:grob-common-refpoint grob source axis)
       axis))
   (define (proc grob)
     (let* ((pad (ly:grob-property grob 'padding))
            (nh (ly:grob-parent grob X))
            (dot (ly:grob-object nh 'dot))
            (nh-xex (ly:grob-property nh 'X-extent))
            (dot-xex (if (ly:grob? dot)
                       (relative-extent dot nh X)
                       empty-interval)))
       (ly:grob-set-property! grob 'X-offset
         (+ pad (apply max (map cdr (list nh-xex dot-xex)))))
       (ly:grob-set-property! grob 'Y-offset
         (ly:grob-property nh 'Y-offset))))
   #{ -\tweak before-line-breaking #proc
      -\finger \markup \normal-text #text #})

mx = \makeRightOrnament \markup \vcenter \teeny \sans x
mzzz = \makeRightOrnament \markup \vcenter \huge \bold zzz

{ f8 -\tweak padding #0.8 -\mx f'4. -\mx
   f''16 -\mzzz f'''4.. -\mx }
%%%%


-- Aaron Hill

ornament.cropped.png (13K) Download Attachment