[prev in list] [next in list] [prev in thread] [next in thread]
List: lilypond-user
Subject: Re: duration using variable
From: Gianmaria Lari <gianmarialari () gmail ! com>
Date: 2016-04-27 20:02:07
Message-ID: CAKhGe3wMT9N-Qg4-Y4vqCC1m-t=uYhhpHX0NECjBzbL0rwAfsw () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
Dear Harm,
I made many test, and... it works really well! Thanks a lot for your kind
help!
g.
On Wed, Apr 27, 2016 at 1:12 PM, Thomas Morley <thomasmorley65@gmail.com>
wrote:
> 2016-04-27 10:56 GMT+02:00 Gianmaria Lari <gianmarialari@gmail.com>:
> > I don't know if the following code is well written (suggestions are
> pretty
> > welcome!!) but it works as I like (:)) and let me generate two different
> > output according the tag midiOut or screenOut.
> >
> > \version "2.19.40"
> >
> > mynote = c
> >
> > mynoteExp = {\mynote}
> > mynoteDouble = {<\mynote' \mynote>}
> >
> > cC = {\tag #'midiOut \mynoteDouble
> > \tag #'screenOut \mynoteExp }
> >
> > music =
> > {
> > \time 3/4 \clef bass
> > \cC
> > }
> >
> > \score
> > {
> > \keepWithTag #'screenOut \music
> > \layout {}
> > }
> >
> > \score
> > {
> > \keepWithTag #'midiOut \music
> > \layout {}
> > \midi {}
> > }
> >
> >
> > In the attached capture.png you can see the two different output, the
> first
> > when using screenOut and the second using midiOut.
> >
> > * * *
> >
> > Now I would like to be able to increase the lenght of the musical
> expression
> > contained in the cC variable.
> >
> > In the previous example the cC variable contains a quarter note (and a
> > quarter bichord) and I would like to change it to an half note. I tried
> with
> > the "changePitch.ly" snippet
> > (
> http://gillesth.free.fr/Lilypond/changePitch/changePitchDoc-sources/changePitch-doc.pdf
> )
> > writing
> >
> > \changePitch {a2} \cC
> >
> > but this does not work.
> >
> > Here it is the whole code (I highlighted the differences compared to the
> > previous example)
> >
> > \version "2.19.40"
> > \include "changePitch.ly"
> >
> > mynote = c
> >
> > mynoteExp = {\mynote}
> > mynoteDouble = {<\mynote' \mynote>}
> >
> > cC = {\tag #'midiOut \mynoteDouble
> > \tag #'screenOut \mynoteExp }
> >
> > music =
> > {
> > \time 3/4 \clef bass
> > \changePitch {a2} \cC
> > }
> >
> > \score
> > {
> > \keepWithTag #'screenOut \music
> > \layout {}
> > }
> >
> > \score
> > {
> > \keepWithTag #'midiOut \music
> > \layout {}
> > \midi {}
> > }
> >
> >
> > and in the attached file capture2 you can find the output for this second
> > scenario.
> >
> > Consider that:
> > - the variable cC will always contain a single note or a single chord
> > - I tried using changepitch but any other (possibly simpler) way is
> welcome
> >
> > Any suggestion?
> > Thank you, g.
>
>
>
> Probably:
>
> \version "2.19.40"
>
> %% nb: this is a pitch:
> mynote = c
>
> %% this is sequential music, with a NoteEvent in 'elements:
> mynoteExp = { \mynote }
>
> %% this is sequential music, with an EventChord in 'elements:
> mynoteDouble = { <\mynote' \mynote> }
>
> setNotesDur =
> #(define-music-function (mus dur)(ly:music? ly:duration?)
> "Set the duration of all 'NoteEvents in `mus' to `dur'"
> (for-each
> (lambda (m)
> (ly:music-set-property! m 'duration dur))
> (extract-named-music mus 'NoteEvent))
> mus)
>
> cC = {\tag #'midiOut { \setNotesDur \mynoteDouble 32 }
> \tag #'screenOut \mynoteExp }
>
> music =
> {
> \time 3/4 \clef bass
> \cC
> }
>
> \score
> {
> \keepWithTag #'screenOut \music
> \layout {}
> }
>
> \score
> {
> \keepWithTag #'midiOut \music
> \layout {}
> \midi {}
> }
>
> Cheers,
> Harm
>
[Attachment #5 (text/html)]
<div dir="ltr">Dear Harm,<div><br></div><div>I made many test, and... it works really \
well! Thanks a lot for your kind help!</div><div><br></div><div>g.</div></div><div \
class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 27, 2016 at 1:12 PM, \
Thomas Morley <span dir="ltr"><<a href="mailto:thomasmorley65@gmail.com" \
target="_blank">thomasmorley65@gmail.com</a>></span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">2016-04-27 10:56 \
GMT+02:00 Gianmaria Lari <<a \
href="mailto:gianmarialari@gmail.com">gianmarialari@gmail.com</a>>:<br> > I \
don't know if the following code is well written (suggestions are pretty<br> > \
welcome!!) but it works as I like (:)) and let me generate two different<br> > \
output according the tag midiOut or screenOut.<br> ><br>
> \version "2.19.40"<br>
><br>
> mynote = c<br>
><br>
> mynoteExp = {\mynote}<br>
> mynoteDouble = {<\mynote' \mynote>}<br>
><br>
> cC = {\tag #'midiOut \mynoteDouble<br>
> \tag #'screenOut \mynoteExp }<br>
><br>
> music =<br>
> {<br>
> \time 3/4 \clef bass<br>
> \cC<br>
> }<br>
><br>
> \score<br>
> {<br>
> \keepWithTag #'screenOut \music<br>
> \layout {}<br>
> }<br>
><br>
> \score<br>
> {<br>
> \keepWithTag #'midiOut \music<br>
> \layout {}<br>
> \midi {}<br>
> }<br>
><br>
><br>
> In the attached capture.png you can see the two different output, the first<br>
> when using screenOut and the second using midiOut.<br>
><br>
> * * *<br>
><br>
> Now I would like to be able to increase the lenght of the musical expression<br>
> contained in the cC variable.<br>
><br>
> In the previous example the cC variable contains a quarter note (and a<br>
> quarter bichord) and I would like to change it to an half note. I tried with<br>
> the "changePitch.ly" snippet<br>
> (<a href="http://gillesth.free.fr/Lilypond/changePitch/changePitchDoc-sources/changePitch-doc.pdf" \
rel="noreferrer" target="_blank">http://gillesth.free.fr/Lilypond/changePitch/changePitchDoc-sources/changePitch-doc.pdf</a>)<br>
> writing<br>
><br>
> \changePitch {a2} \cC<br>
><br>
> but this does not work.<br>
><br>
> Here it is the whole code (I highlighted the differences compared to the<br>
> previous example)<br>
><br>
> \version "2.19.40"<br>
> \include "changePitch.ly"<br>
><br>
> mynote = c<br>
><br>
> mynoteExp = {\mynote}<br>
> mynoteDouble = {<\mynote' \mynote>}<br>
><br>
> cC = {\tag #'midiOut \mynoteDouble<br>
> \tag #'screenOut \mynoteExp }<br>
><br>
> music =<br>
> {<br>
> \time 3/4 \clef bass<br>
> \changePitch {a2} \cC<br>
> }<br>
><br>
> \score<br>
> {<br>
> \keepWithTag #'screenOut \music<br>
> \layout {}<br>
> }<br>
><br>
> \score<br>
> {<br>
> \keepWithTag #'midiOut \music<br>
> \layout {}<br>
> \midi {}<br>
> }<br>
><br>
><br>
> and in the attached file capture2 you can find the output for this second<br>
> scenario.<br>
><br>
> Consider that:<br>
> - the variable cC will always contain a single note or a single chord<br>
> - I tried using changepitch but any other (possibly simpler) way is welcome<br>
><br>
> Any suggestion?<br>
> Thank you, g.<br>
<br>
<br>
<br>
</div></div>Probably:<br>
<br>
\version "2.19.40"<br>
<br>
%% nb: this is a pitch:<br>
mynote = c<br>
<br>
%% this is sequential music, with a NoteEvent in 'elements:<br>
mynoteExp = { \mynote }<br>
<br>
%% this is sequential music, with an EventChord in 'elements:<br>
mynoteDouble = { <\mynote' \mynote> }<br>
<br>
setNotesDur =<br>
#(define-music-function (mus dur)(ly:music? ly:duration?)<br>
"Set the duration of all 'NoteEvents in `mus' to `dur'"<br>
(for-each<br>
(lambda (m)<br>
(ly:music-set-property! m 'duration dur))<br>
(extract-named-music mus 'NoteEvent))<br>
mus)<br>
<br>
cC = {\tag #'midiOut { \setNotesDur \mynoteDouble 32 }<br>
<span class=""> \tag #'screenOut \mynoteExp }<br>
<br>
music =<br>
{<br>
\time 3/4 \clef bass<br>
\cC<br>
}<br>
<br>
\score<br>
{<br>
\keepWithTag #'screenOut \music<br>
\layout {}<br>
}<br>
<br>
\score<br>
{<br>
\keepWithTag #'midiOut \music<br>
\layout {}<br>
\midi {}<br>
}<br>
<br>
</span>Cheers,<br>
Harm<br>
</blockquote></div><br></div>
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic