Dear Gilles, thanks again for Your explanation! Best, Stefan Am Sa., 23. Apr. 2022 um 22:45 Uhr schrieb Gilles Thibault <gille...@free.fr >:
> > > I would like to ask You two questions concerning the code, You've > > sended: > > > 1. How does the function noteToRest "know", that the f sharp has to be > > converted to a rest? > > It is not an EventChord, only a NoteEvent > > > 2. Is it possible to to convert > > fis'8 r8 > > to > > r4 > > You can then use "arranger.ly" > > %%%%%%%%%%%%%%% > \version "2.22.0" > > \include "arranger.ly" > > global = { \time 7/8 s8*7*2 } > #(init '(dummy)) > > flutes = { > <f' g'>8 r fis' 8 r <d' gis'>8 r8 r > <f' g'>8 r fis' <d' gis'>8 r r4 } > > noteToRest = #(define-music-function (music) (ly:music?) > (map-some-music > (lambda(evt) > (case (name-of evt) ;; defined in "chordsAndVoices.ly" > ((EventChord) evt) > ((NoteEvent) (make-music 'RestEvent > 'duration (ly:music-property evt > 'duration))) > (else #f))) > music)) > > flA = \extractNote #2 \flutes > flB = \extractNote #1 \noteToRest \flutes > > #(rm 'flB '(1 4) #{ r4 #}) > > \score { << > \new Staff << \global \flutes >> > \new Staff << \global \flA >> > \new Staff << \global \flB >> > >> > } > > %%%%%%%%%%%%%%%% > > If you want to insert #{ r4 #} in the second beat of several bars, you > can use x-rm > and apply : > > #(apply x-rm 'flB #{ r4 #} (map (lambda(n)(list n 4)) > '(1 3 7 12 19))) % => '((1 4) (3 4) (7 > 4)....) > > If the 2 first bars are a rhythmic pattern used a lot of time in the > piece, you would probably prefer to use the function cp (changePitch). > > -- > Gilles >