Re: How to force script (articulation custom function) inside staff ?

2017-03-31 Thread Les Éditions Valmajour - pg

Thanks Malte!
It works well, I didn't notice before the difference in space between 
dashs and dots in different situations.
The only thing is that the size of the dot is bigger in Tenuto+Staccato 
than in Portato.

But I think it can work for me like that.
Thanks again!
Pierre

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: How to force script (articulation custom function) inside staff ?

2017-03-31 Thread Malte Meyn


Am 31.03.2017 um 11:48 schrieb Les Éditions Valmajour - pg:
> Dear list members,
> I have to use lots of dots and dashes in a score, so I found a snippet
>  to apply an articulation
> (staccato) function to a long passage. I tried to adapt it for another
> articulation, the one I need (portato, = dot + dash)
> It works well, except the positioning: it remains outside the Staff.
> I would like to get the same positioning behavior than the default
> articulation (inside the staff)

Portato is something different than staccato plus tenuto in LilyPond:

\score {
  <<
\new Staff \with {
  instrumentName = "default -.--"
} \relative c'' {
  g8-.-- a-.-- b-.-- c-.--\downbow
  d-.-- c-.-- b-.-- a-.--\upbow
}
\new Staff \with {
  instrumentName = "default -_"
} \relative c'' {
  g8-_ a-_ b-_ c-_\downbow
  d-_ c-_ b-_ a-_\upbow
}
  >>
}

The portato (-_) is *one* single symbol instead of two separate ones
(dash + dot). This single symbol has no space to got inside the staff so
your function won’t work as expected.

You could try adding the dashes and the dots separately (define
addTenuto which adds "tenuto" instead of "portato"):

\new Staff \with { instrumentName = "+ \addStacc + \addTenuto" }
\relative c' {
  \addTenuto { \addStacc { g'8 a b c\downbow d c b a\upbow } }
}

But IMHO that looks bad because of different spacing between dash and
dot depending on whether they are inside the staff or outside.

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


How to force script (articulation custom function) inside staff ?

2017-03-31 Thread Les Éditions Valmajour - pg

Dear list members,
I have to use lots of dots and dashes in a score, so I found a snippet 
 to apply an articulation 
(staccato) function to a long passage. I tried to adapt it for another 
articulation, the one I need (portato, = dot + dash)

It works well, except the positioning: it remains outside the Staff.
I would like to get the same positioning behavior than the default 
articulation (inside the staff)


I found a beginning of solution, but now the dots and dashes don't avoid 
collisions with the staff lines. (cf attached .ly). And I kinda feel 
that \override is not the clean trick.


Do anyone know how I can achieve this?
Thank you!
Best,
/Pierre
\version "2.18.2"

#(define (make-script x)
   (make-music 'ArticulationEvent
 'articulation-type x))

#(define (add-script m x)
   (case (ly:music-property m 'name)
 ((NoteEvent) (set! (ly:music-property m 'articulations)
(append (ly:music-property m 'articulations)
  (list (make-script x
   m)
 ((EventChord)(set! (ly:music-property m 'elements)
(append (ly:music-property m 'elements)
  (list (make-script x
   m)
 (else #f)))

#(define (add-staccato m)
   (add-script m "staccato"))

addStacc = #(define-music-function (parser location music)
  (ly:music?)
  (map-some-music add-staccato music))

%%% 

#(define (make-script x)
   (make-music 'ArticulationEvent
 'articulation-type x))

#(define (add-script m x)
   (case (ly:music-property m 'name)
 ((NoteEvent) (set! (ly:music-property m 'articulations)
(append (ly:music-property m 'articulations)
  (list (make-script x
   m)
 ((EventChord)(set! (ly:music-property m 'elements)
(append (ly:music-property m 'elements)
  (list (make-script x
   m)
 (else #f)))

#(define (add-portato m)
   (add-script m "portato"))

addPortato = #(define-music-function (parser location music)
(ly:music?)
(map-some-music add-portato music))


\paper {
  indent = #30
}

\score {
  <<
\new Staff \with { instrumentName = "defaut" } \relative c'' { g8-.-- a-.-- b-.-- c-.--\downbow d-.-- c-.-- b-.-- a-.--\upbow }
\new Staff \with { instrumentName = "+ \addStacc" } \relative c' { \addStacc { g'8 a b c\downbow d c b a\upbow } }
\new Staff \with { instrumentName = "+ \addPortato" } \relative c' { \addPortato { g'8 a b c\downbow d c b a\upbow } }  
\new Staff \with { instrumentName = "+ \addP + \ov." } \relative c' { \override Staff.Script.padding = #0
  \override Staff.Script.toward-stem-shift = ##t
  \override Staff.Script.quantize-position = ##t
  \addPortato { g'8 a b c\downbow d c b a\upbow }
}
  >>
}___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user