lilypond-user
[Top][All Lists]
Advanced

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

Re: duration using variable (Gianmaria Lari)


From: Cynthia Karl
Subject: Re: duration using variable (Gianmaria Lari)
Date: Wed, 27 Apr 2016 10:27:26 -0500

> On Apr 27, 2016, at 3:57 AM, address@hidden wrote:
> 
> Message: 4
> Date: Wed, 27 Apr 2016 10:56:53 +0200
> From: Gianmaria Lari <address@hidden>
> Subject: duration using 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.

I think that is because at the time \changePitch is invoked, \keepWithTag has 
not yet been invoked and changePitch removes the tags as can be demonstrated 
with displayLilyMusic:

 \displayLilyMusic \changePitch {a2} \cC

So there’s no chance for the two \keepWithTag expressions to do what you want.

> 
> Here it is the whole code 
<snip>
> Any suggestion?

Try this:

\version "2.19.38"
\include "changePitch.ly"

mynote = c
mynoteExp = {\mynote}
mynoteDouble = {<\mynote' \mynote>}

cC = { \tag #'midiOut \mynoteDouble
          \tag #'screenOut \mynoteExp }

music_screenOut =
{
\time 3/4 \clef bass
\changePitch {a2} \keepWithTag #'screenOut \cC
}

music_midiOut =
{
\time 3/4 \clef bass
\changePitch {a2} \keepWithTag #'midiOut \cC
}

\score
{
\music_screenOut
\layout {}
}

\score
{
\music_midiOut
\layout {}
\midi {}
}

HTH
Pat


reply via email to

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