lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: function to replace notes by rests


From: Marc Hohl
Subject: Re: function to replace notes by rests
Date: Tue, 24 Nov 2015 08:32:51 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

Am 24.11.2015 um 08:27 schrieb Jacques Menu:
Hello Malte,

Interesting, but why are there halves instead of quarters in the second
staff?


Because the first \relative bock ends with halves and this duration is
used for the next \relative block as well.

Just using \relative multiple times doesn't reset the default duration to 4 (which would be quite a nuisance, anyway).

Marc

JM


\version "2.19.32"

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
}

\relative {
   c' d e f \notesToRests \relative { g' a b2 g8 c } f' e c2
}



Le 24 nov. 2015 à 08:21, Malte Meyn <address@hidden
<mailto:address@hidden>> a écrit :



Am 24.11.2015 um 08:10 schrieb Marc Hohl:
Thanks or sharing! The drawbacks in relative mode are neglectable, I'll
use absolute mode.


Alternatively you could use

1. another \relative block inside of notesToRests
\relative {
  c' d e f \notesToRests \relative { g' a b2 g8 c } f' e c2
}

or

2. octave checks if you don’t mind the warnings
\relative {
  c' d e f \notesToRests { g a b2 g8 c } f='' e c2
}

_______________________________________________
lilypond-user mailing list
address@hidden <mailto:address@hidden>
https://lists.gnu.org/mailman/listinfo/lilypond-user



_______________________________________________
lilypond-user mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/lilypond-user





reply via email to

[Prev in Thread] Current Thread [Next in Thread]