Le 13/09/2021 à 15:49, Leo Correia de Verdier a écrit :
Dear list!

How would I go about to write a scheme function that converts all rests in a 
passage of music to spacer rests?

Thanks in advance!

/Leo


\version "2.22.1"

restsToSkips =
#(define-music-function (music) (ly:music?)
   (music-map
     (lambda (m)
       (if (music-is-of-type? m 'rest-event)
           (make-music 'SkipEvent m)
           m))
     music))

\restsToSkips { r1 c'2 s4 r4 }


Some explanations about music-map, music-is-of-type?
and make-music are at
https://extending-lilypond.readthedocs.io/en/latest/music.html#music-expressions

Best,
Jean



Reply via email to