> On Apr 27, 2016, at 3:57 AM, lilypond-user-requ...@gnu.org wrote: > > Message: 4 > Date: Wed, 27 Apr 2016 10:56:53 +0200 > From: Gianmaria Lari <gianmarial...@gmail.com> > 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 _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user