Urs Liska <li...@ursliska.de> 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


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

Reply via email to