Daniel Rosen <drose...@gmail.com> writes:

>> >> myoctavate =
>> >> #(define-music-function (parser location music) (ly:music?)
>> >>   (make-relative (music) music
>> >>     #{ \context Bottom << $music \transpose c c' $music >> #}))
>> >>
>> >> \relative { \myoctavate { a b c d } e f g a }
>> >
>> > That gets me the attached output.
>> 
>> The \context Bottom helps to avoid the effect in the macro itself but does
>> not manage to extent its effect beyond itself.  I don't have anything to 
>> offer
>> that would work better, so you just have to use explicit contexts, like
>> 
>> \relative \new Voice { \myoctavate { a b c d } e f g a }
>
> Kieren's solution worked fine:
>
> \version "2.18.0"
> myoctavate =
> #(define-music-function (parser location music) (ly:music?)
>   #{ \context Bottom << $music \transpose c c' \relative $music >> #})
>
> \relative { \myoctavate { a b c d } e f g a }

See <URL:http://code.google.com/p/lilypond/issues/detail?id=3797> which
will, once completed, fix this problem.  Until then: explicit contexts.

Kieren's solution does not actually work.  If you write, say,

\relative { c' \myoctavate { d e f } }

it gets turned into
\relative { c'
  \context Bottom << { d e f } \transpose c c' \relative { d e f } >> }

and then into { c' \context Bottom << { d' e' f' } { d' e' f' } >> }
since the first $music goes up one octave by virtue of being relative to
the first c', and the second $music goes up one octave by being
transposed.

-- 
David Kastrup

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

Reply via email to