lilypond-user
[Top][All Lists]
Advanced

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

Re: Current octave in relative mode


From: David Kastrup
Subject: Re: Current octave in relative mode
Date: Fri, 15 May 2020 13:24:33 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Klaus Blum <address@hidden> writes:

> Hi,
>
> I have a function that uses a music expression twice.
> My problem is:
> In relative mode, this expression can lead into a different octave. Then
> the second application of the music expression starts from that new octave.
> (See the last two invocations of "\highlight" in the example below)
>
> Is there something I can do INSIDE my function to prevent this? E.g.
> storing and re-applying the current octave? Thanks for any hint.  :)
>
>
> % ----------------------------------------
> highlight =
> #(define-music-function (mus)
>    (ly:music?)
>    #{
>      <<
>        $mus
>        \makeClusters $mus
>      >>
>    #})
>
> \new Staff {
>   \highlight { c'8 d' e' f' g' a' b' c'' }
>   \relative c' {
>     c1  \highlight { c8 d e f g f e d }
>     c1  \highlight { c8 d e f g a b c }
>     c1  \highlight { f,4 e d c }
>     c1
>   }
> }
> % ----------------------------------------

If your mail client cannot be kept from mangling spaces into unbreakable
spaces, you might want to think about attaching program files.

Try this.

% ----------------------------------------
highlight =
#(define-music-function (mus)
  (ly:music?)
  (make-relative (mus) mus
   #{
     <<
       $mus
       \makeClusters $mus
     >>
   #}))

\new Staff {
  \highlight { c'8 d' e' f' g' a' b' c'' }
  \relative c' {
    c1  \highlight { c8 d e f g f e d }
    c1  \highlight { c8 d e f g a b c }
    c1  \highlight { f,4 e d c }
    c1
  }
}
% ----------------------------------------

-- 
David Kastrup

reply via email to

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