[prev in list] [next in list] [prev in thread] [next in thread]
List: lilypond-user
Subject: Re: how to split into two parts
From: Stefan Thomas <kontrapunktstefan () gmail ! com>
Date: 2022-04-24 12:08:55
Message-ID: CAH-WrMFAxTsd6mRC8gJ3_47FhHxT5Papi=GVLLEOv-h5yD9EEA () mail ! gmail ! com
[Download RAW message or body]
Dear Gilles,
thanks again for Your explanation!
Best,
Stefan
Am Sa., 23. Apr. 2022 um 22:45 Uhr schrieb Gilles Thibault <gillesth@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
>
[Attachment #3 (text/html)]
<div dir="ltr"><div>Dear Gilles,</div><div>thanks again for Your \
explanation!</div><div>Best,</div><div>Stefan<br></div></div><br><div \
class="gmail_quote"><div dir="ltr" class="gmail_attr">Am Sa., 23. Apr. 2022 um 22:45 \
Uhr schrieb Gilles Thibault <<a \
href="mailto:gillesth@free.fr">gillesth@free.fr</a>>:<br></div><blockquote \
class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex"><br> > I would like to ask You two questions \
concerning the code, You've <br> > sended:<br>
<br>
> 1. How does the function noteToRest "know", that the f sharp has to \
be<br> > converted to a rest?<br>
<br>
It is not an EventChord, only a NoteEvent<br>
<br>
> 2. Is it possible to to convert<br>
> fis'8 r8<br>
> to<br>
> r4<br>
<br>
You can then use "<a href="http://arranger.ly" rel="noreferrer" \
target="_blank">arranger.ly</a>"<br> <br>
%%%%%%%%%%%%%%%<br>
\version "2.22.0"<br>
<br>
\include "<a href="http://arranger.ly" rel="noreferrer" \
target="_blank">arranger.ly</a>"<br> <br>
global = { \time 7/8 s8*7*2 }<br>
#(init '(dummy))<br>
<br>
flutes = {<br>
<f' g'>8 r fis' 8 r <d' gis'>8 r8 r<br>
<f' g'>8 r fis' <d' gis'>8 r r4 }<br>
<br>
noteToRest = #(define-music-function (music) (ly:music?)<br>
(map-some-music<br>
(lambda(evt)<br>
(case (name-of evt) ;; defined in "chordsAndVoices.ly"<br>
((EventChord) evt)<br>
((NoteEvent) (make-music 'RestEvent<br>
'duration (ly:music-property \
evt <br> 'duration)))<br>
(else #f)))<br>
music))<br>
<br>
flA = \extractNote #2 \flutes<br>
flB = \extractNote #1 \noteToRest \flutes<br>
<br>
#(rm 'flB '(1 4) #{ r4 #})<br>
<br>
\score { <<<br>
\new Staff << \global \flutes >><br>
\new Staff << \global \flA >><br>
\new Staff << \global \flB >><br>
>><br>
}<br>
<br>
%%%%%%%%%%%%%%%%<br>
<br>
If you want to insert #{ r4 #} in the second beat of several bars, you <br>
can use x-rm<br>
and apply :<br>
<br>
#(apply x-rm 'flB #{ r4 #} (map (lambda(n)(list n 4))<br>
'(1 3 7 12 19))) % => \
'((1 4) (3 4) (7 <br> 4)....)<br>
<br>
If the 2 first bars are a rhythmic pattern used a lot of time in the <br>
piece, you would probably prefer to use the function cp (changePitch).<br>
<br>
-- <br>
Gilles<br>
</blockquote></div>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic