lilypond-user
[Top][All Lists]
Advanced

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

Add articulation to last note in music


From: Mark Knoop
Subject: Add articulation to last note in music
Date: Fri, 13 Mar 2015 18:32:23 +0000

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
}

--
Mark Knoop



reply via email to

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