lilypond-user
[Top][All Lists]
Advanced

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

Re: \makeOctaves broken?


From: David Kastrup
Subject: Re: \makeOctaves broken?
Date: Thu, 19 Apr 2012 09:56:24 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux)

> I am not top posting

Yes, this is a duplicate, but perhaps with the "not top posting"
stupidity it will actually arrive at the list before the discussion is
over.  I apologize for whichever copy will arrive latest.

Urs Liska <address@hidden> writes:

[...]

I recommend a healthy dose of cheating.  The main non-triviality seems
to be dealing with relative music properly.  Other than that it is just
<< \transpose c' c'' $xxx $xxx >> or similar.  So let's treat the
problem at the root, with a to-relative-callback for the transposed
music that a) returns the unchanged reference pitch for the sake of the
following music b) temporarily undoes the octave transposition for the
sake of relativizing.

makeOctaves =
#(define-music-function (parser location arg mus)
  (integer? ly:music?)
  #{ << \withMusicProperty #'to-relative-callback
        #(lambda (m p)
          (let ((mu (ly:music-property m 'element)))
           (ly:music-transpose mu (ly:make-pitch (- arg) 0 0))
           (ly:make-music-relative! mu p)
           (ly:music-transpose mu (ly:make-pitch arg 0 0)))
          p)
        \transpose c' $(ly:make-pitch arg 0 0) $mus
        $mus
     >>
  #})

\relative c' {
  \time 3/8
  \key gis \minor
  \makeOctaves #1  { dis8( e dis')~ dis8.( cis16 b8}
  \makeOctaves #-1 { ais' gis dis) cis( dis<dis gis'>) }
}


-- 
David Kastrup




reply via email to

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