On Sun, Jun 14, 2020 at 5:36 PM Paolo Prete <paolopr...@gmail.com> wrote:
> > > 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 > After looking at this snippet: http://lsr.di.unimi.it/LSR/Snippet?id=1058 I begin to suspect there's not a solution for the problem I just highlighted: in fact in that snippet too the "new" pedal ( \sustainHalfOn ) has to be placed *before* a note, while the standard one (\sustainOn) has to be placed after. It would be *really* great if someone finds a solution for this, because otherwise overriding pedals: 1) lead to inconsistencies in the code style (as the snippet above shows) or 2) lead to verbose code (if we use something like \setHalfPedal c'\sustainOn ) Also, please note that a fixed gap between pedals is very important in music engraving... Please give me feedback! Best, P