lilypond-user
[Top][All Lists]
Advanced

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

Re: \makeOctaves broken?


From: Urs Liska
Subject: Re: \makeOctaves broken?
Date: Thu, 19 Apr 2012 21:09:25 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:11.0) Gecko/20120329 Thunderbird/11.0.1

just another observation:
While it worked smoothly with the last example, the function complains when there are phrasingSlurs involved. I get a message saying a) (at the beginning) that there already is a phrasingSlur and b) (at the end) that the phrasingSlur can't be ended.
The result is correct, though.

BTW: shouldn't it be quite easy (and interesting) to modify the function so that arg doesn't mean the number of octaves but a number of semitones?

Best
Urs

Am 19.04.2012 19:58, schrieb Urs Liska:
Hi all,

thank you very much for all these thoughts.
I'm so sorry that I don't understand a (Scheme) word from it ...
But judging from my programming experience in other languages David's last solution looks _very_ elegant. And it seems to work, even with still more complex chords and multiple articulations.

I'd suggest to rename the function though, because "makeOctaves" suggests that it (only) makes octaves from monophonic notes.

And it may be of interest to note that the function also works with other values than +/- 1,
and that it can be nested:

\relative c {
  \time 3/8
  \key gis \minor
  \makeOctaves #1  { dis8( e dis')~ dis8.( cis16 b8) }
  \makeOctaves #2 { ais8. gis32_| fis^| e8^._-  }
  \makeOctaves #2 {
    \makeOctaves #-1 {
      ais'( gis-. dis-.) cis( dis<dis gis'>)
<e g bes> <f d'>_^^.<fis cis' gis'>_.^-
    }
  }
}

Any chance to get this incorporated to default LilyPond syntax?

Best (and many thanks)
Urs

Am 19.04.2012 09:56, schrieb David Kastrup:
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'>) }
}




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




reply via email to

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