On Thu, Nov 21, 2013 at 10:05 AM, David Kastrup <d...@gnu.org> wrote:

> > \version "2.17.95"
> >
> > doubleStem =
> > #(define-music-function
> >   (parser location note)
> >   (ly:music?)
> >   #{
> >     << { \voiceOne #note } \new Voice { \voiceTwo #note } >> \oneVoice
> >   #})
> >
> > melody = \relative c' {
> >   c4 d e f
> >   \doubleStem g a b c
> > }
> >
> > \score {
> >   \new Staff \melody
> > }
>
> Ok, this one is a puzzler.  Its solution is that you wrote #note twice
> in the same music without making a copy.  Either call music-clone on one
> of the occurences of #note, or write $note (which does a copy anyway).
>
> If you don't do that, \relative will work _twice_ on the identical note
> while working through the music, shifting it up to g' first, and then
> seeing g', and consequently shifting it to g'' (taking the first
> occurence along).
>

That is starting to make sense, after reading it a few times :) I've
replaced #note with $note in both cases in the function and it works
properly. Thanks!

I need to go back and re-read the part about the difference between # and $
in Scheme variables...

James Worlton
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to