> -----Original Message-----
> From: David Kastrup [mailto:[email protected]]
> Sent: Friday, January 10, 2014 12:19 PM
> To: Daniel Rosen
> Cc: Eluze; [email protected]
> Subject: Re: Automatic octaves
> 
> Daniel Rosen <[email protected]> writes:
> 
> >> -----Original Message-----
> >> From: David Kastrup [mailto:[email protected]]
> >> Sent: Friday, January 10, 2014 11:31 AM
> >> To: Daniel Rosen
> >> Cc: Eluze; [email protected]
> >> Subject: Re: Automatic octaves
> >>
> >> You could use dak's most elegant make-relative macro...
> >>
> >> 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.
> 
> Sick.  But you'll get something similar with \relative { { << { a b c d } >> 
> } e f g a
> }
> 
> 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 }
> 
> 
> --
> David Kastrup

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 }

DR

_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to