bug-lilypond
[Top][All Lists]
Advanced

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

Re: ly:music-deep-copy and \relative


From: David Kastrup
Subject: Re: ly:music-deep-copy and \relative
Date: Sat, 25 Apr 2015 13:17:04 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Simon Albrecht <address@hidden> writes:

> Hello,
>
> as Harm has pointed out, the following example gives unexpected
> (i.e. different) output:
>
> \version "2.19"
> repeat-note =
> #(define-music-function (parser location music)(ly:music?)
>   (make-sequential-music (list music (ly:music-deep-copy music))))
>
> \absolute { c'1 \repeat-note c'' }
> \relative c' { c \repeat-note c'1 }
>
> There are several possible ways of handling this:
> – Document it as a feature of ly:music-deep-copy in its search
> string. Users would have to circumvent it then.

Huh?  What makes you think this a "feature" of ly:music-deep-copy ?

\absolute { c'1 { c'' c'' } }
\relative c' { c { c'1 c'1 } }

does exactly the same.

> – Modify ly:music-deep-copy to output both copies in the same
> octave.

Both copies _are_ the same before \relative is applied to the music.

> This would be most intuitive for what I think, since one would expect
> copies to be identical.

They are.

> – Provide an optional (?) second argument to ly:music-deep-copy to
> choose between the two behaviours: abs-copy to use \relative only for
> determining the start of the first copy and start the second copy from
> the same absolute pitch; rel-copy to apply \relative also on the first
> note of the second copy (as in current behaviour).  – Use two
> dedicated functions for these two ways of handling it. What would they
> be named? I’d suggest ly:music-deep-copy-relative (current behaviour)
> and ly:music-deep-copy (new behaviour).

You are completely wrong about this having _anything_ to do with
ly:music-deep-copy.  This is a matter of applying \relative to any kind
of computed music: that's always likely to lead to surprises.

Leave the ly:music-deep-copy off, and things get quite weirder since
then it is the identical music getting transformed by \relative: while
the result will contain identical octaves for both instances, they will
be _way_ too high because of \relative working twice on the same
expression.

You might get along using the make-relative macro.  In this case, it
would apply like

\version "2.18.0"
repeat-note =
#(define-music-function (parser location music)(ly:music?)
  (make-relative (music) #{ $music $music #}))

-- 
David Kastrup



reply via email to

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