custom articulation position

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

custom articulation position

Gilberto Agostinho
Hi all,

I am having a bit of trouble trying to create a custom articulation in
LilyPond. At the moment I have the following code:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\version "2.19.53"

doubleAccent = \markup {
  \halign #-0.72
  \combine
  \musicglyph #"scripts.sforzato"
  \raise #1.1
  \musicglyph #"scripts.sforzato"
}

{
  \time 3/4
  \stemUp
  a-\doubleAccent
  a'-\doubleAccent
  a''-\doubleAccent
  \stemDown
  a-\doubleAccent
  a'-\doubleAccent
  a''-\doubleAccent
}
\markup{""}  % just for spacing
{
  \time 3/4
  \stemUp
  a->
  a'->
  a''->
  \stemDown
  a->
  a'->
  a''->
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Outputting:

<http://lilypond.1069038.n5.nabble.com/file/t4165/12.png>

This does work well, but the new symbol does not automatically respond to
the stem position like a regular accent (compare both systems above). I know
that I can manually force their position with ^\doubleAccent and
_\doubleAccent, but I want to ask if is there any way of doing this
automagically. Does anyone have any suggestions?

And also, is there a way of associating a dynamic change to this new symbol
so that it also affects the MIDI output?

Many thanks!
Gilberto



--
Sent from: http://lilypond.1069038.n5.nabble.com/User-f3.html

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

Re: custom articulation position

caagr98
What you're doing is just creating a text script, not an articulation. I use the following code to create a custom real articulation; you'll obviously have to adapt some of it to fit yours.

```
#(define (draw-unaccent grob)
   (let ((stil (make-path-stencil '(M -0.435 0.435 C -0.435 0.185 -0.250 0 0 0 C 0.250 0 0.435 0.185 0.435 0.435) 0.13 1 1 #f))
         (dir (ly:grob-property grob 'direction CENTER)))
     (if (= dir DOWN)
       (ly:stencil-scale stil 1 -1)
       stil)))

#(define unaccent-script-alist
   (cons `("unaccent" .
             ((avoid-slur . around)
              (padding . 0.30)
              (side-relative-direction . ,DOWN)
              ))
     default-script-alist))

\layout {
  \context {
    \Score
    scriptDefinitions = #unaccent-script-alist
  }
}

unaccent =
  -\tweak stencil #draw-unaccent
  #(make-articulation "unaccent" 'midi-extra-velocity -30)
```

On 11/03/17 16:57, Gilberto Agostinho wrote:

> Hi all,
>
> I am having a bit of trouble trying to create a custom articulation in
> LilyPond. At the moment I have the following code:
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> \version "2.19.53"
>
> doubleAccent = \markup {
>   \halign #-0.72
>   \combine
>   \musicglyph #"scripts.sforzato"
>   \raise #1.1
>   \musicglyph #"scripts.sforzato"
> }
>
> {
>   \time 3/4
>   \stemUp
>   a-\doubleAccent
>   a'-\doubleAccent
>   a''-\doubleAccent
>   \stemDown
>   a-\doubleAccent
>   a'-\doubleAccent
>   a''-\doubleAccent
> }
> \markup{""}  % just for spacing
> {
>   \time 3/4
>   \stemUp
>   a->
>   a'->
>   a''->
>   \stemDown
>   a->
>   a'->
>   a''->
> }
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>
> Outputting:
>
> <http://lilypond.1069038.n5.nabble.com/file/t4165/12.png>
>
> This does work well, but the new symbol does not automatically respond to
> the stem position like a regular accent (compare both systems above). I know
> that I can manually force their position with ^\doubleAccent and
> _\doubleAccent, but I want to ask if is there any way of doing this
> automagically. Does anyone have any suggestions?
>
> And also, is there a way of associating a dynamic change to this new symbol
> so that it also affects the MIDI output?
>
> Many thanks!
> Gilberto
>
>
>
> --
> Sent from: http://lilypond.1069038.n5.nabble.com/User-f3.html
>
> _______________________________________________
> lilypond-user mailing list
> [hidden email]
> https://lists.gnu.org/mailman/listinfo/lilypond-user
>

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

Re: custom articulation position

Gilberto Agostinho
caagr98 wrote
> What you're doing is just creating a text script, not an articulation. I
> use the following code to create a custom real articulation; you'll
> obviously have to adapt some of it to fit yours.

Fantastic, thank you so much! This solves both of my problems!

For anyone interested, here is my adaptation of the script:

```
\version "2.19.53"

double-accent-grob = #(lambda (grob)(grob-interpret-markup grob
    #{ \markup\combine
      \musicglyph #"scripts.sforzato"
      \translate #'(0 . 1.2)
      \musicglyph #"scripts.sforzato"
   #}))

#(define double-accent-script-alist
   (cons `("double-accent" .
             ((avoid-slur . around)
              (padding . 0.30)
              (side-relative-direction . ,DOWN)
              ))
     default-script-alist))

\layout {
  \context {
    \Score
    scriptDefinitions = #double-accent-script-alist
  }
}

doubleAccent =
  -\tweak stencil #double-accent-grob
  #(make-articulation "double-accent" 'midi-extra-velocity 30)

{
  \time 3/4
  \stemUp
  a-\doubleAccent
  a'-\doubleAccent
  a''-\doubleAccent
  \stemDown
  a-\doubleAccent
  a'-\doubleAccent
  a''-\doubleAccent
}
```



--
Sent from: http://lilypond.1069038.n5.nabble.com/User-f3.html

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