lilypond-user
[Top][All Lists]
Advanced

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

Re: Automatic octaves


From: David Kastrup
Subject: Re: Automatic octaves
Date: Sat, 11 Jan 2014 13:00:46 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Daniel Rosen <address@hidden> 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



reply via email to

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