Am 13.03.2015 um 19:32 schrieb Mark Knoop:
Hi,

I'm trying to make a function to add a glissando to the last note of a
music expression. I've got to a version which works with simple music
expressions. However, I need to use it with transposed and relative
music where the actual notes may be nested within other lists.

How do I recurse into the music to find the SequentialMusic elements?

\version "2.18.2"

addGliss = #(define-music-function (parser location music) (ly:music?)
   "Add a GlissandoEvent to the last element of music"
   (let* ((gliss-note (last (ly:music-property music 'elements))))
     (set! (ly:music-property gliss-note 'articulations)
         (cons (make-music 'GlissandoEvent)
               (ly:music-property gliss-note 'articulations)))
   music))

mynotes = { c' d' e' }

{
   % works with above function
   \addGliss { c' d' e' } c'
   \addGliss \mynotes c'
   % doesn't work with more complex music
   %\addGliss \relative c' { c d e } c
   %\addGliss \transpose c e \relative c' { c d e } c
}

... but it works with

\relative c' { \addGliss { c d e } c }
\transpose c e \relative c' { \addGliss { c d e } c }

HTH,

Marc


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

Reply via email to