Add articulation to last note in music

2015-03-13 Thread 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
}

--
Mark Knoop

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


Re: Add articulation to last note in music

2015-03-13 Thread Marc Hohl

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


Re: Add articulation to last note in music

2015-03-13 Thread Mark Knoop
At 20:08 on 13 Mar 2015, Marc Hohl wrote:
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 }

Yes, it does, but unfortunately that's no help in this situation. (The
phrases come from other sections of relative/transposed music filtered
through the extractMusic function. If it were that simple, I would just
type \glissando!)

Thanks,

Mark

-- 
Mark Knoop

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