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,