[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 &lt;<a \
href="mailto:gillesth@free.fr">gillesth@free.fr</a>&gt;:<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> &gt; I would like to ask You two questions \
concerning the code, You&#39;ve <br> &gt; sended:<br>
<br>
&gt; 1. How does the function noteToRest &quot;know&quot;, that the f sharp has to \
be<br> &gt; converted to a rest?<br>
<br>
It is not an EventChord, only a NoteEvent<br>
<br>
&gt; 2. Is it possible to to convert<br>
&gt;      fis&#39;8 r8<br>
&gt; to<br>
&gt;      r4<br>
<br>
You can then use &quot;<a href="http://arranger.ly" rel="noreferrer" \
target="_blank">arranger.ly</a>&quot;<br> <br>
%%%%%%%%%%%%%%%<br>
\version &quot;2.22.0&quot;<br>
<br>
\include &quot;<a href="http://arranger.ly" rel="noreferrer" \
target="_blank">arranger.ly</a>&quot;<br> <br>
global = { \time 7/8 s8*7*2 }<br>
#(init &#39;(dummy))<br>
<br>
flutes =   {<br>
     &lt;f&#39; g&#39;&gt;8 r fis&#39; 8 r   &lt;d&#39; gis&#39;&gt;8 r8 r<br>
     &lt;f&#39; g&#39;&gt;8   r fis&#39;   &lt;d&#39; gis&#39;&gt;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 &quot;chordsAndVoices.ly&quot;<br>
               ((EventChord) evt)<br>
               ((NoteEvent) (make-music &#39;RestEvent<br>
                                                     &#39;duration (ly:music-property \
evt <br> &#39;duration)))<br>
               (else #f)))<br>
         music))<br>
<br>
flA = \extractNote #2 \flutes<br>
flB = \extractNote #1 \noteToRest \flutes<br>
<br>
#(rm &#39;flB &#39;(1 4) #{ r4 #})<br>
<br>
\score { &lt;&lt;<br>
     \new Staff &lt;&lt; \global \flutes &gt;&gt;<br>
     \new Staff &lt;&lt; \global \flA &gt;&gt;<br>
     \new Staff &lt;&lt; \global \flB &gt;&gt;<br>
     &gt;&gt;<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 &#39;flB #{ r4 #} (map (lambda(n)(list n 4))<br>
                                                  &#39;(1 3 7 12 19))) % =&gt; \
&#39;((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