lilypond-user
[Top][All Lists]
Advanced

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

Re: Add articulation to last note in music


From: Marc Hohl
Subject: Re: Add articulation to last note in music
Date: Fri, 13 Mar 2015 20:08:29 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0

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




reply via email to

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