Marc Hohl <m...@hohlart.de> writes: > Am 23.11.2015 um 21:41 schrieb Malte Meyn: >> Am 23.11.2015 um 10:46 schrieb Marc Hohl: >>> As the file is a bit lengthy, I think of a way to just redefine >>> \xNotes to change every note to its corresponding rest, instead of >>> rewriting the whole file (or using sed or any other external script). >>> >>> Has anyone a scheme routine at hand that does exactly this job? > > Malte, > >> I wrote this but it doesn’t work well in relative mode: >> >> \version "2.19.30" >> >> notesToRests = >> #(define-music-function (music) (ly:music?) >> (music-map >> (lambda (m) >> (if (eq? (ly:music-property m 'name) 'NoteEvent) >> (make-music 'RestEvent >> 'duration (ly:music-property m 'duration)) >> m)) >> music)) >> >> \relative { >> c' d e f \notesToRests { g a b2 g8 c } f e c2 >> } > > Thanks or sharing! The drawbacks in relative mode are neglectable, > I'll use absolute mode.
\version "2.19.30" notesToRests = #(define-music-function (music) (ly:music?) (make-relative (music) music (music-map (lambda (m) (if (eq? (ly:music-property m 'name) 'NoteEvent) (make-music 'RestEvent 'duration (ly:music-property m 'duration)) m)) (ly:music-deep-copy music)))) \relative { c' d e f \notesToRests { g a b2 g8 c } f e c2 }
-- David Kastrup
_______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user