On Sun, Jun 14, 2020 at 3:15 PM Kieren MacMillan <
kieren_macmil...@sympatico.ca> wrote:

> Hi all,
>
> > However, I would like to avoid the Dynamics layer, because it introduces
> redundancy.
> > Is there a way to achieve the same result without that layer?
>
> If you want to really make Lilypond leap forward as an engraving tool,
> figure out a way to allow a grob (in this case a pedal bracket) to be
> "pushed" from one context (in this case a Staff) to another [adjacent?
> arbitrary?!] context (in this case a Dynamics). Then we’d all have the best
> of both worlds: complete context-ual flexibility with no redundancy.  =)
>
> We already have "\change Staff"… Surely this can’t be that hard?!
> (Note: If I could *find* the definition of "change" in the code, I might
> be able to do it myself. Apparently my search-fu is weak.)
>
> Cheers,
> Kieren.
> ________


Hi Kieren and all,

I elaborated this solution, meanwhile, which works well but needs to be
improved in the scheme part.
Then I firstly ask to all the gurus how could I arrange the \sustainOnII
and \sostenutoOnII functions so to work *after* a note, as \sustainOn and
\sostenutoOn do work

(note that I need to change the outside-staff-priority of the pedals line
spanners "on the fly", as a tweak after the note, and not as an \override
before it, as shown in the snippet below)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\version "2.19.84"

#(define pedalGapCtr 0)
#(define pedalGap 4)

pedWithGapBase = #(define-music-function (parser location type mus)
(string? ly:music?)
#{
  #(set! pedalGapCtr (+ pedalGapCtr 1))

  #(if (string=? type "Sustain") #{
    \once \override Staff.SustainPedalLineSpanner.outside-staff-priority =
#(* pedalGapCtr 10005)
  #})

  #(if (string=? type "Sostenuto") #{
    \once \override Staff.SostenutoPedalLineSpanner.outside-staff-priority
= #(* pedalGapCtr 10005)
  #})

  #mus

  #(if (eq? pedalGapCtr 2) #{
    \tweak color #green
    \tweak outside-staff-priority #(* pedalGapCtr 10000) _\markup {
\draw-line #(cons 0 pedalGap) }
  #})

  #(if (string=? type "Sustain") #{ \sustainOn #})

  #(if (string=? type "Sostenuto") #{ \sostenutoOn #})

  #(if (eq? pedalGapCtr 2) (set! pedalGapCtr 0))

#})

sustainOnII = #(define-music-function (parser location mus) (ly:music?) #{
\pedWithGapBase "Sustain" #mus #})

sostenutoOnII = #(define-music-function (parser location mus) (ly:music?)
#{ \pedWithGapBase "Sostenuto" #mus  #})

{
  \set Staff.pedalSustainStyle = #'mixed

  \sustainOnII c'4 \sostenutoOnII c' c' c'\sustainOff\sostenutoOff
  r1
  \sostenutoOnII c'4 \sustainOnII c' c' c'\sustainOff\sostenutoOff
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

HTH

Best,
P

Reply via email to